GNOME Bugzilla – Bug 612590
Allow seed initialization using an existing JSContext
Last modified: 2010-03-17 04:14:34 UTC
Created attachment 155871 [details] [review] Seed patch The provided patch allows seed to be initialized using an existing JSContext. The typical use case is making seed bindings available in the context of a webkit's Webview, allowing DOM events binding to native code. This can be achieved at webkit-gtk Webview's "window-object-cleared" signal reception as shown in the test-case provided. The final goal is to be able to define the entire UI in HTML5/CSS/JS accessing the underlying native GObject services (Notification, DBus, GIO, whatever).
Created attachment 155873 [details] A sample of using Seed with a Webview JSContext A sample of using Seed with a Webview JSContext using the previous patch. A dom event is bound to the native Notofication deamon lib.
nice :)
That's awesome. I talked a bit about this with Seed developers months ago, and they wanted something else, though, setting the JS Context, I believe. I would really like something like you propose, though. It may not be fully usable for a normal browser, but allows all kinds of nice tricks for other kinds of apps.
Oh, by the way, in WebKit there is now the concept of "Isolated Worlds" for JavaScript. We do not currently implement it in WebKitGTK+, AFAIK, but it could be used to make this integration workable even in browsers. Worth investigating.
Thanks for the comments. I'll definetly have a look at sandboxing stuff in webcore and gtk webkit when available. When you speak about browser, do you have in mind a html-based extension system for epi ala Mozilla Jetpack ? Sadlym I already ran into segfault when trying to create gtk widgets from withing the js... something wrong is going here :/ Some thread related stuff I presume. So the mix-n-match of gtk app + webview/seed based stuff needs a lot of love.
Also, the current solution do not handle rightly the lifecycle (particulary destroying) of the SeedEngine. Should it be a share application-wide instance, webview-scoped or a request (pageview) one ?
When I speak about browser, I am talking about Epiphany, and Midori, who would use it for whatever purpose (for, say, replacing their usage of JavaScriptCore). Your segfault may be related to this: https://bugs.webkit.org/show_bug.cgi?id=30876
Awesome, I'd like to check this later. Self reminder!
Committed - I can't close bugs - so can you close it for me.. Regards Alan
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Created attachment 156143 [details] [review] Add gtkdocs for new initializers
Added Thanks Alan