blob: 738db65376f1145788c22bbb5a3a2b149398143b (
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
35
36
37
38
39
40
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Check if an error with a longString stack is displayed as expected.
"use strict";
const MESSAGE = "Error with longString stack";
const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><script>
const x = new Error("longString stack");
x.stack = "s@http://exampl.com:1:1\\n".repeat(1000);
console.log("${MESSAGE}", x);
</script>`;
add_task(async function () {
const hud = await openNewTabAndConsole(TEST_URI);
info("Wait for the error to be logged");
const msgNode = await waitFor(() => findConsoleAPIMessage(hud, MESSAGE));
ok(msgNode, `Error logged`);
const errorNode = msgNode.querySelector(".objectBox-stackTrace");
ok(errorNode, "The error object is logged as expected");
ok(errorNode.textContent.includes("longString stack"));
info("Wait until the stacktrace gets rendered");
const stackTraceElement = await waitFor(() =>
errorNode.querySelector(".frames")
);
ok(stackTraceElement, "There's a stacktrace element");
ok(
!!stackTraceElement.querySelectorAll(".frame .title").length,
"Frames functions are displayed"
);
ok(
!!stackTraceElement.querySelectorAll(".frame .location").length,
"Frames location are displayed"
);
});
|