tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_339445.js (1163B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 add_task(async function test() {
      6  /** Test for Bug 339445 */
      7 
      8  let testURL =
      9    "http://mochi.test:8888/browser/" +
     10    "browser/components/sessionstore/test/browser_339445_sample.html";
     11 
     12  let tab = BrowserTestUtils.addTab(gBrowser, testURL);
     13  await promiseBrowserLoaded(tab.linkedBrowser, true, testURL);
     14 
     15  await SpecialPowers.spawn(tab.linkedBrowser, [], function () {
     16    let doc = content.document;
     17    is(
     18      doc.getElementById("storageTestItem").textContent,
     19      "PENDING",
     20      "sessionStorage value has been set"
     21    );
     22  });
     23 
     24  let tab2 = gBrowser.duplicateTab(tab);
     25  await promiseTabRestored(tab2);
     26 
     27  await ContentTask.spawn(tab2.linkedBrowser, null, function () {
     28    let doc2 = content.document;
     29    is(
     30      doc2.getElementById("storageTestItem").textContent,
     31      "SUCCESS",
     32      "sessionStorage value has been duplicated"
     33    );
     34  });
     35 
     36  // clean up
     37  BrowserTestUtils.removeTab(tab2);
     38  BrowserTestUtils.removeTab(tab);
     39 });