Bug 46566 - [Qt] Add QWebFrame::addToJavaScriptWindowProperty()
Summary: [Qt] Add QWebFrame::addToJavaScriptWindowProperty()
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks: 41801
  Show dependency treegraph
 
Reported: 2010-09-25 05:43 PDT by Robert Hogan
Modified: 2014-02-03 03:16 PST (History)
4 users (show)

See Also:


Attachments
Patch (4.94 KB, patch)
2010-09-25 05:47 PDT, Robert Hogan
no flags Details | Formatted Diff | Diff
Patch (5.99 KB, patch)
2010-09-29 11:04 PDT, Robert Hogan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Hogan 2010-09-25 05:43:29 PDT
Add or override properties in the DOM Window object.

This is necessary for clients that want to control the values returned by window.innerHeight, window.name and so on.
Clients will want to do this to defeat some of the attacks outlined in https://bugs.webkit.org/show_bug.cgi?id=41801.
Comment 1 Robert Hogan 2010-09-25 05:47:51 PDT
Created attachment 68823 [details]
Patch
Comment 2 Robert Hogan 2010-09-26 07:37:27 PDT
It would be even nicer if we could 'put' a function or method rather than a value in the window property. However I can't see how this would be possible. So if anyone has suggestions please weigh in!
Comment 3 Simon Hausmann 2010-09-29 00:09:49 PDT
Hmm, why not simply overload addToJavascriptWindowObject? :) The Object suffix in them method name refers to the window object, not to adding an object to the window.
Comment 4 Simon Hausmann 2010-09-29 00:11:57 PDT
In the medium term a move to V8 would make all this obsolete though, because then we can have QScriptEngine* QWebFrame::scriptEngine() and you can do everything you could ever imagine (with JavaScript :)
Comment 5 Robert Hogan 2010-09-29 11:04:38 PDT
Created attachment 69222 [details]
Patch
Comment 6 Robert Hogan 2010-09-29 11:18:23 PDT
(In reply to comment #4)
> In the medium term a move to V8 would make all this obsolete though, because then we can have QScriptEngine* QWebFrame::scriptEngine() and you can do everything you could ever imagine (with JavaScript :)

I've updated it per your previous comment anyway - so ball in your court!

QWebFrame::scriptEngine() sounds great though - can't wait!

Am I missing a trick or is there a way of overriding the DOM Window's object properties with the properties of a QObject? I can't see it - hence the current patch to just set the values.
Comment 7 Robert Hogan 2010-12-12 10:47:30 PST
Any thoughts on this? Will it be accepted?
Comment 8 Benjamin Poulain 2011-01-30 09:17:43 PST
I am with Simon on this, I think we should not add more stuff to QWebFrame that are really related to the Script Engine. I think it is better to focus on exposing QtScript.
Comment 9 Jocelyn Turcotte 2014-02-03 03:16:46 PST
=== Bulk closing of Qt bugs ===

If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary.

If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.