tor-browser

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

browser_webconsole_responsive_design_mode.js (1303B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Check that messages are displayed in the console when RDM is enabled
      7 
      8 const TEST_URI =
      9  "data:text/html,<!DOCTYPE html><meta charset=utf8>Test logging in RDM";
     10 
     11 add_task(async function () {
     12  const tab = await addTab(TEST_URI);
     13 
     14  info("Open responsive design mode");
     15  await openRDM(tab);
     16 
     17  info("Log a message before the console is open");
     18  SpecialPowers.spawn(gBrowser.selectedBrowser, [], function () {
     19    content.wrappedJSObject.console.log("Cached message");
     20  });
     21 
     22  info("Open the console");
     23  const hud = await openConsole(tab);
     24  await waitFor(
     25    () => findConsoleAPIMessage(hud, "Cached message"),
     26    "Cached message isn't displayed in the console output"
     27  );
     28  ok(true, "Cached message is displayed in the console");
     29 
     30  info("Log a message while the console is open");
     31  SpecialPowers.spawn(gBrowser.selectedBrowser, [], function () {
     32    content.wrappedJSObject.console.log("Live message");
     33  });
     34 
     35  await waitFor(
     36    () => findConsoleAPIMessage(hud, "Live message"),
     37    "Live message isn't displayed in the console output"
     38  );
     39  ok(true, "Live message is displayed in the console");
     40 
     41  info("Close responsive design mode");
     42  await closeRDM(tab);
     43 });