Bug 50615

Summary: [Qt] Introduce API to ease binding objects to a QWebFrame
Product: WebKit Reporter: Holger Freyther <zecke>
Component: WebKit QtAssignee: Holger Freyther <zecke>
Status: RESOLVED WONTFIX    
Severity: Normal CC: ademar, benjamin, cmarcelo, eostroukhov, eric, hausmann, menard, noam, pierre.rossi, robert, webkit.review.bot
Priority: P2 Keywords: Qt, QtTriaged
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Propose the QWebObjectBinder API
none
Patch noam: review-

Holger Freyther
Reported 2010-12-06 20:46:48 PST
Adding and re-adding a QObject to a QWebFrame is more difficult than it should be. Maybe an API to take over this can help...
Attachments
Propose the QWebObjectBinder API (7.59 KB, patch)
2010-12-06 20:54 PST, Holger Freyther
no flags
Patch (7.77 KB, patch)
2011-04-30 06:15 PDT, Holger Freyther
noam: review-
Holger Freyther
Comment 1 2010-12-06 20:54:30 PST
Created attachment 75782 [details] Propose the QWebObjectBinder API This is a proposal for an API that might be useful for hybrid applications...
WebKit Review Bot
Comment 2 2010-12-07 09:10:38 PST
Attachment 75782 [details] did not pass style-queue: Failed to run "[u'git', u'reset', u'--hard', u'refs/remotes/trunk']" exit_code: 128 error: Could not write new index file. fatal: Could not reset index file to revision 'refs/remotes/trunk'. If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Review Bot
Comment 3 2010-12-07 10:11:22 PST
Attachment 75782 [details] did not pass style-queue: Failed to run "[u'git', u'reset', u'--hard', u'refs/remotes/trunk']" exit_code: 128 error: Could not write new index file. fatal: Could not reset index file to revision 'refs/remotes/trunk'. If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Review Bot
Comment 4 2010-12-07 11:12:31 PST
Attachment 75782 [details] did not pass style-queue: Failed to run "[u'git', u'reset', u'--hard', u'refs/remotes/trunk']" exit_code: 128 error: Could not write new index file. fatal: Could not reset index file to revision 'refs/remotes/trunk'. If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Review Bot
Comment 5 2010-12-07 12:13:54 PST
Attachment 75782 [details] did not pass style-queue: Failed to run "[u'git', u'reset', u'--hard', u'refs/remotes/trunk']" exit_code: 128 error: Could not write new index file. fatal: Could not reset index file to revision 'refs/remotes/trunk'. If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Review Bot
Comment 6 2010-12-07 21:39:49 PST
Attachment 75782 [details] did not pass style-queue: Failed to run "['WebKitTools/Scripts/update-webkit']" exit_code: 2 Updating OpenSource Incomplete data: Delta source ended unexpectedly at /usr/lib/git-core/git-svn line 5061 Died at WebKitTools/Scripts/update-webkit line 132. If any of these errors are false positives, please file a bug against check-webkit-style.
Simon Hausmann
Comment 7 2011-01-17 00:10:10 PST
Hmm, wouldn't it be simpler to add a boolean property to QWebFrame that adds support for this feature right in QWebFrame itself? :)
Benjamin Poulain
Comment 8 2011-01-28 18:47:26 PST
I like the idea, I think adding object in hybrid is too complicated at the moment. I think the binding should depend on the URL. Pierre has a use case where objects are included only for some URL (scheme rekonq://), I do not think that is uncommon.
Noam Rosenthal
Comment 9 2011-01-28 19:10:18 PST
(In reply to comment #7) > Hmm, wouldn't it be simpler to add a boolean property to QWebFrame that adds support for this feature right in QWebFrame itself? :) Yes, that's probably where I'd do it, or add an optional flag argument to addToJavaScriptWindowObject.
Noam Rosenthal
Comment 10 2011-01-28 19:15:14 PST
(In reply to comment #8) > I like the idea, I think adding object in hybrid is too complicated at the moment. > > I think the binding should depend on the URL. Pierre has a use case where objects are included only for some URL (scheme rekonq://), I do not think that is uncommon. That sounds good but very custom. Right now doing something custom like that is relatively easy in my opinion, while doing the mere default (having a persistent bound object) can be made hard. Enabling something like URL-based security can lead to a slippery slope of fine-grained security details we add to this hybrid mechanism. We should keep it simple where the persistence is opt-in (like today) or opt-out (something like Simon's take on Holger's suggestion, with maybe an ability to remove the object).
Benjamin Poulain
Comment 11 2011-01-28 19:28:21 PST
(In reply to comment #10) > That sounds good but very custom. Right now doing something custom like that is relatively easy in my opinion, while doing the mere default (having a persistent bound object) can be made hard. Enabling something like URL-based security can lead to a slippery slope of fine-grained security details we add to this hybrid mechanism. My comment was in the context of Holger's patch were a new class is introduced. If this is done as convenience in QWebFrame, I agree thinks should be simpler.
Holger Freyther
Comment 12 2011-01-29 01:17:27 PST
The idea of the extra class (even when not implemented) was that on destruction the bound object might be removed. This way one can/could easily control the lifetime of such binding. The other reason was to avoid the monster uber-classes we have seen in khtml. Anyway, binding and rebinding should be simpler.
Simon Hausmann
Comment 13 2011-04-26 15:22:51 PDT
Comment on attachment 75782 [details] Propose the QWebObjectBinder API From the comments I believe everyone likes the idea of an overload instead of a separate class
Holger Freyther
Comment 14 2011-04-30 06:15:23 PDT
Created attachment 91804 [details] Patch Add new function to QWebFrame
Alexis Menard (darktears)
Comment 15 2011-05-23 15:57:58 PDT
Comment on attachment 91804 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=91804&action=review > Source/WebKit/qt/Api/qwebframe.cpp:596 > + \since 4.8 Will not be part of 4.8 I believe. Because 2.2 will be in 4.8 and we already branched 2.2, so we don't put features inside. I add ademar in CC so you can "negociate". Though I don't know how you could flag it.
Ademar Reis
Comment 16 2011-05-24 06:11:27 PDT
(In reply to comment #15) > (From update of attachment 91804 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=91804&action=review > > > Source/WebKit/qt/Api/qwebframe.cpp:596 > > + \since 4.8 > > Will not be part of 4.8 I believe. Because 2.2 will be in 4.8 and we already branched 2.2, so we don't put features inside. I add ademar in CC so you can "negociate". Though I don't know how you could flag it. Alexis is right: we should leave this for 2.3 (unless it's supper critical, my impression is that it's not). On a side note, we have to rethink these \since macros, as they don't make sense anymore (I remember a discussion on the mailing list a while ago, but we didn't conclude anything).
Robert Hogan
Comment 17 2011-08-05 16:33:59 PDT
Comment on attachment 91804 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=91804&action=review > Source/WebKit/qt/Api/qwebframe.cpp:595 > + The \a object will never be explicitly deleted by QtWebKit. Is that the case with javaScriptWindowObjectCleared() at the moment? I was under the impression that it was not. > Source/WebKit/qt/Api/qwebframe.cpp:615 > javaScriptWindowObjectCleared() signal. Maybe this part of the documentation is redundant now - you should just use the persistent version of the API instead. > Source/WebKit/qt/Api/qwebframe.h:133 > + void addPersistentToJavaScriptWindowObject(const QString &name, QObject *); I think addPersistentObjectToJavaScriptWindowObject() would be easier to understand at first glance. addPersistentToJavaScriptWindowObject() doesn't make a lot of sense first time round.
Simon Hausmann
Comment 18 2011-10-31 06:24:31 PDT
Comment on attachment 91804 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=91804&action=review >> Source/WebKit/qt/Api/qwebframe.h:133 >> + void addPersistentToJavaScriptWindowObject(const QString &name, QObject *); > > I think addPersistentObjectToJavaScriptWindowObject() would be easier to understand at first glance. addPersistentToJavaScriptWindowObject() doesn't make a lot of sense first time round. How about addPersistentlyToJavaScriptWindowObject() ? Alternative is to overload with an enum: addToJavaScriptWindowObject(name, object, RetainBetweenPagesOrSomethingLikeThat)
Eric Seidel (no email)
Comment 19 2012-01-30 15:06:57 PST
9-year-old review request. Qt folks? Please r- or close if this is no longer needed.
Noam Rosenthal
Comment 20 2012-01-30 15:12:41 PST
Comment on attachment 91804 [details] Patch I think people are not convinced that this API is necessary. I think belongs in a higher-level library that uses hybrid, rather than keep a map of objects inside QWebFrame. In addition, I think it's time we froze the WK1 bridge API, it's good at what it does, it's stable, and doesn't need additional improvements at the moment. Holger, if you care deeply about this I'm willing to continue this discussion on IRC :)
Eric Seidel (no email)
Comment 21 2012-01-30 15:14:41 PST
Sounds like we should close this and re-open if Holger feels strongly.
Holger Freyther
Comment 22 2012-01-30 23:33:40 PST
WebKit1 API is the passed, it would have been nice to not require our API users to write this by hand all the time. :)
Note You need to log in before you can comment on or make changes to this bug.