tor-browser

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

browser_webconsole_close_unfocused_window.js (1159B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // See Bug 597103. Check that closing the console on an unfocused window does not trigger
      7 // any error.
      8 
      9 const TEST_URI =
     10  "http://example.com/browser/devtools/client/webconsole/" +
     11  "test/browser/test-console.html";
     12 
     13 add_task(async function () {
     14  const tab1 = await addTab(TEST_URI, { window });
     15 
     16  info("Open a second window");
     17  const win2 = await BrowserTestUtils.openNewBrowserWindow();
     18 
     19  info("Add a test tab in the second window");
     20  const tab2 = await addTab(TEST_URI, { window: win2 });
     21  win2.gBrowser.selectedTab = tab2;
     22 
     23  info("Open console in tabs located in different windows");
     24  await openConsole(tab1);
     25  await openConsole(tab2);
     26 
     27  info(
     28    "Close toolboxes in tabs located in different windows, one of them not focused"
     29  );
     30  await gDevTools.closeToolboxForTab(tab1);
     31  await gDevTools.closeToolboxForTab(tab2);
     32 
     33  info("Close the second window");
     34  win2.close();
     35 
     36  info("Close the test tab in the first window");
     37  window.gBrowser.removeTab(tab1);
     38 
     39  ok(true, "No error was triggered during the test");
     40 });