tor-browser

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

browser_webconsole_network_exceptions.js (1033B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Tests that we report JS exceptions in event handlers coming from
      5 // network requests, like onreadystate for XHR. See bug 618078.
      6 
      7 "use strict";
      8 
      9 const TEST_URI =
     10  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for bug 618078";
     11 const TEST_URI2 =
     12  "https://example.com/browser/devtools/client/webconsole/" +
     13  "test/browser/test-network-exceptions.html";
     14 
     15 add_task(async function () {
     16  const hud = await openNewTabAndConsole(TEST_URI);
     17 
     18  // On e10s, the exception is triggered in child process
     19  // and is ignored by test harness
     20  if (!Services.appinfo.browserTabsRemoteAutostart) {
     21    expectUncaughtException();
     22  }
     23 
     24  const onMessage = waitForMessageByType(hud, "bug618078exception", ".error");
     25  await navigateTo(TEST_URI2);
     26  const { node } = await onMessage;
     27  ok(true, "Network exception logged as expected.");
     28  ok(node.classList.contains("error"), "Network exception is logged as error.");
     29 });