[wpe-webkit] Web Extension Support In WPE
Munez Bn
munezbn.dev at gmail.com
Tue Jun 18 09:28:03 PDT 2019
On Tue, Jun 18, 2019 at 7:03 PM Adrian Perez de Castro <aperez at igalia.com>
wrote:
> 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.
>
>
Thanks for confirming.
> 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?
>
There is no WebProcess crash, the call is blocked in function JSObjectRef
JSContextGetGlobalObject(JSContextRef ctx) at line "JSLockHolder
locker(vm);"
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.
>
>
Like I mentioned above, it has crossed ASSERT and struck at locker(vm) call.
> 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?
>
>
It is my callback code of extension
g_signal_connect (webkit_script_world_get_default (),
"window-object-cleared", G_CALLBACK (window_object_cleared_callback),
usrData);
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.
I realized this recently and started moving my code to use JSC GLIB API,
but I was not sure how to return native objects using JSC Gib API. Please
refer to my post in
https://stackoverflow.com/questions/56516809/returning-native-objects-using-javascriptcore-glib-api
Can you please help me answering above question? Basically i want something
like this, Create a File object ( GFile *) which has properties path and
size. Return this object to javascript code such that I can access its
properties path and size.
I was able to do this in JS object C API, But not sure how to do it in JSC
Glib API..
> 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.
>
> Agree. I will update my code and give a try.
As a reminder: please use only public symbols from the installed API headers
> in software that uses WebKit.
>
> Agree.
>
> Best regards,
> —Adrián
>
> ---
> [1] https://webkitgtk.org/reference/jsc-glib/stable/index.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-wpe/attachments/20190618/525d48f6/attachment.html>
More information about the webkit-wpe
mailing list