On Fri, 28 Jan 2022 00:11:40 GMT, Kevin Rushforth <[email protected]> wrote:
>> Jay Bhaskar has updated the pull request with a new target base due to a
>> merge or a rebase. The incremental webrev excludes the unrelated changes
>> brought in by the merge/rebase. The pull request contains two additional
>> commits since the last revision:
>>
>> - Merge branch 'openjdk:master' into PRLocalstorage
>> - Window.close(), Fix for localstoarge
>
> modules/javafx.web/src/test/java/test/javafx/scene/web/LocalStorageTest.java
> line 2:
>
>> 1: /*
>> 2: * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights
>> reserved.
>
> Copyright should be a single year (2022)
done
> modules/javafx.web/src/test/java/test/javafx/scene/web/LocalStorageTest.java
> line 48:
>
>> 46: final WebEngine webEngine = getEngine();
>> 47: webEngine.setJavaScriptEnabled(true);
>> 48: webEngine.setUserDataDirectory(new File("/tmp/java-store"));
>
> You should not hard-code /tmp/. You can either use a local subdirectory in
> the build dir (which some other tests do), or else you will need to use
> something like `Files.createTempDirectory("webstorage")`. If you use the
> latter, then you will need to worry about how to clean up after the test, so
> the former seems better.
i think /tmp/java-store is ok, as it would not require cleanup
> modules/javafx.web/src/test/java/test/javafx/scene/web/LocalStorageTest.java
> line 70:
>
>> 68: WebView view = getView();
>> 69: view.getEngine().executeScript("test_local_storage_set();");
>> 70: String s = (String)
>> view.getEngine().executeScript("document.getElementById('key').innerText;");
>
> This will work, but it might be cleaner to add a JavaScript `getLocalStorage`
> method so you don't have to get it from a DOM element.
The method webEngine.executeScript("localStorage;") returns JSObject and in to
get data members we need to call js.getMember(...) , getMember is not available
in our code base, so i used tring s = (String)
view.getEngine().executeScript("document.getElementById('key').innerText;");
> modules/javafx.web/src/test/java/test/javafx/scene/web/LocalStorageTest.java
> line 80:
>
>> 78: submit(() -> {
>> 79: WebView view = getView();
>> 80: view.getEngine().executeScript("delete_items();");
>
> You need to set some items first before deleting them if you want it to be an
> effective test of this case.
The test runs after testLocalStorageSet , so there would be items in
localstorage
-------------
PR: https://git.openjdk.java.net/jfx/pull/703