本文整理汇总了C++中JSDOMWindow::impl方法的典型用法代码示例。如果您正苦于以下问题:C++ JSDOMWindow::impl方法的具体用法?C++ JSDOMWindow::impl怎么用?C++ JSDOMWindow::impl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSDOMWindow
的用法示例。
在下文中一共展示了JSDOMWindow::impl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: putByIndex
void JSDOMWindow::putByIndex(JSCell* cell, ExecState* exec, unsigned index, JSValue value, bool shouldThrow)
{
JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(cell);
if (!thisObject->impl().frame())
return;
PropertyName propertyName = Identifier::from(exec, index);
// Optimization: access JavaScript global variables directly before involving the DOM.
if (thisObject->JSGlobalObject::hasOwnPropertyForWrite(exec, propertyName)) {
if (BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->impl()))
JSGlobalObject::putByIndex(thisObject, exec, index, value, shouldThrow);
return;
}
if (BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->impl()))
Base::putByIndex(thisObject, exec, index, value, shouldThrow);
}
示例2: put
void JSDOMWindow::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
{
JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(cell);
if (!thisObject->impl()->frame())
return;
// Optimization: access JavaScript global variables directly before involving the DOM.
if (thisObject->JSGlobalObject::hasOwnPropertyForWrite(exec, propertyName)) {
if (BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->impl()))
JSGlobalObject::put(thisObject, exec, propertyName, value, slot);
return;
}
if (lookupPut<JSDOMWindow>(exec, propertyName, value, s_info.propHashTable(exec), thisObject))
return;
if (BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->impl()))
Base::put(thisObject, exec, propertyName, value, slot);
}
示例3: parseCode
void JSLazyEventListener::parseCode() const
{
if (m_parsed)
return;
if (m_globalObject->scriptExecutionContext()->isDocument()) {
JSDOMWindow* window = static_cast<JSDOMWindow*>(m_globalObject);
Frame* frame = window->impl()->frame();
if (!frame)
return;
// FIXME: Is this check needed for non-Document contexts?
ScriptController* script = frame->script();
if (!script->isEnabled() || script->isPaused())
return;
}
m_parsed = true;
ExecState* exec = m_globalObject->globalExec();
MarkedArgumentBuffer args;
UString sourceURL(m_globalObject->scriptExecutionContext()->url().string());
args.append(jsNontrivialString(exec, m_eventParameterName));
args.append(jsString(exec, m_code));
// FIXME: Passing the document's URL to construct is not always correct, since this event listener might
// have been added with setAttribute from a script, and we should pass String() in that case.
m_jsFunction = constructFunction(exec, args, Identifier(exec, m_functionName), sourceURL, m_lineNumber); // FIXME: is globalExec ok?
JSFunction* listenerAsFunction = static_cast<JSFunction*>(m_jsFunction);
if (exec->hadException()) {
exec->clearException();
// failed to parse, so let's just make this listener a no-op
m_jsFunction = 0;
} else if (m_originalNode) {
// Add the event's home element to the scope
// (and the document, and the form - see JSHTMLElement::eventHandlerScope)
ScopeChain scope = listenerAsFunction->scope();
JSValue thisObj = toJS(exec, m_originalNode);
if (thisObj.isObject()) {
static_cast<JSNode*>(asObject(thisObj))->pushEventHandlerScope(exec, scope);
listenerAsFunction->setScope(scope);
}
}
// Since we only parse once, there's no need to keep data used for parsing around anymore.
m_functionName = String();
m_code = String();
m_eventParameterName = String();
}
示例4: defineOwnProperty
bool JSDOMWindow::defineOwnProperty(JSC::JSObject* object, JSC::ExecState* exec, JSC::PropertyName propertyName, JSC::PropertyDescriptor& descriptor, bool shouldThrow)
{
JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object);
// Only allow defining properties in this way by frames in the same origin, as it allows setters to be introduced.
if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->impl()))
return false;
// Don't allow shadowing location using accessor properties.
if (descriptor.isAccessorDescriptor() && propertyName == Identifier(exec, "location"))
return false;
return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow);
}
示例5: windowProtoFuncShowModalDialog
JSValuePtr windowProtoFuncShowModalDialog(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
JSDOMWindow* window = toJSDOMWindow(thisValue);
if (!window)
return throwError(exec, TypeError);
if (!window->allowsAccessFrom(exec))
return jsUndefined();
Frame* frame = window->impl()->frame();
if (!frame)
return jsUndefined();
return showModalDialog(exec, frame, valueToStringWithUndefinedOrNullCheck(exec, args.at(exec, 0)), args.at(exec, 1), valueToStringWithUndefinedOrNullCheck(exec, args.at(exec, 2)));
}
示例6: execute
void ScheduledAction::execute(Document* document)
{
JSDOMWindow* window = toJSDOMWindow(document->frame(), m_isolatedWorld.get());
if (!window)
return;
RefPtr<Frame> frame = window->impl()->frame();
if (!frame || !frame->script()->canExecuteScripts(AboutToExecuteScript))
return;
if (m_function)
executeFunctionInContext(window, window->shell(), document);
else
frame->script()->executeScriptInWorld(m_isolatedWorld.get(), m_code);
}
示例7: lock
ScriptCachedFrameData::ScriptCachedFrameData(Frame* frame)
: m_domWindow(0)
{
JSLock lock(SilenceAssertionsOnly);
ScriptController* scriptController = frame->script();
ScriptController::ShellMap& windowShells = scriptController->m_windowShells;
ScriptController::ShellMap::iterator windowShellsEnd = windowShells.end();
for (ScriptController::ShellMap::iterator iter = windowShells.begin(); iter != windowShellsEnd; ++iter) {
JSDOMWindow* window = iter->second->window();
m_windows.add(iter->first.get(), window);
m_domWindow = window->impl();
}
scriptController->attachDebugger(0);
}
示例8: execute
void ScheduledAction::execute(Document* document)
{
JSDOMWindow* window = toJSDOMWindow(document->frame());
if (!window)
return;
RefPtr<Frame> frame = window->impl()->frame();
if (!frame || !frame->script()->isEnabled())
return;
frame->script()->setProcessingTimerCallback(true);
if (m_function) {
executeFunctionInContext(window, window->shell());
Document::updateStyleForAllDocuments();
} else
frame->loader()->executeScript(m_code);
frame->script()->setProcessingTimerCallback(false);
}
示例9: stringByEvaluatingJavaScriptInScriptWorld
bool WebFrame::stringByEvaluatingJavaScriptInScriptWorld(WebScriptWorld* world, void* jsGlobalObject, const char* script, const char** evaluationResult)
{
if (!world || !jsGlobalObject || !evaluationResult)
return false;
*evaluationResult = 0;
Frame* coreFrame = core(this);
JSObjectRef globalObjectRef = reinterpret_cast<JSObjectRef>(jsGlobalObject);
String string = String(script);
// Start off with some guess at a frame and a global object, we'll try to do better...!
JSDOMWindow* anyWorldGlobalObject = coreFrame->script()->globalObject(mainThreadNormalWorld());
// The global object is probably a shell object? - if so, we know how to use this!
JSC::JSObject* globalObjectObj = toJS(globalObjectRef);
if (!strcmp(globalObjectObj->classInfo()->className, "JSDOMWindowShell"))
anyWorldGlobalObject = static_cast<JSDOMWindowShell*>(globalObjectObj)->window();
// Get the frame from the global object we've settled on.
Frame* frame = anyWorldGlobalObject->impl()->frame();
ASSERT(frame->document());
JSC::JSValue result = frame->script()->executeScriptInWorld(world->world(), string, true).jsValue();
if (!frame) // In case the script removed our frame from the page.
return true;
// This bizarre set of rules matches behavior from WebKit for Safari 2.0.
// If you don't like it, use -[WebScriptObject evaluateWebScript:] or
// JSEvaluateScript instead, since they have less surprising semantics.
if (!result || !result.isBoolean() && !result.isString() && !result.isNumber())
return true;
JSC::JSLock lock(JSC::SilenceAssertionsOnly);
String resultString = ustringToString(result.toString(anyWorldGlobalObject->globalExec()));
*evaluationResult = strdup(resultString.utf8().data());
return true;
}
示例10: handleEvent
void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext, Event* event)
{
ASSERT(scriptExecutionContext);
if (!scriptExecutionContext || scriptExecutionContext->isJSExecutionForbidden())
return;
JSLock lock(SilenceAssertionsOnly);
JSObject* jsFunction = this->jsFunction(scriptExecutionContext);
if (!jsFunction)
return;
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext, m_isolatedWorld.get());
if (!globalObject)
return;
if (scriptExecutionContext->isDocument()) {
JSDOMWindow* window = static_cast<JSDOMWindow*>(globalObject);
Frame* frame = window->impl()->frame();
if (!frame)
return;
// The window must still be active in its frame. See <https://bugs.webkit.org/show_bug.cgi?id=21921>.
// FIXME: A better fix for this may be to change DOMWindow::frame() to not return a frame the detached window used to be in.
if (frame->domWindow() != window->impl())
return;
// FIXME: Is this check needed for other contexts?
ScriptController* script = frame->script();
if (!script->canExecuteScripts(AboutToExecuteScript) || script->isPaused())
return;
}
ExecState* exec = globalObject->globalExec();
JSValue handleEventFunction = jsFunction;
CallData callData;
CallType callType = getCallData(handleEventFunction, callData);
// If jsFunction is not actually a function, see if it implements the EventListener interface and use that
if (callType == CallTypeNone) {
handleEventFunction = jsFunction->get(exec, Identifier(exec, "handleEvent"));
callType = getCallData(handleEventFunction, callData);
}
if (callType != CallTypeNone) {
RefPtr<JSEventListener> protect(this);
MarkedArgumentBuffer args;
args.append(toJS(exec, globalObject, event));
Event* savedEvent = globalObject->currentEvent();
globalObject->setCurrentEvent(event);
JSGlobalData& globalData = globalObject->globalData();
DynamicGlobalObjectScope globalObjectScope(globalData, globalData.dynamicGlobalObject ? globalData.dynamicGlobalObject : globalObject);
globalData.timeoutChecker.start();
JSValue thisValue = handleEventFunction == jsFunction ? toJS(exec, globalObject, event->currentTarget()) : jsFunction;
JSValue retval = scriptExecutionContext->isDocument()
? JSMainThreadExecState::call(exec, handleEventFunction, callType, callData, thisValue, args)
: JSC::call(exec, handleEventFunction, callType, callData, thisValue, args);
globalData.timeoutChecker.stop();
globalObject->setCurrentEvent(savedEvent);
#if ENABLE(WORKERS)
if (scriptExecutionContext->isWorkerContext()) {
bool terminatorCausedException = (exec->hadException() && isTerminatedExecutionException(exec->exception()));
if (terminatorCausedException || globalData.terminator.shouldTerminate())
static_cast<WorkerContext*>(scriptExecutionContext)->script()->forbidExecution();
}
#endif
if (exec->hadException()) {
event->target()->uncaughtExceptionInEventHandler();
reportCurrentException(exec);
} else {
if (!retval.isUndefinedOrNull() && event->storesResultAsString())
event->storeResult(ustringToString(retval.toString(exec)->value(exec)));
if (m_isAttribute) {
if (retval.isFalse())
event->preventDefault();
}
}
}
}
示例11: handleEvent
void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext, Event* event)
{
ASSERT(scriptExecutionContext);
if (!scriptExecutionContext || scriptExecutionContext->isJSExecutionForbidden())
return;
JSLockHolder lock(scriptExecutionContext->vm());
JSObject* jsFunction = this->jsFunction(scriptExecutionContext);
if (!jsFunction)
return;
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext, *m_isolatedWorld);
if (!globalObject)
return;
if (scriptExecutionContext->isDocument()) {
JSDOMWindow* window = jsCast<JSDOMWindow*>(globalObject);
if (!window->impl().isCurrentlyDisplayedInFrame())
return;
// FIXME: Is this check needed for other contexts?
ScriptController& script = window->impl().frame()->script();
if (!script.canExecuteScripts(AboutToExecuteScript) || script.isPaused())
return;
}
ExecState* exec = globalObject->globalExec();
JSValue handleEventFunction = jsFunction;
CallData callData;
CallType callType = getCallData(handleEventFunction, callData);
// If jsFunction is not actually a function, see if it implements the EventListener interface and use that
if (callType == CallTypeNone) {
handleEventFunction = jsFunction->get(exec, Identifier::fromString(exec, "handleEvent"));
callType = getCallData(handleEventFunction, callData);
}
if (callType != CallTypeNone) {
Ref<JSEventListener> protect(*this);
MarkedArgumentBuffer args;
args.append(toJS(exec, globalObject, event));
Event* savedEvent = globalObject->currentEvent();
globalObject->setCurrentEvent(event);
VM& vm = globalObject->vm();
VMEntryScope entryScope(vm, vm.entryScope ? vm.entryScope->globalObject() : globalObject);
InspectorInstrumentationCookie cookie = JSMainThreadExecState::instrumentFunctionCall(scriptExecutionContext, callType, callData);
JSValue thisValue = handleEventFunction == jsFunction ? toJS(exec, globalObject, event->currentTarget()) : jsFunction;
NakedPtr<Exception> exception;
JSValue retval = scriptExecutionContext->isDocument()
? JSMainThreadExecState::call(exec, handleEventFunction, callType, callData, thisValue, args, exception)
: JSC::call(exec, handleEventFunction, callType, callData, thisValue, args, exception);
InspectorInstrumentation::didCallFunction(cookie, scriptExecutionContext);
globalObject->setCurrentEvent(savedEvent);
if (is<WorkerGlobalScope>(*scriptExecutionContext)) {
bool terminatorCausedException = (exec->hadException() && isTerminatedExecutionException(exec->exception()));
if (terminatorCausedException || (vm.watchdog && vm.watchdog->didFire()))
downcast<WorkerGlobalScope>(*scriptExecutionContext).script()->forbidExecution();
}
if (exception) {
event->target()->uncaughtExceptionInEventHandler();
reportException(exec, exception);
} else {
if (!retval.isUndefinedOrNull() && is<BeforeUnloadEvent>(*event))
downcast<BeforeUnloadEvent>(*event).setReturnValue(retval.toString(exec)->value(exec));
if (m_isAttribute) {
if (retval.isFalse())
event->preventDefault();
}
}
}
}
示例12: initializeJSFunction
JSObject* JSLazyEventListener::initializeJSFunction(ScriptExecutionContext* executionContext) const
{
ASSERT(executionContext);
ASSERT(executionContext->isDocument());
if (!executionContext)
return 0;
Frame* frame = static_cast<Document*>(executionContext)->frame();
if (!frame)
return 0;
ScriptController* scriptController = frame->script();
if (!scriptController->canExecuteScripts(AboutToExecuteScript))
return 0;
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(executionContext, isolatedWorld());
if (!globalObject)
return 0;
if (executionContext->isDocument()) {
JSDOMWindow* window = static_cast<JSDOMWindow*>(globalObject);
Frame* frame = window->impl()->frame();
if (!frame)
return 0;
// FIXME: Is this check needed for non-Document contexts?
ScriptController* script = frame->script();
if (!script->canExecuteScripts(AboutToExecuteScript) || script->isPaused())
return 0;
}
ExecState* exec = globalObject->globalExec();
MarkedArgumentBuffer args;
args.append(jsNontrivialString(exec, stringToUString(m_eventParameterName)));
args.append(jsString(exec, m_code));
JSObject* jsFunction = constructFunction(exec, args, Identifier(exec, stringToUString(m_functionName)), stringToUString(m_sourceURL), m_lineNumber); // FIXME: is globalExec ok?
if (exec->hadException()) {
exec->clearException();
return 0;
}
JSFunction* listenerAsFunction = static_cast<JSFunction*>(jsFunction);
if (m_originalNode) {
if (!wrapper()) {
// Ensure that 'node' has a JavaScript wrapper to mark the event listener we're creating.
JSLock lock(SilenceAssertionsOnly);
// FIXME: Should pass the global object associated with the node
setWrapper(asObject(toJS(globalObject->globalExec(), globalObject, m_originalNode)));
}
// Add the event's home element to the scope
// (and the document, and the form - see JSHTMLElement::eventHandlerScope)
ScopeChain scope = listenerAsFunction->scope();
static_cast<JSNode*>(wrapper())->pushEventHandlerScope(exec, scope);
listenerAsFunction->setScope(scope);
}
// Since we only parse once, there's no need to keep data used for parsing around anymore.
m_functionName = String();
m_code = String();
m_eventParameterName = String();
m_sourceURL = String();
return jsFunction;
}
示例13: windowProtoFuncOpen
JSValuePtr windowProtoFuncOpen(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
JSDOMWindow* window = toJSDOMWindow(thisValue);
if (!window)
return throwError(exec, TypeError);
if (!window->allowsAccessFrom(exec))
return jsUndefined();
Frame* frame = window->impl()->frame();
if (!frame)
return jsUndefined();
Frame* activeFrame = asJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
if (!activeFrame)
return jsUndefined();
Page* page = frame->page();
String urlString = valueToStringWithUndefinedOrNullCheck(exec, args.at(exec, 0));
AtomicString frameName = args.at(exec, 1)->isUndefinedOrNull() ? "_blank" : AtomicString(args.at(exec, 1)->toString(exec));
// Because FrameTree::find() returns true for empty strings, we must check for empty framenames.
// Otherwise, illegitimate window.open() calls with no name will pass right through the popup blocker.
if (!allowPopUp(exec) && (frameName.isEmpty() || !frame->tree()->find(frameName)))
return jsUndefined();
// Get the target frame for the special cases of _top and _parent. In those
// cases, we can schedule a location change right now and return early.
bool topOrParent = false;
if (frameName == "_top") {
frame = frame->tree()->top();
topOrParent = true;
} else if (frameName == "_parent") {
if (Frame* parent = frame->tree()->parent())
frame = parent;
topOrParent = true;
}
if (topOrParent) {
if (!activeFrame->loader()->shouldAllowNavigation(frame))
return jsUndefined();
String completedURL;
if (!urlString.isEmpty())
completedURL = activeFrame->document()->completeURL(urlString).string();
const JSDOMWindow* targetedWindow = toJSDOMWindow(frame);
if (!completedURL.isEmpty() && (!protocolIs(completedURL, "javascript") || (targetedWindow && targetedWindow->allowsAccessFrom(exec)))) {
bool userGesture = activeFrame->script()->processingUserGesture();
frame->loader()->scheduleLocationChange(completedURL, activeFrame->loader()->outgoingReferrer(), false, userGesture);
}
return toJS(exec, frame->domWindow());
}
// In the case of a named frame or a new window, we'll use the createWindow() helper
WindowFeatures windowFeatures(valueToStringWithUndefinedOrNullCheck(exec, args.at(exec, 2)));
FloatRect windowRect(windowFeatures.xSet ? windowFeatures.x : 0, windowFeatures.ySet ? windowFeatures.y : 0,
windowFeatures.widthSet ? windowFeatures.width : 0, windowFeatures.heightSet ? windowFeatures.height : 0);
DOMWindow::adjustWindowRect(screenAvailableRect(page ? page->mainFrame()->view() : 0), windowRect, windowRect);
windowFeatures.x = windowRect.x();
windowFeatures.y = windowRect.y();
windowFeatures.height = windowRect.height();
windowFeatures.width = windowRect.width();
frame = createWindow(exec, frame, urlString, frameName, windowFeatures, noValue());
if (!frame)
return jsUndefined();
return toJS(exec, frame->domWindow()); // global object
}
示例14: handleEvent
void JSEventListener::handleEvent(Event* event, bool isWindowEvent)
{
JSLock lock(SilenceAssertionsOnly);
JSObject* jsFunction = this->jsFunction();
if (!jsFunction)
return;
JSDOMGlobalObject* globalObject = m_globalObject;
// Null check as clearGlobalObject() can clear this and we still get called back by
// xmlhttprequest objects. See http://bugs.webkit.org/show_bug.cgi?id=13275
// FIXME: Is this check still necessary? Requests are supposed to be stopped before clearGlobalObject() is called.
ASSERT(globalObject);
if (!globalObject)
return;
ScriptExecutionContext* scriptExecutionContext = globalObject->scriptExecutionContext();
if (!scriptExecutionContext)
return;
if (scriptExecutionContext->isDocument()) {
JSDOMWindow* window = static_cast<JSDOMWindow*>(globalObject);
Frame* frame = window->impl()->frame();
if (!frame)
return;
// The window must still be active in its frame. See <https://bugs.webkit.org/show_bug.cgi?id=21921>.
// FIXME: A better fix for this may be to change DOMWindow::frame() to not return a frame the detached window used to be in.
if (frame->domWindow() != window->impl())
return;
// FIXME: Is this check needed for other contexts?
ScriptController* script = frame->script();
if (!script->isEnabled() || script->isPaused())
return;
}
ExecState* exec = globalObject->globalExec();
JSValue handleEventFunction = jsFunction->get(exec, Identifier(exec, "handleEvent"));
CallData callData;
CallType callType = handleEventFunction.getCallData(callData);
if (callType == CallTypeNone) {
handleEventFunction = JSValue();
callType = jsFunction->getCallData(callData);
}
if (callType != CallTypeNone) {
ref();
MarkedArgumentBuffer args;
args.append(toJS(exec, globalObject, event));
Event* savedEvent = globalObject->currentEvent();
globalObject->setCurrentEvent(event);
// If this event handler is the first JavaScript to execute, then the
// dynamic global object should be set to the global object of the
// window in which the event occurred.
JSGlobalData* globalData = globalObject->globalData();
DynamicGlobalObjectScope globalObjectScope(exec, globalData->dynamicGlobalObject ? globalData->dynamicGlobalObject : globalObject);
JSValue retval;
if (handleEventFunction) {
globalObject->globalData()->timeoutChecker.start();
retval = call(exec, handleEventFunction, callType, callData, jsFunction, args);
} else {
JSValue thisValue;
if (isWindowEvent)
thisValue = globalObject->toThisObject(exec);
else
thisValue = toJS(exec, globalObject, event->currentTarget());
globalObject->globalData()->timeoutChecker.start();
retval = call(exec, jsFunction, callType, callData, thisValue, args);
}
globalObject->globalData()->timeoutChecker.stop();
globalObject->setCurrentEvent(savedEvent);
if (exec->hadException())
reportCurrentException(exec);
else {
if (!retval.isUndefinedOrNull() && event->storesResultAsString())
event->storeResult(retval.toString(exec));
if (m_isAttribute) {
bool retvalbool;
if (retval.getBoolean(retvalbool) && !retvalbool)
event->preventDefault();
}
}
if (scriptExecutionContext->isDocument())
Document::updateStyleForAllDocuments();
deref();
}
}
示例15: handleEvent
void JSAbstractEventListener::handleEvent(Event* event, bool isWindowEvent)
{
JSObject* listener = listenerObj();
if (!listener)
return;
JSDOMWindow* window = this->window();
// Null check as clearWindow() can clear this and we still get called back by
// xmlhttprequest objects. See http://bugs.webkit.org/show_bug.cgi?id=13275
if (!window)
return;
Frame* frame = window->impl()->frame();
if (!frame)
return;
ScriptController* script = frame->script();
if (!script->isEnabled() || script->isPaused())
return;
JSLock lock(false);
ExecState* exec = window->globalExec();
JSValue* handleEventFunction = listener->get(exec, Identifier(exec, "handleEvent"));
CallData callData;
CallType callType = handleEventFunction->getCallData(callData);
if (callType == CallTypeNone) {
handleEventFunction = 0;
callType = listener->getCallData(callData);
}
if (callType != CallTypeNone) {
ref();
ArgList args;
args.append(toJS(exec, event));
Event* savedEvent = window->currentEvent();
window->setCurrentEvent(event);
JSValue* retval;
if (handleEventFunction) {
window->startTimeoutCheck();
retval = call(exec, handleEventFunction, callType, callData, listener, args);
} else {
JSValue* thisValue;
if (isWindowEvent)
thisValue = window->shell();
else
thisValue = toJS(exec, event->currentTarget());
window->startTimeoutCheck();
retval = call(exec, listener, callType, callData, thisValue, args);
}
window->stopTimeoutCheck();
window->setCurrentEvent(savedEvent);
if (exec->hadException())
frame->domWindow()->console()->reportCurrentException(exec);
else {
if (!retval->isUndefinedOrNull() && event->storesResultAsString())
event->storeResult(retval->toString(exec));
if (m_isHTML) {
bool retvalbool;
if (retval->getBoolean(retvalbool) && !retvalbool)
event->preventDefault();
}
}
Document::updateDocumentsRendering();
deref();
}
}