[jbosstools-issues] [JBoss JIRA] (ERT-527) [GTK3][Webkit2] Implement webkit2 support for browser function (Part 2: Java return a value from callback.) [EBZ#510905]

Friendly Jira Robot (JIRA) issues at jboss.org
Tue Oct 31 15:26:00 EDT 2017


Friendly Jira Robot created ERT-527:
---------------------------------------

             Summary: [GTK3][Webkit2] Implement webkit2 support for browser function (Part 2: Java return a value from callback.) [EBZ#510905]
                 Key: ERT-527
                 URL: https://issues.jboss.org/browse/ERT-527
             Project: Eclipse Release Train
          Issue Type: Task
          Components: Platform
            Reporter: Friendly Jira Robot


The mechanism whereby javascript calls java in Part1 (Bug 508217) has a limitation.

Javascript can reach Java's callback. But the callback on the javaside cannot return a value back to javascript.

I don't think this functionality is used much, but never the less it is a current limitation.
(Note, Java can execute javascript via 'execute()' call still).

The jUnit test case for this scenario is:
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_browser_Browser.test_BrowserFunction_callback_with_javaReturningInt()

The api that I used in Part1 allows Javascript to call Java asynchronously. 
I.e, meaning once the callback is executed on the java side, it doesn't return a value:
https://webkitgtk.org/reference/webkit2gtk/stable/WebKitUserContentManager.html#WebKitUserContentManager-script-message-received

This is a limitation of the webkit2 api itself. The signal has a void return value and since it is async, the call from javascript to java is not executed right away, but is delayed for a bit.

One possible (complex) solution might be:
- Create webkitweb extension (this is tricky..)
- Manually create a C/Javascript object (webkit1 does this, 'external', might re-use this functionality). 
- Expose Js function/object via JavaSciptCoreApi
- Suggested by aperezdc/mcatanzaro on freednode#webkitgtk+

Example:
https://git.gnome.org/browse/epiphany/tree/embed/web-extension/ephy-web-extension.c?h=gnome-3-14#n1302



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jbosstools-issues mailing list