tor-browser

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

browser_465215.js (1094B)


      1 "use strict";
      2 
      3 var uniqueName = "bug 465215";
      4 var uniqueValue1 = "as good as unique: " + Date.now();
      5 var uniqueValue2 = "as good as unique: " + Math.random();
      6 
      7 add_task(async function () {
      8  // set a unique value on a new, blank tab
      9  let tab1 = BrowserTestUtils.addTab(gBrowser, "about:blank");
     10  await BrowserTestUtils.browserLoaded(tab1.linkedBrowser, {
     11    wantLoad: "about:blank",
     12  });
     13  ss.setCustomTabValue(tab1, uniqueName, uniqueValue1);
     14 
     15  // duplicate the tab with that value
     16  let tab2 = ss.duplicateTab(window, tab1);
     17  await promiseTabRestored(tab2);
     18  is(
     19    ss.getCustomTabValue(tab2, uniqueName),
     20    uniqueValue1,
     21    "tab value was duplicated"
     22  );
     23 
     24  ss.setCustomTabValue(tab2, uniqueName, uniqueValue2);
     25  isnot(
     26    ss.getCustomTabValue(tab1, uniqueName),
     27    uniqueValue2,
     28    "tab values aren't sync'd"
     29  );
     30 
     31  // overwrite the tab with the value which should remove it
     32  await promiseTabState(tab1, { entries: [] });
     33  is(ss.getCustomTabValue(tab1, uniqueName), "", "tab value was cleared");
     34 
     35  // clean up
     36  gBrowser.removeTab(tab2);
     37  gBrowser.removeTab(tab1);
     38 });