CLOSED FIXED 31887
[Qt] QWebFrame::addToJavaScriptWindowObject() can be used to customize the properties of 'default' JS objects such as 'navigator'.
https://bugs.webkit.org/show_bug.cgi?id=31887
Summary [Qt] QWebFrame::addToJavaScriptWindowObject() can be used to customize the pr...
Robert Hogan
Reported 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.
Attachments
Patch (4.60 KB, patch)
2009-11-25 13:34 PST, Robert Hogan
hausmann: review-
Eric Seidel (no email)
Comment 1 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.
Adam Barth
Comment 2 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
Simon Hausmann
Comment 3 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.
Simon Hausmann
Comment 4 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 :)
Kent Hansen
Comment 5 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 ;) ).
Robert Hogan
Comment 6 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?
Robert Hogan
Comment 7 2010-09-11 04:45:08 PDT
Darin Adler
Comment 8 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.
Note You need to log in before you can comment on or make changes to this bug.