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

lionel at olpc-france.org lionel at olpc-france.org
Sun Mar 24 04:04:45 EDT 2013


Hi Daniel,

Yes you're right, using console-message is just hack. We should do better in
the definitive framework.
It's something that should be seriously studied in the first part of the
work.

I'm keeping a link on your postMessage suggestion.

	Lionel.


-----Message d'origine-----
De : Daniel Narvaez [mailto:dwnarvaez at gmail.com] 
Envoyé : dimanche 24 mars 2013 03:16
À : sugar-devel at lists.sugarlabs.org
Cc : lionel at olpc-france.org
Objet : Messages from the page to the browser in webkit2

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/QtBuiltin
BundlePage.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