JDK-8178878 : [WebView] Java method not getting called from HTML
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8u102,9
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 2017-04-18
  • Updated: 2017-06-07
  • Resolved: 2017-04-18
Related Reports
Relates :  
Relates :  
Description
While triaging JDK-8086098, found this issue.
Please find the attached test case [webViewSample.zip]. This is about communication between JavaFX and HTML inside WebView.
Steps to reproduce:
1. Run the CallingJavaFromJSTest.java
2. Click on any Button.

EXPECTED VERSUS ACTUAL BEHAVIOR : 
Expected:
Java method "javaMethod()" should be called.
Actual:
Java method "javaMethod()" is not being called.

But when we click on hyperlink second time, java method is being called and then clicking buttons also works.
Please find JDK results:
================
windows 10
--------
8u40 : pass
8u121 : pass
9b01 : pass
9ea+88 : pass
9ea+140: pass
9ea+146: pass
9-ea+147 : fail
9-ea+148 : fail
9ea+150 : fail
9-ea+163 : fail

windows 7
--------
8u40 : pass
8u121 : pass
9-ea+153 : fail

ubuntu
--------
8 : pass
8u121 : fail
9-ea : fail

Comments
This is not a bug. As a result of the fix for JDK-8089681 we made an intentional change in behavior to not hold a strong reference to objects that are bound to Javascript variables. See JDK-8154127, where we documented this change.
18-04-2017