After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 612590 - Allow seed initialization using an existing JSContext
Allow seed initialization using an existing JSContext
Status: RESOLVED FIXED
Product: seed
Classification: Bindings
Component: libseed
git master
Other Linux
: Normal enhancement
: ---
Assigned To: seed-maint
Depends on:
Blocks:
 
 
Reported: 2010-03-11 16:16 UTC by Alexandre Mazari
Modified: 2010-03-17 04:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Seed patch (3.47 KB, patch)
2010-03-11 16:16 UTC, Alexandre Mazari
none Details | Review
A sample of using Seed with a Webview JSContext (6.08 KB, application/x-gzip)
2010-03-11 16:55 UTC, Alexandre Mazari
  Details
Add gtkdocs for new initializers (2.12 KB, patch)
2010-03-14 21:25 UTC, Alexandre Mazari
none Details | Review

Description Alexandre Mazari 2010-03-11 16:16:17 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).
Comment 1 Alexandre Mazari 2010-03-11 16:55:02 UTC
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.
Comment 2 Marc-Andre Lureau 2010-03-11 17:44:51 UTC
nice :)
Comment 3 Gustavo Noronha (kov) 2010-03-11 17:48:24 UTC
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.
Comment 4 Gustavo Noronha (kov) 2010-03-11 17:53:00 UTC
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.
Comment 5 Alexandre Mazari 2010-03-11 18:01:39 UTC
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.
Comment 6 Alexandre Mazari 2010-03-11 18:08:14 UTC
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 ?
Comment 7 Gustavo Noronha (kov) 2010-03-11 20:32:44 UTC
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
Comment 8 Diego Escalante Urrelo (not reading bugmail) 2010-03-11 22:22:34 UTC
Awesome, I'd like to check this later. Self reminder!
Comment 9 Alan Knowles 2010-03-12 04:21:26 UTC
Committed - I can't close bugs - so can you close it for me..

Regards
Alan
Comment 10 Javier Jardón (IRC: jjardon) 2010-03-12 05:01:15 UTC
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.
Comment 11 Alexandre Mazari 2010-03-14 21:25:42 UTC
Created attachment 156143 [details] [review]
Add gtkdocs for new initializers
Comment 12 Alan Knowles 2010-03-17 04:14:34 UTC
Added 
Thanks
Alan