tor-browser

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

browser_bug597218.js (1162B)


      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 function test() {
      6  waitForExplicitFinish();
      7 
      8  // establish initial state
      9  is(gBrowser.tabs.length, 1, "we start with one tab");
     10 
     11  // create a tab
     12  let tab = gBrowser.addTab("about:blank", {
     13    triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
     14  });
     15  ok(!tab.hidden, "tab starts out not hidden");
     16  is(gBrowser.tabs.length, 2, "we now have two tabs");
     17 
     18  // make sure .hidden is read-only
     19  tab.hidden = true;
     20  ok(!tab.hidden, "can't set .hidden directly");
     21 
     22  // hide the tab
     23  gBrowser.hideTab(tab);
     24  ok(tab.hidden, "tab is hidden");
     25 
     26  // now pin it and make sure it gets unhidden
     27  gBrowser.pinTab(tab);
     28  ok(tab.pinned, "tab was pinned");
     29  ok(!tab.hidden, "tab was unhidden");
     30 
     31  // try hiding it now that it's pinned; shouldn't be able to
     32  gBrowser.hideTab(tab);
     33  ok(!tab.hidden, "tab did not hide");
     34 
     35  // clean up
     36  gBrowser.removeTab(tab);
     37  is(gBrowser.tabs.length, 1, "we finish with one tab");
     38 
     39  finish();
     40 }