tor-browser

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

browser_webconsole_checkloaduri_errors.js (1072B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Ensure that same-origin errors are logged to the console.
      5 
      6 // XPCNativeWrapper is not defined globally in ESLint as it may be going away.
      7 // See bug 1481337.
      8 /* global XPCNativeWrapper */
      9 
     10 "use strict";
     11 
     12 const TEST_URI =
     13  "http://example.com/browser/devtools/client/webconsole/test/browser/test-checkloaduri-failure.html";
     14 
     15 add_task(async function () {
     16  const hud = await openNewTabAndConsole(TEST_URI);
     17 
     18  const targetURL = "file:///something-weird";
     19  const onErrorMessage = waitForMessageByType(
     20    hud,
     21    "may not load or link",
     22    ".error"
     23  );
     24  SpecialPowers.spawn(gBrowser.selectedBrowser, [targetURL], url => {
     25    XPCNativeWrapper.unwrap(content).testImage(url);
     26  });
     27  const message = await onErrorMessage;
     28  const node = message.node;
     29  ok(
     30    node.classList.contains("error"),
     31    "The message has the expected classname"
     32  );
     33  ok(
     34    node.textContent.includes(targetURL),
     35    "The message is about the thing we were expecting"
     36  );
     37 });