summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webstorage/storage_session_window_reopen.window.js
blob: 1ce17d47f1d80c120a19d237cbedab9c36c6e9b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
test(function() {
  var popup = window.open("", "sessionStorageTestWindow");

  sessionStorage.setItem("FOO", "BAR");

  var reopened = window.open("", "sessionStorageTestWindow");

  assert_equals(
    popup,
    reopened,
    "window.open with the same name should re-open the same window"
  );

  assert_equals(
    sessionStorage.getItem("FOO"),
    "BAR",
    "local sessionStorage is correct"
  );
  assert_equals(
    popup.sessionStorage.getItem("FOO"),
    null,
    "popup sessionStorage is correct"
  );

  popup.close();
}, "ensure that re-opening a named window doesn't copy sessionStorage");