[webkit-gtk] Webkit2 signals/callbacks

Daniel Berek berekdaniel at gmail.com
Wed Feb 13 05:11:15 PST 2019

Thanks. One last question: how can I execute external javascripts ( or
jquery) which are linked in a html as <script> tag?
Unfortunately in webkit2gtk doesnt work or I havent figured it out yet. Any
idea? Thanks

Michael Catanzaro <mcatanzaro at igalia.com> ezt írta (időpont: 2019. febr.
12., K, 17:43):

> On Tue, Feb 12, 2019 at 1:35 AM, Daniel Berek <berekdaniel at gmail.com>
> wrote:
> > Thanks it really works. But I still have to figure out how to pass
> > data to my core class through webview widget -> gtk:window ->
> > gui thread -> core app. A simple function call freezes the gui, so
> > some kind of in-build signal handling is needed. (in the other
> > direction I have already managed by glib:dispatcher). Any idea how to
> > bring out the script messages? Thanks
> Did you try using
> webkit_user_content_manager_register_script_message_handler() to
> register a message handler? Then your JS content can use
> window.webkit.messageHandlers.<foobar>.postMessage([value]) to send
> messages to the UI process, and you receive them by connecting to the
> script-message-received::foobar signal. That's what Adrian was trying
> to suggest.
> Regarding thread safety, there is none: the entire WebKit API must only
> be used from the GUI thread (whatever thread is running
> gtk_application_run() or gtk_main(), recommended but not required to be
> your main thread). If you need to perform blocking operations on a
> secondary thread, you can run code back on the GUI thread using e.g.
> g_main_context_invoke() or g_idle_add().
> GObject signals are not threadsafe. Only connect to them from the GUI
> thread.
> Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20190213/136be572/attachment.html>

More information about the webkit-gtk mailing list