tor-browser

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

browser_webconsole_logs_exceptions_order.js (1232B)


      1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
      2 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
      3 /* Any copyright is dedicated to the Public Domain.
      4 * http://creativecommons.org/publicdomain/zero/1.0/ */
      5 
      6 // Tests that (cached and live) logs and errors are displayed in the expected order
      7 // in the console output. See Bug 1483662.
      8 
      9 "use strict";
     10 
     11 const TEST_URI =
     12  "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-logs-exceptions-order.html";
     13 
     14 add_task(async function () {
     15  const hud = await openNewTabAndConsole(TEST_URI);
     16  await checkConsoleOutput(hud);
     17 
     18  info("Reload the content window");
     19  await reloadBrowser();
     20  await checkConsoleOutput(hud);
     21 });
     22 
     23 async function checkConsoleOutput(hud) {
     24  await waitFor(
     25    () =>
     26      findConsoleAPIMessage(hud, "First") &&
     27      findErrorMessage(hud, "Second") &&
     28      findConsoleAPIMessage(hud, "Third") &&
     29      findErrorMessage(hud, "Fourth")
     30  );
     31 
     32  const messagesText = Array.from(
     33    hud.ui.outputNode.querySelectorAll(".message .message-body")
     34  ).map(n => n.textContent);
     35 
     36  Assert.deepEqual(
     37    messagesText,
     38    ["First", "Uncaught Second", "Third", "Uncaught Fourth"],
     39    "Errors are displayed in the expected order"
     40  );
     41 }