JDK-8160400 : WebView can't alert from a timer
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8u60,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-06-27
  • Updated: 2016-06-29
  • Resolved: 2016-06-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u112Fixed 9Fixed
Related Reports
Cloners :  
Duplicate :  
Duplicate :  
Relates :  
Description
Since 8_u60 my code in NetBeans
http://hg.netbeans.org/html4j/file/e390a06dbfac/boot-fx/src/main/java/org/netbeans/html/boot/fx/FXBrwsr.java#l303
that used to open alert/confirm dialogs is broken, if executed as

window.setTimeout(function() { alert('I will yield an error'); }, 1000);

As far as I can say this is a regression as the same code works in JDK7 and in earlier builds in JDK8.

Workarounds aren't easy, as the JavaScript code is supposed to block and wait until alert/confirm is dismissed.
Comments
Changeset: 93430e9b5984 Author: mbilla Date: 2016-06-29 16:07 +0530 URL: http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/93430e9b5984
29-06-2016

lgtm with a nit: + Platform.runLater(() -> Timer.getTimer().notifyTick()); You could reduce the lambda further like Platform.runLater(Timer.getTimer()::notifyTick); +1
29-06-2016

webrev: http://cr.openjdk.java.net/~mbilla/8160400/webrev.01/ Updated the comment in webrev.01
29-06-2016

The code change looks good, and unlike the previous fix (JDK-8146211) will preserve the behavior that the execution of all JavaScript code called by the PulseTimer will be done in order. My testing looks good, too. I'd like one more reviewer on this. Minor comment on the comment: // Keeping notifyTick in runLater to run out of pulse event // and to execute in synchronize manner This is a little unclear. Maybe something more like the following might be clearer: // Execute notifyTick in runLater to run outside of pulse so that events will run in order and be able to display dialogs or call other methods that require a nested event loop.
29-06-2016

webrev: http://cr.openjdk.java.net/~mbilla/8160400/webrev.00/ Tested AlertWebView.zip, AlertWebView.java, web unit test cases (:web:test) , perftest. I could not verify JDK-8090205 due to lack of reproducible test case. But based on the call stack in JDK-8090205, it seems highly likely that JDK-8090205 will be get fixed with JDK-8160400 changeset.
28-06-2016