author Mark Banner <>
Mon, 08 May 2017 10:29:47 +0100
changeset 357703 61f9d530898ae753cddeecc240ad1896b9b9b939
parent 357701 e1e81b129b5b389f59ccc2144573a7c7af728a2a
child 358080 7970ea0858614c4de33e32fb59738ddc9c3efc23
permissions -rw-r--r--
Bug 1362947 - Upgrade eslint-plugin-html to 2.0.3 to pick up --fix support. r=jaws MozReview-Commit-ID: 5fVG7akPnGM

Test sessionStorage is copied over when a new window opens to the
same domain as the opener.
  <meta charset="utf-8">
  <title>Test storage copied</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
  <script src="head.js" type="application/javascript"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  <script type="application/javascript">
    "use strict";

    function waitForMessage(win) {
      return new Promise(resolve => {
        win.addEventListener("message", function(event) {
        }, {once: true});

    add_task(function*() {
      const TEST_VALUE = "test-value";
      // This magic value of 2 means that by default, when content tries
      // to open a new window, it'll actually open in a new window instead
      // of a new tab.
      yield SpecialPowers.pushPrefEnv({"set": [
        ["", 2],

      window.sessionStorage.setItem("test-item", TEST_VALUE);
      let win ="file_storage_copied.html", "my_window");
      let data = yield waitForMessage(win);
      is(data, TEST_VALUE, "Should have cloned the test value");