Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8285991 | jfx17.0.4 | Ambarish Rapte | P4 | Resolved | Fixed | |
JDK-8283051 | 8u341 | Dukebot | P4 | Resolved | Fixed | b01 |
JDK-8285855 | jfx11.0.16 | Ambarish Rapte | P4 | Resolved | Fixed |
Tested and reproducible on Java 8, 11 and 15 with Linux and Windows 10 with according according JavaFX.
A DESCRIPTION OF THE PROBLEM :
When "window.close()" in JavaScript is called within a webpage loaded into a WebEngine-instance, the "localStorage" (in JavaScript) will permanently become null.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- create empty file on /tmp/foo.html (or change path, or use web URL)
- make sure user-data-directory parent is writable (/tmp/java-store)
- run main in LocalStorageBugDemo (which reads localStorage, "closes" window and reads storage again)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
localStorage before close is: [object Storage]
localStorage before close is: [object Storage]
ACTUAL -
localStorage before close is: [object Storage]
localStorage after close is: null
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.application.Platform;
import javafx.concurrent.Worker;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import java.io.File;
public class LocalStorageBugDemo extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(final Stage stage) {
final WebView webView = new WebView();
final WebEngine webEngine = webView.getEngine();
webEngine.setJavaScriptEnabled(true);
webEngine.setUserDataDirectory(new File("/tmp/java-store"));
webEngine.load("file:///tmp/foo.html");
webEngine.getLoadWorker().stateProperty().addListener((observable, oldValue, newState) -> {
if (newState == Worker.State.SUCCEEDED) {
System.out.println("localStorage before close is: " + webEngine.executeScript("localStorage;"));
webEngine.executeScript("window.close();");
System.out.println("localStorage after close is: " + webEngine.executeScript("localStorage;"));
Platform.exit();
}
}
);
}
}
---------- END SOURCE ----------
- backported by
-
JDK-8283051 localStorage is null after window.close()
-
- Resolved
-
-
JDK-8285855 localStorage is null after window.close()
-
- Resolved
-
-
JDK-8285991 localStorage is null after window.close()
-
- Resolved
-
- relates to
-
JDK-8285878 [TestBug] LocalStorageTest and UserDataDirectoryTest don't always cleanup data dirs
-
- Resolved
-
- links to
-
Commit openjdk/jfx11u/57e4c94a
-
Commit openjdk/jfx17u/ca7303ce
-
Commit openjdk/jfx/5112be95
-
Review openjdk/jfx11u/88
-
Review openjdk/jfx17u/45
-
Review openjdk/jfx/703