Bug 178901
Summary: | [WPE] Make it introspectable | ||
---|---|---|---|
Product: | WebKit | Reporter: | Michael Catanzaro <mcatanzaro> |
Component: | WPE WebKit | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | aperez, bugs-noreply, mcatanzaro |
Priority: | P2 | ||
Version: | Other | ||
Hardware: | PC | ||
OS: | Linux | ||
See Also: |
https://bugs.webkit.org/show_bug.cgi?id=226662 https://bugs.webkit.org/show_bug.cgi?id=238734 |
||
Bug Depends on: | 222985, 226662 | ||
Bug Blocks: |
Michael Catanzaro
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.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Michael Catanzaro
This would be nice to have, but it's not going to be a release blocker.
Adrian Perez
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
Adrian Perez
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 ***