summaryrefslogtreecommitdiffstats
path: root/devtools/client/webconsole/test/browser/browser_webconsole_worklet_console.js
blob: dee5c4a54c56c8941e6efce8f4b9fce1cd40e08c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

// Tests that console api usage in worklet show in the console

"use strict";

const TEST_URI =
  "https://example.com/browser/devtools/client/webconsole/" +
  "test/browser/test-console-worklet.html";

add_task(async function () {
  // Allow using SharedArrayBuffer in the test without special HTTP Headers
  await pushPref(
    "dom.postMessage.sharedArrayBuffer.bypassCOOP_COEP.insecure.enabled",
    true
  );

  const hud = await openNewTabAndConsole(TEST_URI);

  await waitFor(() => findConsoleAPIMessage(hud, "string"));
  await waitFor(() => findConsoleAPIMessage(hud, "42"));
  const objectMessage = await waitFor(() =>
    findConsoleAPIMessage(hud, "object")
  );
  ok(
    objectMessage
      .querySelector(".message-body")
      .textContent.includes(`Object { object: true }`),
    "The simple object is logged as expected"
  );
  await waitFor(() => findConsoleAPIMessage(hud, "SharedArrayBuffer"));
  ok(true, "SharedArrayBuffer object is logged");
});