tor-browser

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

browser_webconsole_worklet_console.js (1080B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Tests that console api usage in worklet show in the console
      5 
      6 "use strict";
      7 
      8 const TEST_URI =
      9  "https://example.com/browser/devtools/client/webconsole/" +
     10  "test/browser/test-console-worklet.html";
     11 
     12 add_task(async function () {
     13  // Allow using SharedArrayBuffer in the test without special HTTP Headers
     14  await pushPref(
     15    "dom.postMessage.sharedArrayBuffer.bypassCOOP_COEP.insecure.enabled",
     16    true
     17  );
     18 
     19  const hud = await openNewTabAndConsole(TEST_URI);
     20 
     21  await waitFor(() => findConsoleAPIMessage(hud, "string"));
     22  await waitFor(() => findConsoleAPIMessage(hud, "42"));
     23  const objectMessage = await waitFor(() =>
     24    findConsoleAPIMessage(hud, "object")
     25  );
     26  ok(
     27    objectMessage
     28      .querySelector(".message-body")
     29      .textContent.includes(`Object { object: true }`),
     30    "The simple object is logged as expected"
     31  );
     32  await waitFor(() => findConsoleAPIMessage(hud, "SharedArrayBuffer"));
     33  ok(true, "SharedArrayBuffer object is logged");
     34 });