Bug 66097 - REGRESSION: Qt JavaScript bridge signal connection fails
Summary: REGRESSION: Qt JavaScript bridge signal connection fails
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-11 14:16 PDT by Andrew Wason
Modified: 2011-08-12 08:53 PDT (History)
3 users (show)

See Also:


Attachments
pass toThisObject() to JS signal handler (5.01 KB, patch)
2011-08-11 18:36 PDT, Andrew Wason
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Wason 2011-08-11 14:16:39 PDT
Connecting to a Qt signal from JavaScript now fails.

This can be reproduced with an existing testcase:


$ WebKitBuild/Debug/WebKit/qt/tests/qwebframe/tst_qwebframe connectAndDisconnect
********* Start testing of tst_QWebFrame *********
Config: Using QTest library 4.7.3, Qt 4.7.3
PASS   : tst_QWebFrame::initTestCase()
ASSERTION FAILED: isValidThisObject(thisValue, exec)
../../../Source/JavaScriptCore/runtime/CallData.cpp(38) : JSC::JSValue JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, const JSC::CallData&, JSC::JSValue, const JSC::ArgList&)
QFATAL : tst_QWebFrame::connectAndDisconnect() Received signal 11
FAIL!  : tst_QWebFrame::connectAndDisconnect() Received a fatal error.
   Loc: [Unknown file(0)]
Totals: 1 passed, 1 failed, 0 skipped
********* Finished testing of tst_QWebFrame *********
Aborted
Comment 1 Andrew Wason 2011-08-11 16:35:27 PDT
Looks like the problem was introduced with r91095 from bug 64250
Comment 2 Andrew Wason 2011-08-11 17:32:30 PDT
A workaround is to pass an anonymous object as the first arg to connect, e.g.:

context.someSignal.connect({}, function() { });

Because otherwise JSC::Bindings::QtRuntimeConnectionMethod::call() uses the window object (exec->lexicalGlobalObject()) and that seems to trigger the assert.
See http://trac.webkit.org/browser/trunk/Source/WebCore/bridge/qt/qt_runtime.cpp#L1587
Comment 3 Andrew Wason 2011-08-11 18:36:36 PDT
Created attachment 103719 [details]
pass toThisObject() to JS signal handler

This also re-enables tst_QWebFrame::connectAndDisconnect() tests that were disabled with bug 65170
Comment 4 Gavin Barraclough 2011-08-11 19:29:33 PDT
Comment on attachment 103719 [details]
pass toThisObject() to JS signal handler

Ooops, apologies for the breakage! - thanks for the fix.
Comment 5 WebKit Review Bot 2011-08-11 20:14:45 PDT
Comment on attachment 103719 [details]
pass toThisObject() to JS signal handler

Clearing flags on attachment: 103719

Committed r92907: <http://trac.webkit.org/changeset/92907>
Comment 6 WebKit Review Bot 2011-08-11 20:14:49 PDT
All reviewed patches have been landed.  Closing bug.