tor-browser

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

browser_624727.js (976B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 var TEST_STATE = { windows: [{ tabs: [{ url: "about:blank" }] }] };
      5 
      6 add_task(async function () {
      7  function assertNumberOfTabs(num, msg) {
      8    is(gBrowser.tabs.length, num, msg);
      9  }
     10 
     11  function assertNumberOfPinnedTabs(num, msg) {
     12    is(gBrowser.pinnedTabCount, num, msg);
     13  }
     14 
     15  // check prerequisites
     16  assertNumberOfTabs(1, "we start off with one tab");
     17  assertNumberOfPinnedTabs(0, "no pinned tabs so far");
     18 
     19  // setup
     20  BrowserTestUtils.addTab(gBrowser, "about:blank");
     21  assertNumberOfTabs(2, "there are two tabs, now");
     22 
     23  let [tab1, tab2] = gBrowser.tabs;
     24  gBrowser.pinTab(tab1);
     25  gBrowser.pinTab(tab2);
     26  assertNumberOfPinnedTabs(2, "both tabs are now pinned");
     27 
     28  // run the test
     29  await promiseBrowserState(TEST_STATE);
     30 
     31  assertNumberOfTabs(1, "one tab left after setBrowserState()");
     32  assertNumberOfPinnedTabs(0, "there are no pinned tabs");
     33 });