SCOPING:
Webview should allow JavaScript rendered in the WebView to make calls to the containing Java code. This feature must provide capabilities similar to those provided by the Java browser plugin's JavaScript to Java bridge.
RISK:
- There is a security risk in direct calls from JavaScripto to Java. We now know how to do it securely.
- We consider using Nashorn as a JS engine for WebView. Nashorn design may affect the bridge API.
DEPENDENCIES:
No dependency on other JFX components.
DETAILS:
The bridge supports wrapping Java objects as JavaScript. This happens (for example) when calling the JSObject#setMember or JSObject#call methods.
Currently this wrapping is opaque: Javascript code can't do anything with the wrapped Java object.
The top priority is "fixing" this so JavaScript can call methods on a wrapped Java object; one also wants to be able to get and set fields.
WebKit has support for this, but we need to figure out and implement the correct way of plugging in our implementation.
No new APIs are needed for this: We just need to plug in the mechanism so a JavaScript methods call forwards (proxies) to the correspondingly-named Java method.
There may be some difficulties with overloaded methods, but an approximate solution is probably OK.
In addition it is desirable to define a Java API to enable registering specific Java objects and possibly specific methods in the JavaScript namespace, to make it more convenient to call Java from (say) JavaScript events handlers. Such methods would probably be in the WebEngine class. At the least we plan to provide a single method to register a Java Object as "global" name (i.e. as a property of the Window object).
The LiveConnect browser plugin allows JavaScript to call arbitrary named Java static methods and constructors. We do *not* intend to support this for 2.1; partly because of the work needed, and partly because we don't have a handle on the security implications.
The LiveConnect browser plugin has some extra functionality to make working with arrays more convenient. We do not plan to support this for 1.2.
Webview should allow JavaScript rendered in the WebView to make calls to the containing Java code. This feature must provide capabilities similar to those provided by the Java browser plugin's JavaScript to Java bridge.
RISK:
- There is a security risk in direct calls from JavaScripto to Java. We now know how to do it securely.
- We consider using Nashorn as a JS engine for WebView. Nashorn design may affect the bridge API.
DEPENDENCIES:
No dependency on other JFX components.
DETAILS:
The bridge supports wrapping Java objects as JavaScript. This happens (for example) when calling the JSObject#setMember or JSObject#call methods.
Currently this wrapping is opaque: Javascript code can't do anything with the wrapped Java object.
The top priority is "fixing" this so JavaScript can call methods on a wrapped Java object; one also wants to be able to get and set fields.
WebKit has support for this, but we need to figure out and implement the correct way of plugging in our implementation.
No new APIs are needed for this: We just need to plug in the mechanism so a JavaScript methods call forwards (proxies) to the correspondingly-named Java method.
There may be some difficulties with overloaded methods, but an approximate solution is probably OK.
In addition it is desirable to define a Java API to enable registering specific Java objects and possibly specific methods in the JavaScript namespace, to make it more convenient to call Java from (say) JavaScript events handlers. Such methods would probably be in the WebEngine class. At the least we plan to provide a single method to register a Java Object as "global" name (i.e. as a property of the Window object).
The LiveConnect browser plugin allows JavaScript to call arbitrary named Java static methods and constructors. We do *not* intend to support this for 2.1; partly because of the work needed, and partly because we don't have a handle on the security implications.
The LiveConnect browser plugin has some extra functionality to make working with arrays more convenient. We do not plan to support this for 1.2.
- is blocked by
-
JDK-8097712 enable calling Java methods and creating Java objects from JavaScript
- Closed
-
JDK-8097715 provide JavaScript access to Java classes and packages (Package object)
- Closed