Bug 31887 - [Qt] QWebFrame::addToJavaScriptWindowObject() can be used to customize the properties of 'default' JS objects such as 'navigator'.
Summary: [Qt] QWebFrame::addToJavaScriptWindowObject() can be used to customize the pr...
Status: CLOSED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P4 Normal
Assignee: Robert Hogan
URL:
Keywords: Qt
Depends on:
Blocks:
 
Reported: 2009-11-25 13:34 PST by Robert Hogan
Modified: 2014-04-24 16:45 PDT (History)
7 users (show)

See Also:


Attachments
Patch (4.60 KB, patch)
2009-11-25 13:34 PST, Robert Hogan
hausmann: 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-11-25 13:34:16 PST
Created attachment 43867 [details]
Patch

This feature is useful for clients that want to manage and even conceal the information that is revealed by javascript.

Add a testcase to ensure this behaviour is preserved.
Comment 1 Eric Seidel (no email) 2009-11-29 07:49:35 PST
This seems like it could be a bad API to expose long-term.  I worry this could come back to bite Qt-WebKit like the history API did.
Comment 2 Adam Barth 2009-11-30 12:41:07 PST
Attachment 43867 [details] did not pass style-queue:

Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
WebKit/qt/tests/qwebframe/tst_qwebframe.cpp:517:  This { should be at the end of the previous line  [whitespace/braces] [4]
WebKit/qt/tests/qwebframe/tst_qwebframe.cpp:525:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
WebKit/qt/tests/qwebframe/tst_qwebframe.cpp:528:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
WebKit/qt/tests/qwebframe/tst_qwebframe.cpp:531:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
WebKit/qt/tests/qwebframe/tst_qwebframe.cpp:1993:  More than one command on the same line  [whitespace/newline] [4]
Done processing WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
Total errors found: 5
Comment 3 Simon Hausmann 2009-12-29 05:38:11 PST
The window.navigator object is explicitly marked as "[Replaceable]". The behaviour of addToJavaScriptWindowObject() being able to replace replaceable objects is sensible. I think it would be best to make a simple and explicit test for that (doesn't have to use the navigator example).

I would not rely on it being possible though to replace non-deletable properties in the window object.
Comment 4 Simon Hausmann 2009-12-30 06:54:40 PST
Comment on attachment 43867 [details]
Patch

As discussed on IRC, it would be better to change this test to simply verify that addToJAvaScriptWindowOBject can replace an replaceable object. The navigator part is almost overkill :)

+        Need a short description and bug URL (OOPS!)

This line shouldn't be there :)
Comment 5 Kent Hansen 2010-03-11 08:08:15 PST
(In reply to comment #4)
> (From update of attachment 43867 [details])
> As discussed on IRC, it would be better to change this test to simply verify
> that addToJAvaScriptWindowOBject can replace an replaceable object. The
> navigator part is almost overkill :)

Agreed (except for the "almost" part ;) ).
Comment 6 Robert Hogan 2010-09-02 11:29:02 PDT
(In reply to comment #3)
> The window.navigator object is explicitly marked as "[Replaceable]". The behaviour of addToJavaScriptWindowObject() being able to replace replaceable objects is sensible. I think it would be best to make a simple and explicit test for that (doesn't have to use the navigator example).
> 
> I would not rely on it being possible though to replace non-deletable properties in the window object.

Hi Simon,

So how could I go about replacing the properties of read-only objects such as the Screen object?

Where could I start to look for a way of doing this?
Comment 7 Robert Hogan 2010-09-11 04:45:08 PDT
Resolved by https://bugs.webkit.org/show_bug.cgi?id=41802
Comment 8 Darin Adler 2014-04-24 16:45:06 PDT
Moving all JavaScriptGlue bugs to JavaScriptCore. The JavaScriptGlue framework itself is long gone. And most of the more recent bugs put in this component were put there by people who thought this was for some other aspect of “JavaScript glue” and have nothing to do with the actual original reason for the existence of this component, which was an OS-X-only framework named JavaScriptGlue.