tor-browser

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

browser_webconsole_logErrorInPage.js (681B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test that we can log a message to the web console from the toolbox.
      7 
      8 const TEST_URI =
      9  "data:text/html;charset=utf-8,<!DOCTYPE html><p>test logErrorInPage";
     10 
     11 add_task(async function () {
     12  const hud = await openNewTabAndConsole(TEST_URI);
     13  const toolbox = hud.ui.wrapper.toolbox;
     14 
     15  toolbox.target.logErrorInPage("beware the octopus", "content javascript");
     16 
     17  const node = await waitFor(() => findErrorMessage(hud, "octopus"));
     18  ok(node, "text is displayed in web console");
     19  ok(node.classList.contains("error"), "the log represents an error");
     20 });