I am developing a third party chat client for a web site in Swing that embeds WebView so that users can access their account while chatting. When the first web page is loaded, something in the code of the web page (not a Java problem) causes the page to be redirected to about:blank. To work around this, the application reloads the page automatically when the first page is loaded in WebView after signing on.
This reload is done by adding a ChangeListener to the location property which calls WebEngine.load if the page being loaded is the first page loaded after signing on. If load is called within the listener (which I assume is acceptable since the listener is executed in the FX application thread), then the JVM terminates due to a fatal error. Calling WebEngine.getLoadWorker().cancel() before calling load does not help either. Everything works fine if load is called using Platform.runLater.
This situation is not a big deal, but I thought I would report this fatal error in case it is caused by a serious bug.
Example:
engine.locationProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(
final ObservableValue<? extends String> mp_observable, final String mp_oldValue, final String mp_newValue) {
if (firstPageLoad) {
// Platform.runLater(new Runnable() {
//
//
// @Override
// public void run() {
engine.load(mp_oldValue);
// }
//
//
// });
}
}
});
This reload is done by adding a ChangeListener to the location property which calls WebEngine.load if the page being loaded is the first page loaded after signing on. If load is called within the listener (which I assume is acceptable since the listener is executed in the FX application thread), then the JVM terminates due to a fatal error. Calling WebEngine.getLoadWorker().cancel() before calling load does not help either. Everything works fine if load is called using Platform.runLater.
This situation is not a big deal, but I thought I would report this fatal error in case it is caused by a serious bug.
Example:
engine.locationProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(
final ObservableValue<? extends String> mp_observable, final String mp_oldValue, final String mp_newValue) {
if (firstPageLoad) {
// Platform.runLater(new Runnable() {
//
//
// @Override
// public void run() {
engine.load(mp_oldValue);
// }
//
//
// });
}
}
});
- duplicates
-
JDK-8087652 WebView crashes on calling webEngine.load(url) in a webEngine.locationProperty() ChangeListener
-
- Open
-