[wpe-webkit] Web Extension Support In WPE

Adrian Perez de Castro aperez at igalia.com
Tue Jun 18 06:32:55 PDT 2019

Hello Munez,

First of all: yes, the WebKitWebExtension API is supported in WPE WebKit,
and I have successfully used it myself in a couple of projects — it works.

On Sat, 08 Jun 2019 20:43:17 +0530, Munez Bn <munezbn.dev at gmail.com> wrote:
> I had written a test webextension for WebKitGTK long back (WebKitGTK
> 2.16.6). I wanted o test it with WPE 2.24.x (RPI3) and the page was not
> launching. After debugging I found that JSContextGetGlobalObject() is
> getting struck and never returns. Same extension when i Tried on WebKitGTK
> 2.24.x on Fedora, I don't see this issue.
> static void
> window_object_cleared_callback (WebKitScriptWorld *world,
>                                 WebKitWebPage     *web_page,
>                                 WebKitFrame       *frame,
>                                 gpointer           user_data)
> {
>     JSGlobalContextRef globalContext;
>     JSObjectRef        globalObject;
>     GRefPtr<JSCContext> jsContext =
> doptGRef(webkit_frame_get_js_context_for_script_world(frame, world));
>     globalContext = jscContextGetJSContext(jsContext.get());
>     globalObject = JSContextGetGlobalObject (globalContext);  ---> Blocked
> and doesn't return
> ..........

Is the function really blocked, or did the “WPEWebProcess” program crash?
I did a very quick check of the “JSContextGetGlobalObject” function and
unless I missed something, the only way it can fail is if your build has
assertions enabled and the the passed “JSContextRef” is null — there
is “ASSERT_NOT_REACHED()” in that case.

This “window_object_cleared_callback” function is not in the upstream WebKit
sources... Is this is code from your own WebExtension, or have you patched
WPE WebKit in any way?

In case the above is the code of your WebExtension, please update it to use
the JSC GLib API [1] because the plain C JavaScriptCore API that this piece of
code has never been public in WPE WebKit, and there is no stability guarantee
for it. Also, this is using the “GRefPtr”, which is internal to WebKit and
the header that defines that is not even installed as part of the public API.

As a reminder: please use only public symbols from the installed API headers
in software that uses WebKit.

Best regards,

[1] https://webkitgtk.org/reference/jsc-glib/stable/index.html
-------------- 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-wpe/attachments/20190618/79e8731d/attachment.bin>

More information about the webkit-wpe mailing list