Bug 178901 - [WPE] Make it introspectable
Summary: [WPE] Make it introspectable
Status: RESOLVED DUPLICATE of bug 226662
Alias: None
Product: WebKit
Classification: Unclassified
Component: WPE WebKit (show other bugs)
Version: Other
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 222985 226662
Blocks:
  Show dependency treegraph
 
Reported: 2017-10-26 17:08 PDT by Michael Catanzaro
Modified: 2022-04-04 06:16 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2017-10-26 17:08:11 PDT
I'd like the first release of WPE to be fully introspectable. To accomplish this, WPEBackends will need to become introspectable as well.

This should be a fairly small amount of work once we have documentation working, and we all agree that working documentation is a release blocker. The value of delaying the release until we have introspection working is to ensure our API is actually introspectable, and avoid needless breakage down the road. It's also a major marketing point, since it will be nice to be able to use WPE from languages other than C and C++ without going through the pain of writing and maintaining bindings manually.
Comment 1 Michael Catanzaro 2018-04-06 11:26:07 PDT
This would be nice to have, but it's not going to be a release blocker.
Comment 2 Adrian Perez 2022-04-04 02:45:46 PDT
After bug #226662 now it is possible to use WPEWebKit from other
languages via GObject-Introspection. As you can see in the transcript
of a Python session below, things work as expected, modulo the fact
that we do not currently have any WPE backend which would be itself
introspectable:

>>> from gi.repository import WPEJavaScriptCore as JSC
<stdin>:1: PyGIWarning: WPEJavaScriptCore was imported without specifying a version first. Use gi.require_version('WPEJavaScriptCore', '1.1') before import to ensure that the right version gets loaded.
>>> JSC
<IntrospectionModule 'WPEJavaScriptCore' from '/home/aperez/WebKit/_wpep/lib/girepository-1.0/WPEJavaScriptCore-1.1.typelib'>
>>> ctx = JSC.Context.new()
>>> v = ctx.evaluate("new Date();", -1)
>>> v.to_string()
'Mon Apr 04 2022 12:30:53 GMT+0300 (EEST)'

>>> from gi.repository import WPEWebKit as WK 
<stdin>:1: PyGIWarning: WPEWebKit was imported without specifying a version first. Use gi.require_version('WPEWebKit', '1.1') before import to ensure that the right version gets loaded.
>>> context = WK.WebContext.new_ephemeral()
>>> context
<WPEWebKit.WebContext object at 0x7fbc28475040 (WebKitWebContext at 0x55cad3a4b0f0)>
>>> backend = WK.WebViewBackend.new(None, None, None)
** (process:2742041): WARNING **: 12:32:35.580: (../pygobject/gi/pygi-basictype.c:78):marshal_from_py_void: runtime check failed: (arg_cache->transfer == GI_TRANSFER_NOTHING)

** (process:2742041): CRITICAL **: 12:32:35.580: WebKitWebViewBackend* webkit_web_view_backend_new(wpe_view_backend*, GDestroyNotify, gpointer): assertion 'backend' failed
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: constructor returned NULL
Comment 3 Adrian Perez 2022-04-04 02:50:19 PDT
I am going to close this, either:

 - WPE backends add support for GObject-Inrospection themselves, or

 - Some GI language bindings support working with non-GI libraries,
   for example one can register a “foreign module” in PyGObject to
   add support for allow passing C types to/from GI functions. This
   is done in the Cairo integration, see 
   https://pygobject.readthedocs.io/en/latest/guide/cairo_integration.html

At any rate, what's remaining for being able to instantiate a WebView
through GI does not need seem to belong inside WebKit.

*** This bug has been marked as a duplicate of bug 226662 ***