On Wed, 2014-10-15 at 19:00 +0200, Carlos Garcia Campos wrote:
Robert Schroll <rschroll gmail com> writes:On Tue, Oct 14, 2014 at 10:17 PM, Michael Catanzaro <mcatanzaro gnome org> wrote:Anyway, Robert and I spent yesterday morning learning how to get a very simple example of UI process <-> web extension IPC working via D-Bus. (Well, mostly working: Robert discovered today that our example D-Bus signal is broken....) The plan was for him to publish the code on GitHub soon.I've put the example up on Github: https://github.com/rschroll/webkitdom. The README could use some work explaining what's going on, but it's late and I'm tired. In short, the master branch shows how things used to work with the old API, and the javascript and extension branches show two ways to get things to work with the new API. The javascript method is a bit simpler, but may not scale (and requires javascript); the extension uses the web extension with IPC over DBus. This latter example isn't working with DOM events, as I can't figure out how to use WebKit.DOM.EventTarget.add_event_listener_with_closure() from Vala. Any help here appreciated.I don't know much about bindings, but I added the _with_closure() variants to make the API introspectable, and I remember I tried it with python and it worked. See https://bugs.webkit.org/show_bug.cgi?id=77835
Vala is strongly (and statically) typed, so it needs to know what the delegate you pass to the closure argument should look like. GObject Introspection doesn't include that information for for GClosures (bug #636812) so we have to set the type for GClosure arguments in metadata. It's not difficult to do, but someone who actually knows the API needs to tell us what that type should be (or it needs to be documented). The VAPI just needs to change from public bool add_event_listener_with_closure (string event_name, GLib.Closure handler, bool use_capture); to something like public bool add_event_listener_with_closure (string event_name, [CCode (type = "GClosure*")] owned WebKit.DOM.FooFunc handler, bool use_capture); I just need to know what to put for instead of WebKit.DOM.FooFunc and I can push a change to the VAPI. Preferably a typedef in C, but if need be we can also create a delegate type from scratch in the VAPI. -Evan
Attachment:
signature.asc
Description: This is a digitally signed message part