Commit 8f8acc93 authored by kent.hansen@nokia.com's avatar kent.hansen@nokia.com

2010-09-07 Kent Hansen <kent.hansen@nokia.com>

        Reviewed by Andreas Kling.

        [Qt] tst_QWebFrame::connectAndDisconnect() fails on WebKit trunk because __qt_sender__ is never set
        https://bugs.webkit.org/show_bug.cgi?id=44697

        When the signal handler is a JS function, __qt_sender__ is stuffed into a temporary
        object that's pushed onto the function's scope before the function is invoked, and
        popped again afterwards.

        We were pushing this new scope object _after_ calling JSFunction::getCallData(),
        and relying on JSC::call() to use the fresh scope chain from the function object.
        However, this is no longer the case; JSC::call() uses the scope chain passed in
        the CallData argument. Hence, we need to set up the scope before the function's
        CallData is queried.

        * bridge/qt/qt_runtime.cpp:
        (JSC::Bindings::QtConnectionObject::execute):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66875 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b85186f8
2010-09-07 Kent Hansen <kent.hansen@nokia.com>
Reviewed by Andreas Kling.
[Qt] tst_QWebFrame::connectAndDisconnect() fails on WebKit trunk because __qt_sender__ is never set
https://bugs.webkit.org/show_bug.cgi?id=44697
When the signal handler is a JS function, __qt_sender__ is stuffed into a temporary
object that's pushed onto the function's scope before the function is invoked, and
popped again afterwards.
We were pushing this new scope object _after_ calling JSFunction::getCallData(),
and relying on JSC::call() to use the fresh scope chain from the function object.
However, this is no longer the case; JSC::call() uses the scope chain passed in
the CallData argument. Hence, we need to set up the scope before the function's
CallData is queried.
* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::QtConnectionObject::execute):
2010-09-07 Kwang Yul Seo <skyul@company100.net>
Reviewed by Kent Tamura.
......@@ -1793,26 +1793,28 @@ void QtConnectionObject::execute(void **argv)
l.append(jsUndefined());
}
}
CallData callData;
CallType callType = m_funcObject->getCallData(callData);
// Stuff in the __qt_sender property, if we can
ScopeChain oldsc = ScopeChain(NoScopeChain());
JSFunction* fimp = 0;
if (m_funcObject->inherits(&JSFunction::info)) {
JSFunction* fimp = static_cast<JSFunction*>(m_funcObject.get());
fimp = static_cast<JSFunction*>(m_funcObject.get());
JSObject* qt_sender = QtInstance::getQtInstance(sender(), ro, QScriptEngine::QtOwnership)->createRuntimeObject(exec);
JSObject* wrapper = new (exec) JSObject(JSObject::createStructure(jsNull()));
PutPropertySlot slot;
wrapper->put(exec, Identifier(exec, "__qt_sender__"), qt_sender, slot);
ScopeChain oldsc = fimp->scope();
oldsc = fimp->scope();
ScopeChain sc = oldsc;
sc.push(wrapper);
fimp->setScope(sc);
}
CallData callData;
CallType callType = m_funcObject->getCallData(callData);
call(exec, m_funcObject, callType, callData, m_thisObject, l);
call(exec, fimp, callType, callData, m_thisObject, l);
if (fimp)
fimp->setScope(oldsc);
} else {
call(exec, m_funcObject, callType, callData, m_thisObject, l);
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment