tor-browser

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

browser_closeTab.js (760B)


      1 "use strict";
      2 
      3 var gTestTab;
      4 var gContentAPI;
      5 
      6 add_task(setup_UITourTest);
      7 
      8 add_UITour_task(async function test_closeTab() {
      9  // Setting gTestTab to null indicates that the tab has already been closed,
     10  // and if this does not happen the test run will fail.
     11  let closePromise = BrowserTestUtils.waitForEvent(
     12    gBrowser.tabContainer,
     13    "TabClose"
     14  );
     15  // In the e10s-case, having content request a tab close might mean
     16  // that the ContentTask used to send this closeTab message won't
     17  // get a response (since the message manager may have closed down).
     18  // So we ignore the Promise that closeTab returns, and use the TabClose
     19  // event to tell us when the tab has gone away.
     20  gContentAPI.closeTab();
     21  await closePromise;
     22  gTestTab = null;
     23 });