[Sugar-devel] Messages from the page to the browser in webkit2

Daniel Narvaez dwnarvaez at gmail.com
Sat Mar 23 22:16:20 EDT 2013


Hey,

Lionel's enyo-activity uses the webkit console-message signal to send
messages from the browser to the web page. This is a bit of an hack.
Also the signal is not available in webkit2 (though it might be added
at some point).

This kind of communication is complicated in webkit2 because browser
and page are two separated processes. I figured out how to do it, and
I thought it would be worth to send a note to the mailing list for
future memory. It should be useful for the html activities framework

This is how the qt port registers a navigator.qt.postMessage() method:

https://trac.webkit.org/browser/trunk/Source/WebKit2/WebProcess/qt/QtBuiltinBundlePage.cpp

This code is part of an extension. It should be possible to write an
extension for webkitgtk as epiphany is doing

https://git.gnome.org/browse/epiphany/tree/embed/web-extension

A postMessage method with a message-received signal is something we
might want to upstream, but we don't necessarily need to do so, as far
as I can tell it can be implemented with the current webkit2gtk.

-- 
Daniel Narvaez


More information about the Sugar-devel mailing list