Bug 26906 - [Qt] Prevent Javascript object from being initialized when JavascriptEnabled is false
Summary: [Qt] Prevent Javascript object from being initialized when JavascriptEnabled ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-01 14:41 PDT by Robert Hogan
Modified: 2009-07-01 19:11 PDT (History)
0 users

See Also:


Attachments
Patch (2.10 KB, patch)
2009-07-01 15:02 PDT, Robert Hogan
no flags Details | Formatted Diff | Diff
Updated to be page-specific (2.71 KB, patch)
2009-07-01 15:18 PDT, Robert Hogan
manyoso: review-
Details | Formatted Diff | Diff
updated patch (2.77 KB, patch)
2009-07-01 15:33 PDT, Robert Hogan
manyoso: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Hogan 2009-07-01 14:41:42 PDT
If clients call addToJavaScriptWindowObject even though JavascriptEnabled is false webkit will segfault on the assert:
          ASSERTION FAILED: _rootObject
          (../../../WebCore/bridge/runtime.cpp:52
          JSC::Bindings::Instance::Instance(WTF::PassRefPtr<JSC::Bindings::RootObject>))

Fix is to ensure JavaScript is enabled when client calls addToJavaScriptWindowObject.
Comment 1 Robert Hogan 2009-07-01 15:02:41 PDT
Created attachment 32145 [details]
Patch

This fixes the assert. But I don't see a ready way of adding a unit test for the root cause.
Comment 2 Robert Hogan 2009-07-01 15:18:37 PDT
Created attachment 32147 [details]
Updated to be page-specific

Patch updated to be page specific, also updated inline documentation.

Tested with arora. Launching with jscript both enabled and disabled. Also tested opening different pages between toggling jscript on and off.
Comment 3 Adam Treat 2009-07-01 15:24:56 PDT
Comment on attachment 32147 [details]
Updated to be page-specific

> +    If QWebSettings::JavascriptEnabled is false, this function does nothing.

How about, "If JavaScript is not enabled for this page, then this function does nothing."

> +2009-06-30  Robert Hogan <robert@roberthogan.net>
> +
> +        Reviewed by NOBODY.
> +        
> +        Fix Qt segfault when javascript disabled.

Please put the URL in the ChangeLog.

With those changes r=me.
Comment 4 Robert Hogan 2009-07-01 15:33:24 PDT
Created attachment 32149 [details]
updated patch

updated changelog and inline doc
Comment 5 Eric Seidel (no email) 2009-07-01 19:10:00 PDT
Sending        WebKit/qt/Api/qwebframe.cpp
Sending        WebKit/qt/ChangeLog
Transmitting file data ..
Committed revision 45463.
http://trac.webkit.org/changeset/45463
Comment 6 Eric Seidel (no email) 2009-07-01 19:11:56 PDT
Please do not edit the "NOBODY (OOPS!)".  It causes scripts to fail which go looking for that. :(