tor-browser

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

browser_lazy_tabs.js (1519B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test that lazy background tabs aren't unintentionally loaded when building
      7 // the a11y tree (bug 1700708).
      8 addAccessibleTask(``, async function () {
      9  await SpecialPowers.pushPrefEnv({
     10    set: [["browser.sessionstore.restore_on_demand", true]],
     11  });
     12 
     13  info("Opening a new window");
     14  let win = await BrowserTestUtils.openNewBrowserWindow();
     15  // Window is opened with a blank tab.
     16  info("Loading second tab");
     17  await BrowserTestUtils.openNewForegroundTab({
     18    gBrowser: win.gBrowser,
     19    url: "data:text/html,2",
     20  });
     21  info("Loading third tab");
     22  await BrowserTestUtils.openNewForegroundTab({
     23    gBrowser: win.gBrowser,
     24    url: "data:text/html,3",
     25  });
     26  info("Closing the window");
     27  await BrowserTestUtils.closeWindow(win);
     28 
     29  is(SessionStore.getClosedWindowCount(), 1, "Should have a window to restore");
     30  info("Restoring the window");
     31  win = SessionStore.undoCloseWindow(0);
     32  await BrowserTestUtils.waitForEvent(win, "SSWindowStateReady");
     33  await BrowserTestUtils.waitForEvent(
     34    win.gBrowser.tabContainer,
     35    "SSTabRestored"
     36  );
     37  is(win.gBrowser.tabs.length, 3, "3 tabs restored");
     38  ok(win.gBrowser.tabs[2].selected, "Third tab selected");
     39  ok(getAccessible(win.gBrowser.tabs[1]), "Second tab has accessible");
     40  ok(!win.gBrowser.browsers[1].isConnected, "Second tab is lazy");
     41  info("Closing the restored window");
     42  await BrowserTestUtils.closeWindow(win);
     43 });