tor-browser

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

browser_console_clear_closed_tab.js (1349B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Check that clearing the browser console output still works if the tab that emitted some
      5 // was closed. See Bug 1628626.
      6 
      7 "use strict";
      8 
      9 const TEST_URI =
     10  "http://example.com/browser/devtools/client/webconsole/test/browser/test-console.html";
     11 
     12 add_task(async function () {
     13  // Show the content messages
     14  await pushPref("devtools.browsertoolbox.scope", "everything");
     15 
     16  // Disable the preloaded process as it creates processes intermittently
     17  // which forces the emission of RDP requests we aren't correctly waiting for.
     18  await pushPref("dom.ipc.processPrelaunch.enabled", false);
     19 
     20  const tab = await addTab(TEST_URI);
     21  const hud = await BrowserConsoleManager.toggleBrowserConsole();
     22 
     23  info("Log a new message from the content page");
     24  SpecialPowers.spawn(gBrowser.selectedBrowser, [], function () {
     25    content.console.log({ hello: "world" });
     26  });
     27 
     28  await waitFor(() => findConsoleAPIMessage(hud, "hello"));
     29 
     30  await removeTab(tab);
     31  // Wait for a bit, so the actors and fronts are released.
     32  await wait(500);
     33 
     34  info("Clear the console output");
     35  hud.ui.outputNode.querySelector(".devtools-clear-icon").click();
     36 
     37  await waitFor(() => !findConsoleAPIMessage(hud, "hello"));
     38  ok(true, "Browser Console was cleared");
     39 });