[webkit-gtk] JavaScriptCore with wekbitgtkv1?

Adrian Perez de Castro aperez at igalia.com
Fri Apr 27 07:09:50 PDT 2018


On Fri, 27 Apr 2018 09:51:39 -0400, Anthony Walter <sysrpl at gmail.com> wrote:
> I know webkitgtk version 1 is old and deprecated, but for the purposes of
> supporting gtk2, I want to know if there exists a hook or connection
> between a webview widget and libjavascriptcoregtk-1.0-0?
> 
> For example, in webkit2gtk there exists the function:
> 
> webkit_frame_get_javascript_global_context
> 
> Which I assume allows you to access the javascript engine for a page and do
> things like define classes and functions in native code that a web page
> inside a webview could access and invoke.

Yes, that is exactly what you need. WebKitGTK+ historically did not provide
an API for JavaScriptCore, but it exports the same C API that is available
in other WebKit ports—so for example you should be able to reuse documentation
and most code from examples you can find for MacOS.

For a good starting point, you could use this tutorial:

  https://karhm.com/JavaScriptCore_C_API/

Unfortunately Apple has retired the documentation for the JavaScriptCore C
API from developer.appple.com (they only have the Swift and Objective-C APIs)
there now. You can still read the JavaScriptCore C API headers installed
alongside the WebKitGTK+ ones; once you get a grasp of the basics they are
reasonably easy to follow.

I hope this helps.

Best regards,


--
 Adrián 🎩
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20180427/f239d9ae/attachment.bin>


More information about the webkit-gtk mailing list