tor-browser

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

browser_console_restore.js (1226B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Check that the browser console gets session state is set correctly, and that
      5 // it re-opens when restore is requested.
      6 
      7 "use strict";
      8 
      9 add_task(async function () {
     10  is(
     11    BrowserConsoleManager.getBrowserConsoleSessionState(),
     12    false,
     13    "Session state false by default"
     14  );
     15  BrowserConsoleManager.storeBrowserConsoleSessionState();
     16  is(
     17    BrowserConsoleManager.getBrowserConsoleSessionState(),
     18    false,
     19    "Session state still not true even after setting (since Browser Console is closed)"
     20  );
     21 
     22  const hud = await BrowserConsoleManager.toggleBrowserConsole();
     23  BrowserConsoleManager.storeBrowserConsoleSessionState();
     24  is(
     25    BrowserConsoleManager.getBrowserConsoleSessionState(),
     26    true,
     27    "Session state true (since Browser Console is opened)"
     28  );
     29 
     30  info(
     31    "Closing the browser console and waiting for the session restore to reopen it"
     32  );
     33  await safeCloseBrowserConsole();
     34 
     35  const opened = waitForBrowserConsole(hud);
     36  await gDevTools.restoreDevToolsSession({
     37    browserConsole: true,
     38  });
     39 
     40  info("Waiting for the console to open after session restore");
     41  await opened;
     42 });