--- old/modules/web/src/main/java/javafx/scene/web/WebEngine.java 2016-06-27 16:29:22.867444400 +0530 +++ new/modules/web/src/main/java/javafx/scene/web/WebEngine.java 2016-06-27 16:29:21.985768100 +0530 @@ -250,8 +250,9 @@ } } ... +JavaApplication javaApp = new JavaApplication(); JSObject window = (JSObject) webEngine.executeScript("window"); -window.setMember("app", new JavaApplication()); +window.setMember("app", javaApp); * * You can then refer to the object and the method from your HTML page: *

@@ -259,6 +260,21 @@
  * 
*

When a user clicks the link the application is closed. *

+ * Note that the property value {@code javaApp} of + * JavaScript object named {@code app} is implemented as Weak Global Reference. + *


+JSObject window = (JSObject) webEngine.executeScript("window");
+window.setMember("app", new JavaApplication());
+ * 
+ *

+ * Hence if the property value is a local object {@code "new JavaApplication()"}, the value will be GC'ed in next + * GC Cycle. + *


+<a href="" onclick="app.exit()">Click here to exit application</a>
+ * 
+ *

+ * When a user clicks the link, it does not guarantee to execute the callback method {@code exit}. + *

* If there are multiple Java methods with the given name, * then the engine selects one matching the number of parameters * in the call. (Varargs are not handled.) An unspecified one is