[wpe-webkit] Web Extension Support In WPE

Munez Bn munezbn.dev at gmail.com
Wed Jun 19 12:10:54 PDT 2019


Thanks Michael, Carlos and Adrian.  Your reply was helpful.

 I didn't do any changes in webkit or makefiles to install internal
headers. I included required headers and added the include path in
extensions makefile.  I was trying to migrate old extension using shortcuts
which uses deprecated API/Symbols and ended up messing up code :(. But
after reading your reply I have decided to use modern GObject JSC API as
per the documentation using only public API/symbols.

I have started going through the API and was able to quickly try out
whatever Carlos suggested and it worked when I registered JSC class for my
custom object. But I faced few issues while trying other stuffs.

1.  The API description of * jsc_value_new_function()* says that,  If  we
really want to return a new copy of the boxed type in the callback function
passed as argument to  * jsc_value_new_function()*, then use
#JSC_TYPE_VALUE and return a #JSCValue created with *jsc_value_new_object()*
that receives the copy as instance parameter. But *jsc_value_new_object()*
also needs a context so when I tried to passed  jsc_context as user data to
callback function, the callback function threw following error.

*JSCValue* jsc_value_new_undefined(JSCContext*): assertion
'JSC_IS_CONTEXT(context)' failed*

Please let me know if i am missing anything. I was planing to register
class in callback function
* getTestExtObjec().  *


*<script>*

*var test = getTestExtObject('.')*

*/script> *












*static JSCValue*getTestExtObject(const char* name, JSCContext *context){
  JSCValue* ret =  jsc_value_new_undefined(context);    return ret;}static
voidwindowObjectCleared(WebKitScriptWorld* world, WebKitWebPage* page,
WebKitFrame* frame, gpointer){    g_autoptr(JSCContext) jsContext =
webkit_frame_get_js_context_for_script_world(frame, world);*


*    g_autoptr(JSCValue) function = jsc_value_new_function(jsContext,
"getTestExtObject", G_CALLBACK(getTestExtObject), jsContext, NULL,
JSC_TYPE_VALUE, 1, G_TYPE_STRING);    jsc_context_set_value(jsContext,
"getTestExtObject", function);}*


On Tue, Jun 18, 2019 at 11:24 PM Michael Catanzaro <mcatanzaro at igalia.com>
wrote:

> So your hang is when taking the VM lock. It must already be locked.
> You'd need to debug JSC internals to understand why that mutex is
> already locked at the time you try to acquire it. That doesn't sound
> very fun, but it's probably your next step.
>
> On Tue, Jun 18, 2019 at 11:39 AM, Carlos Garcia Campos
> <cgarcia at igalia.com> wrote:
> > You are mixing both APIs, I wonder how you can use
> > jscContextGetJSContext() which is private. You shouldn't mix both APIs
> > in any case.
>
> I would:
>
>  * Immediately disable whatever local change you have made to WebKit to
> allow use of internal WebKit symbols, like GRefPtr and
> jscContextGetJSContext. This can only lead to disaster. It's difficult
> to prevent WebKit from exporting these symbols for technical reasons,
> but none of these symbols are defined in public headers so your
> application should not be using them. Are you declaring them manually,
> or have you changed WebKit to install internal headers?
>
>  * Understand the difference between the the modern GObject JSC API,
> documented at [1], and the old cross-platform API. JSCContext obsoletes
> JSGlobalContextRef, and you should never have any reason to use the
> later if you are using the former. You want to use only one or the
> other, ideally the newer one.
>
> [1] https://webkitgtk.org/reference/jsc-glib/stable/index.html
>
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> webkit-wpe mailing list      (webkit-wpe at lists.webkit.org)
> Help/Unsubscribe/Update your Subscription:
> https://lists.webkit.org/mailman//listinfo/webkit-wpe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-wpe/attachments/20190620/7d1a5548/attachment.html>


More information about the webkit-wpe mailing list