[webkit-gtk] GObject API for JavaScriptCore

tevaum at gmail.com tevaum at gmail.com
Sun Oct 9 18:19:48 PDT 2016

Hello, everyone.

Some background first: my name is Estêvão and every now and the I try to
contribute to Gnome Web, AKA Epiphany. First time was back in 2010. After
the migration of Epiphany to WebKit, it stopped identifying feed links on
pages. I had to dig into JavaScriptCore to call JavaScript functions to
check for feed links on pages. DOM bindings were only in TODO by then. Now
what I need to do is a little bit different, but also involves
JavaScriptCore. We need to bridge between JavaScript and C code so that an
about page can be able to list URLs to display. I was chocked that up to
now JavaScriptCore is untouched. So I started thinking about how could a
GObject binding to JSC be implemented.

The proposal:

I'm thinking about creating GObjects to warap JSC objects. For instance:
GJSCContext wrapping JSContextRef, GJSCObject wrapping JSObjectRef and so
on. I implemented a POC of the API and a simple client to make my
intentions clearer. It's available on https://github.com/tevaum/jsc-bindings

With that *not-so-gobject* partial API the client is able to bridge
javascript functions to native C callbacks and to execute javascript code
from C. Also the C function returns an array to the javascript code. An
example of error handling is also shown.

I think that we have to start simple and add stuff incrementally, based on
what's already being used/requested by people. Please take your time to dig
into the example code provided, ask questions and poit directions, so that
we can buld a better WebKitGTK+.


Estêvão Samuel Procópio Amaral
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-gtk/attachments/20161010/c68b92ba/attachment.html>

More information about the webkit-gtk mailing list