Bug 1764717 - Part 6: Use type-specific findMessage(s) in devtools/client/webconsole/test/browser/browser_webconsole_*. r=nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D147026
This commit is contained in:
Tooru Fujisawa 2022-05-24 10:05:59 +00:00
Родитель 9ef63471c0
Коммит 40f9a2dd0b
116 изменённых файлов: 336 добавлений и 280 удалений

Просмотреть файл

@ -36,7 +36,7 @@ add_task(async function() {
"\u201chttp://example.com/tests/image/test/mochitest/blue.png\u201d on a secure page";
const waitUntilWarningMessage = text =>
waitFor(() => findMessage(hud, text, ".message.warn"), undefined, 100);
waitFor(() => findWarningMessage(hud, text), undefined, 100);
const onMixedActiveContent = waitUntilWarningMessage(activeContentText);
const onMixedDisplayContent = waitUntilWarningMessage(displayContentText);

Просмотреть файл

@ -43,14 +43,14 @@ add_task(async function() {
].join("\n");
const traceMsgNode = await waitFor(
() => findMessage(hud, "Trace message", ".console-api.trace"),
() => findConsoleAPIMessage(hud, "Trace message", ".trace"),
"Wait for the trace message to be logged"
);
let frames = await getSimplifiedStack(traceMsgNode);
is(frames, expectedFrames, "console.trace has expected frames");
const consoleErrorMsgNode = await waitFor(
() => findMessage(hud, "console error message", ".console-api.error"),
() => findConsoleAPIMessage(hud, "console error message", ".error"),
"Wait for the console error message to be logged"
);
consoleErrorMsgNode.querySelector(".arrow").click();
@ -59,10 +59,10 @@ add_task(async function() {
const errorMsgNode = await waitFor(
() =>
findMessage(
findErrorMessage(
hud,
"Uncaught Error: Thrown error message",
".javascript.error"
".javascript"
),
"Wait for the thrown error message to be logged"
);

Просмотреть файл

@ -46,7 +46,9 @@ async function testBatchLoggingAndClear(hud, messageNumber) {
) {
content.wrappedJSObject.batchLogAndClear(numMessages);
});
await waitFor(() => findMessage(hud, l10n.getStr("consoleCleared")));
await waitFor(() =>
findConsoleAPIMessage(hud, l10n.getStr("consoleCleared"))
);
ok(true, "console cleared message is displayed");
// Passing the text argument as an empty string will returns all the message,

Просмотреть файл

@ -48,7 +48,7 @@ add_task(async function() {
];
for (let i = 0; i < texts.length; ++i) {
const msgId = "msg" + String(i + 1).padStart(2, "0");
const message = await waitFor(() => findMessage(hud, msgId));
const message = await waitFor(() => findConsoleAPIMessage(hud, msgId));
const objectBox = message.querySelector(".objectBox");
is(objectBox.textContent, texts[i], "Should have all the relevant text");
checkRects(objectBox);

Просмотреть файл

@ -40,7 +40,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const waitForErrorMessage = text =>
waitFor(() => findMessage(hud, text, ".message.error"), undefined, 100);
waitFor(() => findErrorMessage(hud, text), undefined, 100);
const onBlockedIframe = waitForErrorMessage(blockedActiveContentText);
const onBlockedImage = waitForErrorMessage(blockedDisplayContentText);
@ -73,7 +73,7 @@ add_task(async function() {
gIdentityHandler.disableMixedContentProtection();
const waitForWarningMessage = text =>
waitFor(() => findMessage(hud, text, ".message.warn"), undefined, 100);
waitFor(() => findWarningMessage(hud, text), undefined, 100);
const onMixedActiveContent = waitForWarningMessage(activeContentText);
const onMixedDisplayContent = waitForWarningMessage(displayContentText);

Просмотреть файл

@ -108,7 +108,7 @@ async function logMessages() {
async function testMessagesVisibility(hud, checkNetworkMessage = true) {
// wait for the last logged message to be displayed
await waitFor(() => findMessage(hud, "info Bazzle", ".message.info"));
await waitFor(() => findConsoleAPIMessage(hud, "info Bazzle", ".info"));
const messages = Array.from(hud.ui.outputNode.querySelectorAll(".message"));
const EXPECTED_MESSAGES = [
@ -178,7 +178,7 @@ async function testMessagesVisibility(hud, checkNetworkMessage = true) {
// We can't assert the CSS warning position, so we only check that it's visible.
await waitFor(
() => findMessage(hud, "cssColorBug611032", ".message.warn.css"),
() => findWarningMessage(hud, "cssColorBug611032", ".css"),
"Couldn't find the CSS warning message"
);
ok(true, "css warning message is visible");

Просмотреть файл

@ -26,7 +26,9 @@ add_task(async function() {
info("wait until all the messages are displayed");
await waitFor(
() => findMessage(hud, "message 1") && findMessage(hud, "message 50")
() =>
findConsoleAPIMessage(hud, "message 1") &&
findConsoleAPIMessage(hud, "message 50")
);
is(

Просмотреть файл

@ -21,8 +21,8 @@ add_task(async function() {
await closeToolbox();
hud = await openConsole(tab);
await waitFor(() => findMessage(hud, EXPECTED_REPORT));
await waitFor(() => findMessage(hud, CACHED_MESSAGE));
await waitFor(() => findErrorMessage(hud, EXPECTED_REPORT));
await waitFor(() => findConsoleAPIMessage(hud, CACHED_MESSAGE));
info(
"Click the clear output button and wait until there's no messages in the output"
@ -37,12 +37,12 @@ add_task(async function() {
info("Log a smoke message in order to know that the console is ready");
await logTextToConsole(hud, "Smoke message");
is(
findMessage(hud, CACHED_MESSAGE),
findConsoleAPIMessage(hud, CACHED_MESSAGE),
undefined,
"The cached message is not visible anymore"
);
is(
findMessage(hud, EXPECTED_REPORT),
findErrorMessage(hud, EXPECTED_REPORT),
undefined,
"The cached error message is not visible anymore as well"
);
@ -65,7 +65,7 @@ add_task(async function() {
info("Log a smoke message in order to know that the console is ready");
await logTextToConsole(hud, "Second smoke message");
is(
findMessage(hud, NEW_CACHED_MESSAGE),
findConsoleAPIMessage(hud, NEW_CACHED_MESSAGE),
undefined,
"The new cached message is not visible anymore"
);

Просмотреть файл

@ -24,7 +24,7 @@ add_task(async function() {
}
);
const node = await waitFor(() => findMessage(hud, firstURL));
const node = await waitFor(() => findConsoleAPIMessage(hud, firstURL));
const [urlEl1, urlEl2] = Array.from(node.querySelectorAll("a.url"));
let onTabLoaded = BrowserTestUtils.waitForNewTab(gBrowser, firstURL, true);

Просмотреть файл

@ -12,7 +12,7 @@ add_task(async function() {
"Open the console and wait for the console.group message to be rendered"
);
const hud = await openNewTabAndConsole(TEST_URI);
await waitFor(() => findMessage(hud, "hello", ".startGroup"));
await waitFor(() => findConsoleAPIMessage(hud, "hello", ".startGroup"));
info("Refresh tab several times and check for correct message indentation");
for (let i = 0; i < 5; i++) {

Просмотреть файл

@ -13,7 +13,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const loggedString = "iframe added";
// Wait for the initial message to be displayed.
await waitFor(() => findMessage(hud, loggedString));
await waitFor(() => findConsoleAPIMessage(hud, loggedString));
ok(true, "The initial message is displayed in the console");
// Create a promise for the message logged after the reload.
const onMessage = waitForMessage(hud, loggedString);

Просмотреть файл

@ -25,7 +25,7 @@ add_task(async function() {
await onMessagesLogged;
info("Test a group at root level");
let node = findMessage(hud, "group-1");
let node = findConsoleAPIMessage(hud, "group-1");
testClass(node, "startGroup");
testIndent(node, 0);
await testGroupToggle({
@ -37,12 +37,12 @@ add_task(async function() {
});
info("Test a message in a 1 level deep group");
node = findMessage(hud, "log-1");
node = findConsoleAPIMessage(hud, "log-1");
testClass(node, "log");
testIndent(node, 1);
info("Test a group in a 1 level deep group");
node = findMessage(hud, "group-2");
node = findConsoleAPIMessage(hud, "group-2");
testClass(node, "startGroup");
testIndent(node, 1);
await testGroupToggle({
@ -54,24 +54,24 @@ add_task(async function() {
});
info("Test a message in a 2 level deep group");
node = findMessage(hud, "log-2");
node = findConsoleAPIMessage(hud, "log-2");
testClass(node, "log");
testIndent(node, 2);
info(
"Test a message in a 1 level deep group, after closing a 2 level deep group"
);
node = findMessage(hud, "log-3");
node = findConsoleAPIMessage(hud, "log-3");
testClass(node, "log");
testIndent(node, 1);
info("Test a message at root level, after closing all the groups");
node = findMessage(hud, "log-4");
node = findConsoleAPIMessage(hud, "log-4");
testClass(node, "log");
testIndent(node, 0);
info("Test a collapsed group at root level");
node = findMessage(hud, "group-3");
node = findConsoleAPIMessage(hud, "group-3");
testClass(node, "startGroupCollapsed");
testIndent(node, 0);
await testGroupToggle({
@ -93,7 +93,7 @@ add_task(async function() {
});
info("Test a message at root level, after closing a collapsed group");
node = findMessage(hud, "log-6");
node = findConsoleAPIMessage(hud, "log-6");
testClass(node, "log");
testIndent(node, 0);
const nodes = hud.ui.outputNode.querySelectorAll(".message");

Просмотреть файл

@ -16,8 +16,8 @@ add_task(async function() {
const outputScroller = hud.ui.outputScroller;
// Let's wait until the first message and the group are displayed.
await waitFor(() => findMessage(hud, "log-0"));
const groupMessage = await waitFor(() => findMessage(hud, "GROUP"));
await waitFor(() => findConsoleAPIMessage(hud, "log-0"));
const groupMessage = await waitFor(() => findConsoleAPIMessage(hud, "GROUP"));
is(hasVerticalOverflow(outputScroller), true, "output node overflows");
is(
@ -28,7 +28,7 @@ add_task(async function() {
info("Expand the group");
groupMessage.querySelector(".arrow").click();
await waitFor(() => findMessage(hud, "in group"));
await waitFor(() => findConsoleAPIMessage(hud, "in group"));
is(hasVerticalOverflow(outputScroller), true, "output node overflows");
is(

Просмотреть файл

@ -23,7 +23,7 @@ async function testWorkerMessage(directConnectionToWorkerThread = false) {
const hud = await openNewTabAndConsole(TEST_URI);
const cachedMessage = await waitFor(() =>
findMessage(hud, "initial-message-from-worker")
findConsoleAPIMessage(hud, "initial-message-from-worker")
);
ok(true, "We get the cached message from the worker");
@ -50,7 +50,9 @@ async function testWorkerMessage(directConnectionToWorkerThread = false) {
content.wrappedJSObject.logFromWorker("live-message");
});
const liveMessage = await waitFor(() => findMessage(hud, "log-from-worker"));
const liveMessage = await waitFor(() =>
findConsoleAPIMessage(hud, "log-from-worker")
);
ok(true, "We get the cached message from the worker");
ok(
@ -75,7 +77,7 @@ async function testWorkerMessage(directConnectionToWorkerThread = false) {
});
const symbolMessage = await waitFor(() =>
findMessage(hud, 'Symbol("logged-symbol-from-worker")')
findConsoleAPIMessage(hud, 'Symbol("logged-symbol-from-worker")')
);
ok(symbolMessage, "Symbol logged from worker is visible in the console");
}
@ -84,8 +86,8 @@ async function testWorkerMessage(directConnectionToWorkerThread = false) {
hud.ui.window.document.querySelector(".devtools-clear-icon").click();
await waitFor(
() =>
!findMessage(hud, "initial-message-from-worker") &&
!findMessage(hud, "log-from-worker")
!findConsoleAPIMessage(hud, "initial-message-from-worker") &&
!findConsoleAPIMessage(hud, "log-from-worker")
);
ok(true, "Messages were removed");
@ -104,12 +106,12 @@ async function testWorkerMessage(directConnectionToWorkerThread = false) {
await onSmokeMessage;
is(
findMessage(newHud, "initial-message-from-worker"),
findConsoleAPIMessage(newHud, "initial-message-from-worker"),
undefined,
"Message cache was cleared"
);
is(
findMessage(newHud, "log-from-worker"),
findConsoleAPIMessage(newHud, "log-from-worker"),
undefined,
"Live message were cleared as well"
);

Просмотреть файл

@ -19,7 +19,7 @@ add_task(async function consoleProfileWarningWithNewPerfPanel() {
});
await waitFor(
() => findMessage(hud, EXPECTED_WARNING),
() => findWarningMessage(hud, EXPECTED_WARNING),
"Wait until the warning about console.profile is displayed"
);
ok(true, "The expected warning was displayed.");

Просмотреть файл

@ -27,7 +27,7 @@ add_task(async function() {
for (const [input, output] of tests) {
execute(hud, input);
const message = await waitFor(
() => findMessage(hud, output, ".console-api"),
() => findConsoleAPIMessage(hud, output),
`Waiting for output for ${input}`
);

Просмотреть файл

@ -14,9 +14,9 @@ const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8><script>
add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
await waitFor(() => findMessage(hud, "trace"));
await waitFor(() => findConsoleAPIMessage(hud, "trace"));
ok(true, "console.trace() message is displayed in the console");
const messages = findMessages(hud, "console.trace()");
const messages = findConsoleAPIMessages(hud, "console.trace()");
is(messages.length, 4, "There are 4 console.trace() messages");
info("Wait until the stacktraces are displayed");

Просмотреть файл

@ -10,7 +10,7 @@ const TEST_URI =
add_task(async function testTraceMessages() {
const hud = await openNewTabAndConsole(TEST_URI);
const message = await waitFor(() => findMessage(hud, "foo1"));
const message = await waitFor(() => findConsoleAPIMessage(hud, "foo1"));
// Wait until stacktrace is displayed.
await waitFor(() => !!message.querySelector(".frames"));

Просмотреть файл

@ -67,7 +67,9 @@ async function testMessagesCopy(hud, timestamp) {
const newLineString = "\n";
info("Test copy menu item for the simple log");
let message = await waitFor(() => findMessage(hud, "simple text message"));
let message = await waitFor(() =>
findConsoleAPIMessage(hud, "simple text message")
);
let clipboardText = await copyMessageContent(hud, message);
ok(true, "Clipboard text was found and saved");
@ -90,7 +92,7 @@ async function testMessagesCopy(hud, timestamp) {
}
info("Test copy menu item for the console.trace message");
message = await waitFor(() => findMessage(hud, "console.trace"));
message = await waitFor(() => findConsoleAPIMessage(hud, "console.trace"));
// Wait for the stacktrace to be rendered.
await waitFor(() => message.querySelector(".frames"));
clipboardText = await copyMessageContent(hud, message);
@ -125,7 +127,7 @@ async function testMessagesCopy(hud, timestamp) {
);
info("Test copy menu item for the error message");
message = await waitFor(() => findMessage(hud, "Error:"));
message = await waitFor(() => findConsoleAPIMessage(hud, "Error:"));
// Wait for the stacktrace to be rendered.
await waitFor(() => message.querySelector(".frames"));
clipboardText = await copyMessageContent(hud, message);
@ -154,7 +156,7 @@ async function testMessagesCopy(hud, timestamp) {
);
info("Test copy menu item for the reference error message");
message = await waitFor(() => findMessage(hud, "ReferenceError:"));
message = await waitFor(() => findErrorMessage(hud, "ReferenceError:"));
clipboardText = await copyMessageContent(hud, message);
ok(true, "Clipboard text was found and saved");
lines = clipboardText.split(newLineString);
@ -185,7 +187,7 @@ async function testMessagesCopy(hud, timestamp) {
"The Learn More text wasn't put in the clipboard"
);
message = await waitFor(() => findMessage(hud, "repeated 2"));
message = await waitFor(() => findConsoleAPIMessage(hud, "repeated 2"));
clipboardText = await copyMessageContent(hud, message);
ok(true, "Clipboard text was found and saved");
}

Просмотреть файл

@ -26,7 +26,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const [msgWithText, msgWithObj, msgNested] = await waitFor(() =>
findMessages(hud, "foo")
findConsoleAPIMessages(hud, "foo")
);
ok(
msgWithText && msgWithObj && msgNested,

Просмотреть файл

@ -62,7 +62,9 @@ add_task(async function testExportToClipboard() {
info("Test export to clipboard ");
// Let's wait until we have all the logged messages.
const lastMessage = await waitFor(() => findMessage(hud, "item-99"));
const lastMessage = await waitFor(() =>
findConsoleAPIMessage(hud, "item-99")
);
const clipboardText = await exportAllToClipboard(hud, lastMessage);
ok(true, "Clipboard text was found and saved");

Просмотреть файл

@ -23,7 +23,9 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const message = await waitFor(() => findMessage(hud, "Object { a: 1 }"));
const message = await waitFor(() =>
findConsoleAPIMessage(hud, "Object { a: 1 }")
);
const [objectA, objectB] = message.querySelectorAll(
".object-inspector .objectBox-object"
);
@ -85,7 +87,7 @@ add_task(async function() {
ok(sidebarText.includes("b: 1"), "Sidebar contents shown for {b:1}");
info("Showing sidebar for Error object");
const errorMsg = findMessage(hud, "CustomServerError:");
const errorMsg = findConsoleAPIMessage(hud, "CustomServerError:");
await showSidebarWithContextMenu(hud, errorMsg, false);
sidebarContents = hud.ui.document.querySelector(".sidebar-contents");

Просмотреть файл

@ -24,7 +24,9 @@ add_task(async function() {
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
content.wrappedJSObject.console.log("simple text message");
});
let message = await waitFor(() => findMessage(hud, "simple text message"));
let message = await waitFor(() =>
findConsoleAPIMessage(hud, "simple text message")
);
ok(message, "Text log found in the console");
info("Open and check the context menu for the logged text message");
@ -40,7 +42,7 @@ add_task(async function() {
});
info("Open context menu for the link");
message = await waitFor(() => findMessage(hud, "Visit"));
message = await waitFor(() => findConsoleAPIMessage(hud, "Visit"));
const urlNode = message.querySelector("a.url");
menuPopup = await openContextMenu(hud, urlNode);
openUrlItem = menuPopup.querySelector("#console-menu-open-url");
@ -67,7 +69,7 @@ add_task(async function() {
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
content.wrappedJSObject.location.reload();
});
message = await waitFor(() => findMessage(hud, "test-console.html"));
message = await waitFor(() => findNetworkMessage(hud, "test-console.html"));
ok(message, "Network log found in the console");
info("Open and check the context menu for the logged network message");

Просмотреть файл

@ -26,8 +26,8 @@ const revealInInspectorMenuItemId = "#console-menu-open-node";
add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const msgWithText = await waitFor(() => findMessage(hud, `foo`));
const msgWithObj = await waitFor(() => findMessage(hud, `Object`));
const msgWithText = await waitFor(() => findConsoleAPIMessage(hud, `foo`));
const msgWithObj = await waitFor(() => findConsoleAPIMessage(hud, `Object`));
const nonDomEl = await waitFor(() =>
findMessage(hud, `<span>`, ".objectBox-node")
);

Просмотреть файл

@ -21,7 +21,7 @@ const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html><script>
add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const messages = await waitFor(() => findMessages(hud, "foo"));
const messages = await waitFor(() => findConsoleAPIMessages(hud, "foo"));
is(messages.length, 5, "Five messages should have appeared");
const [msgWithText, msgWithObj, msgNested, msgLongStr, msgSymbol] = messages;
let varIdx = 0;

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
await navigateTo(TEST_FILE);
await waitFor(() => findMessage(hud, EXPECTED_RESULT, ".message.warn"));
await waitFor(() => findWarningMessage(hud, EXPECTED_RESULT));
ok(
true,
`CSP logs displayed in console when using "reflected-xss" directive`

Просмотреть файл

@ -37,7 +37,7 @@ add_task(async function() {
const VIOLATION_LOCATION_JS = "test-csp-violation-inline.html:14:24";
await navigateTo(TEST_VIOLATION);
// Triggering the Violation via HTML
let msg = await waitFor(() => findMessage(hud, CSP_VIOLATION));
let msg = await waitFor(() => findErrorMessage(hud, CSP_VIOLATION));
let locationNode = msg.querySelector(".message-location");
info(`EXPECT ${VIOLATION_LOCATION_HTML} GOT: ${locationNode.textContent}`);
ok(
@ -67,7 +67,7 @@ add_task(async function() {
const CSP_VIOLATION = `Content Security Policy: The pages settings blocked the loading of a resource at https://evil.com/ (“base-uri”).`;
const VIOLATION_LOCATION = "test-csp-violation-base-uri.html:15:24";
await navigateTo(TEST_VIOLATION);
let msg = await waitFor(() => findMessage(hud, CSP_VIOLATION));
let msg = await waitFor(() => findErrorMessage(hud, CSP_VIOLATION));
ok(msg, "Base-URI validation was Printed");
// Triggering the Violation via JS
await clearOutput(hud);
@ -93,7 +93,7 @@ add_task(async function() {
const VIOLATION_LOCATION = "test-csp-violation-form-action.html:14:39";
await navigateTo(TEST_VIOLATION);
const msg = await waitFor(() => findMessage(hud, CSP_VIOLATION));
const msg = await waitFor(() => findErrorMessage(hud, CSP_VIOLATION));
const locationNode = msg.querySelector(".message-location");
info(`EXPECT ${VIOLATION_LOCATION} GOT: ${locationNode.textContent}`);
ok(
@ -111,7 +111,7 @@ add_task(async function() {
`Content Security Policy: The pages settings blocked` +
` the loading of a resource at ${TEST_VIOLATION} (“frame-ancestors”).`;
await navigateTo(TEST_VIOLATION);
const msg = await waitFor(() => findMessage(hud, CSP_VIOLATION));
const msg = await waitFor(() => findErrorMessage(hud, CSP_VIOLATION));
ok(msg, "Frame-Ancestors violation by html was printed");
}
});

Просмотреть файл

@ -48,7 +48,7 @@ add_task(async function() {
info("Check the CSS warning message for the top level document");
let messageNode = await waitFor(() =>
findMessage(hud, "Error in parsing value for cursor", ".message.css")
findWarningMessage(hud, "Error in parsing value for cursor", ".css")
);
info("Click on the expand arrow");
@ -88,7 +88,7 @@ add_task(async function() {
info("Check the CSS warning message for the third-party iframe");
messageNode = await waitFor(() =>
findMessage(hud, "Error in parsing value for color", ".message.css")
findWarningMessage(hud, "Error in parsing value for color", ".css")
);
info("Click on the expand arrow");

Просмотреть файл

@ -18,7 +18,7 @@ add_task(async function() {
}
const hud = await openNewTabAndConsole(TEST_URI);
await waitFor(() => findMessage(hud, "fooDuplicateError1", ".message.error"));
await waitFor(() => findErrorMessage(hud, "fooDuplicateError1"));
const errorMessages = hud.ui.outputNode.querySelectorAll(".message.error");
is(

Просмотреть файл

@ -18,7 +18,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
info("Wait for the error to be logged");
const msgNode = await waitFor(() => findMessage(hud, MESSAGE));
const msgNode = await waitFor(() => findConsoleAPIMessage(hud, MESSAGE));
ok(!msgNode.classList.contains("open"), `Error logged not expanded`);
const groupNode = await waitFor(() => msgNode.querySelector(".group"));

Просмотреть файл

@ -16,7 +16,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
info("Wait for the error to be logged");
const msgNode = await waitFor(() => findMessage(hud, MESSAGE));
const msgNode = await waitFor(() => findConsoleAPIMessage(hud, MESSAGE));
ok(msgNode, `Error logged`);
const errorNode = msgNode.querySelector(".objectBox-stackTrace");

Просмотреть файл

@ -20,6 +20,6 @@ add_task(async function() {
info("generate exception and wait for the message");
const msg = await waitFor(() => findMessage(hud, EXPECTED_REPORT));
const msg = await waitFor(() => findErrorMessage(hud, EXPECTED_REPORT));
ok(msg, `Message found: "${EXPECTED_REPORT}"`);
});

Просмотреть файл

@ -35,7 +35,7 @@ add_task(async function() {
const EXPECTED_MESSAGE = `get more information on this error`;
const msg = await waitFor(() => findMessage(hud, EXPECTED_MESSAGE));
const msg = await waitFor(() => findErrorMessage(hud, EXPECTED_MESSAGE));
ok(msg, `Link in error message are cropped as expected`);
const [comLink, orgLink] = Array.from(msg.querySelectorAll("a"));

Просмотреть файл

@ -48,7 +48,7 @@ add_task(async function() {
`Uncaught Object { fav: "eggplant" }`
);
info("Check that object in errors can be expanded");
const rejectedObjectMessage = findMessage(hud, "eggplant", ".error");
const rejectedObjectMessage = findErrorMessage(hud, "eggplant");
const oi = rejectedObjectMessage.querySelector(".tree");
ok(true, "The object was rendered in an ObjectInspector");
@ -78,7 +78,7 @@ add_task(async function() {
execute(hud, `1 + @`);
const messageNode = await waitFor(() =>
findMessage(hud, "illegal character U+0040")
findErrorMessage(hud, "illegal character U+0040")
);
is(
messageNode.querySelector(".frames"),

Просмотреть файл

@ -14,7 +14,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const toolbox = await gDevTools.getToolboxForTab(gBrowser.selectedTab);
let messageNode = await waitFor(() => findMessage(hud, "BAR"));
let messageNode = await waitFor(() => findErrorMessage(hud, "BAR"));
await clickFirstStackElement(hud, messageNode, true);
const dbg = toolbox.getPanel("jsdebugger");
@ -33,7 +33,7 @@ add_task(async function() {
await testOpenInDebugger(hud, toolbox, "BAZ", false);
// Test that stacks in console.trace() calls work.
messageNode = await waitFor(() => findMessage(hud, "TRACE"));
messageNode = await waitFor(() => findConsoleAPIMessage(hud, "TRACE"));
await clickFirstStackElement(hud, messageNode, false);
is(

Просмотреть файл

@ -66,8 +66,8 @@ add_task(async function() {
const lastSeason = SEASONS[SEASONS.length - 1];
await waitFor(
() =>
findMessage(hud, lastSeason.english) &&
findMessage(hud, lastSeason.chinese)
findConsoleAPIMessage(hud, lastSeason.english) &&
findConsoleAPIMessage(hud, lastSeason.chinese)
);
// One external Javascript file outputs every season name in English, and the

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const { outputNode } = hud.ui;
await waitFor(() => findMessage(hud, MESSAGES[5]), null, 200);
await waitFor(() => findConsoleAPIMessage(hud, MESSAGES[5]), null, 200);
let filteredNodes;
@ -89,7 +89,7 @@ add_task(async function() {
async function setFilterInput(hud, value, lastMessage) {
await setFilterState(hud, { text: value });
await waitFor(() => findMessage(hud, lastMessage), null, 200);
await waitFor(() => findConsoleAPIMessage(hud, lastMessage), null, 200);
}
function checkFilteredMessages(filteredNodes, expectedMessages, expectedCount) {

Просмотреть файл

@ -12,7 +12,9 @@ const TEST_URI =
add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
await waitFor(() => findMessage(hud, "[a]") && findMessage(hud, "[j]"));
await waitFor(
() => findConsoleAPIMessage(hud, "[a]") && findConsoleAPIMessage(hud, "[j]")
);
/*
* The output looks like the following:
@ -214,7 +216,7 @@ add_task(async function() {
text: "",
});
const subGroup = findMessage(hud, "[subgroup]");
const subGroup = findConsoleAPIMessage(hud, "[subgroup]");
toggleGroup(subGroup);
await setFilterState(hud, {

Просмотреть файл

@ -15,7 +15,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
await waitFor(
() => findMessage(hud, "hello world"),
() => findConsoleAPIMessage(hud, "hello world"),
"Wait for log message to be rendered"
);
ok(true, "Log message rendered");
@ -27,13 +27,13 @@ add_task(async function() {
// Wait for the navigation message to be displayed.
await waitFor(
() => findMessage(hud, "Navigated to"),
() => findMessageByType(hud, "Navigated to", ".navigationMarker"),
"Wait for navigation message to be rendered"
);
// Wait for 2 hellow world messages to be displayed.
await waitFor(
() => findMessages(hud, "hello world").length == 2,
() => findConsoleAPIMessages(hud, "hello world").length == 2,
"Wait for log message to be rendered after navigation"
);
@ -47,11 +47,11 @@ add_task(async function() {
});
await waitFor(
() => !findMessage(hud, "hello world"),
() => !findConsoleAPIMessage(hud, "hello world"),
"Wait for the log messages to be hidden"
);
ok(
findMessage(hud, "Navigated to"),
findMessageByType(hud, "Navigated to", ".navigationMarker"),
"The navigation marker is still visible"
);
@ -60,7 +60,7 @@ add_task(async function() {
await navigateTo(newUrl);
// Wait for the navigation message to be displayed.
await waitFor(
() => findMessage(hud, "Navigated to " + newUrl),
() => findMessageByType(hud, "Navigated to " + newUrl, ".navigationMarker"),
"Wait for example.net navigation message to be rendered"
);
ok(true, "Navigation message for example.net was displayed as expected");
@ -70,7 +70,7 @@ add_task(async function() {
await navigateTo(newUrl);
// Wait for the navigation message to be displayed.
await waitFor(
() => findMessage(hud, "Navigated to " + newUrl),
() => findMessageByType(hud, "Navigated to " + newUrl, ".navigationMarker"),
"Wait for example.com navigation message to be rendered"
);
ok(true, "Navigation message for example.com was displayed as expected");

Просмотреть файл

@ -17,7 +17,7 @@ add_task(async function() {
const outputContainer = ui.outputNode.querySelector(".webconsole-output");
info("Console should be scrolled to bottom on initial load from page logs");
await waitFor(() => findMessage(hud, "init-99"));
await waitFor(() => findConsoleAPIMessage(hud, "init-99"));
ok(hasVerticalOverflow(outputContainer), "There is a vertical overflow");
ok(
isScrolledToBottom(outputContainer),
@ -28,7 +28,7 @@ add_task(async function() {
"Filter out some messages and check that the scroll position is not impacted"
);
let onMessagesFiltered = waitFor(
() => !findMessage(hud, "init-0"),
() => !findConsoleAPIMessage(hud, "init-0"),
null,
200
);
@ -43,7 +43,7 @@ add_task(async function() {
"Clear the text filter and check that the scroll position is not impacted"
);
let onMessagesUnFiltered = waitFor(
() => findMessage(hud, "init-0"),
() => findConsoleAPIMessage(hud, "init-0"),
null,
200
);
@ -64,7 +64,7 @@ add_task(async function() {
await setFilterState(hud, { text: "init-9" });
onMessagesFiltered = waitFor(
async () => !findMessage(hud, "init-0"),
async () => !findConsoleAPIMessage(hud, "init-0"),
null,
200
);
@ -78,7 +78,11 @@ add_task(async function() {
info(
"Clear the text filter and check that the scroll position is not impacted"
);
onMessagesUnFiltered = waitFor(() => findMessage(hud, "init-0"), null, 200);
onMessagesUnFiltered = waitFor(
() => findConsoleAPIMessage(hud, "init-0"),
null,
200
);
await setFilterState(hud, { text: "" });
await onMessagesUnFiltered;
is(

Просмотреть файл

@ -25,8 +25,8 @@ add_task(async function() {
});
// Wait for the messages
await waitFor(() => findMessage(hud, "status=404", ".network.error"));
await waitFor(() => findMessage(hud, "status=500", ".network.error"));
await waitFor(() => findErrorMessage(hud, "status=404", ".network"));
await waitFor(() => findErrorMessage(hud, "status=500", ".network"));
// Check defaults.

Просмотреть файл

@ -32,7 +32,9 @@ add_task(async function() {
});
// Wait for the CSS warning to be displayed so we don't have a pending promise.
await waitFor(() => findMessage(hud, "Expected color but found blouge"));
await waitFor(() =>
findWarningMessage(hud, "Expected color but found blouge")
);
info("Close and re-open the console");
await closeTabAndToolbox();
@ -45,7 +47,9 @@ add_task(async function() {
});
// Wait for the CSS warning to be displayed so we don't have a pending promise.
await waitFor(() => findMessage(hud, "Expected color but found blouge"));
await waitFor(() =>
findWarningMessage(hud, "Expected color but found blouge")
);
// Check that the ui settings were persisted.
await closeTabAndToolbox();

Просмотреть файл

@ -29,11 +29,11 @@ add_task(async function() {
await reloadBrowser({ browser: tab1.linkedBrowser });
info("Waiting for messages");
await waitFor(() => findMessage(hud1, TEST_IFRAME_URI, ".message.network"));
await waitFor(() => findMessageByType(hud1, TEST_IFRAME_URI, ".network"));
const hud2 = await openConsole(tab2);
is(
findMessage(hud2, TEST_IFRAME_URI),
findMessageByType(hud2, TEST_IFRAME_URI, ".network"),
undefined,
"iframe network request is not displayed in tab2"
);

Просмотреть файл

@ -44,11 +44,7 @@ async function testWarningMessageVisibility(uri, visible) {
});
await onSentinelMessage;
const warning = findMessage(
hud,
INEFFECTIVE_IFRAME_SANDBOXING_MSG,
".message.warn"
);
const warning = findWarningMessage(hud, INEFFECTIVE_IFRAME_SANDBOXING_MSG);
is(
!!warning,
visible,

Просмотреть файл

@ -32,7 +32,9 @@ add_task(async function() {
SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
content.wrappedJSObject.console.log("console message 2");
});
const msg = await waitFor(() => findMessage(hud, "console message 2"));
const msg = await waitFor(() =>
findConsoleAPIMessage(hud, "console message 2")
);
ok(isInputFocused(hud), "input node is focused, first time");
// Checking that there's still a selection in the input

Просмотреть файл

@ -17,10 +17,6 @@ const INSECURE_PASSWORD_MSG =
add_task(async function() {
await pushPref("dom.security.https_first", false);
const hud = await openNewTabAndConsole(TEST_URI);
await waitFor(
() => findMessage(hud, INSECURE_PASSWORD_MSG, ".message.warn"),
"",
100
);
await waitFor(() => findWarningMessage(hud, INSECURE_PASSWORD_MSG), "", 100);
ok(true, "Insecure password error displayed successfully");
});

Просмотреть файл

@ -42,9 +42,7 @@ add_task(async function() {
async function testUriWarningMessage(uri, warningMessage) {
const hud = await openNewTabAndConsole(uri);
const message = await waitFor(() =>
findMessage(hud, warningMessage, ".message.warn")
);
const message = await waitFor(() => findWarningMessage(hud, warningMessage));
ok(message, "Warning message displayed successfully");
await testLearnMoreLinkClick(message, INSECURE_PASSWORDS_URI);
}

Просмотреть файл

@ -24,7 +24,7 @@ add_task(async function() {
// is being switched, so here we directly open the "real" test URI. See Bug 1614291.
hud = await openNewTabAndConsole(TEST_URI);
info("Wait for the 'foobar' message to be logged by the frame");
node = await waitFor(() => findMessage(hud, "foobar"));
node = await waitFor(() => findConsoleAPIMessage(hud, "foobar"));
} else {
hud = await openNewTabAndConsole(
"data:text/html;charset=utf8,<!DOCTYPE html><p>hello"

Просмотреть файл

@ -18,7 +18,7 @@ add_task(async function() {
info("Web Console opened");
const outputScroller = hud.ui.outputScroller;
await waitFor(
() => findMessage(hud, "console message 100"),
() => findConsoleAPIMessage(hud, "console message 100"),
"waiting for all the messages to be displayed",
100,
1000

Просмотреть файл

@ -27,7 +27,7 @@ add_task(async function() {
async function testViewSource(hud, toolbox, text) {
info(`Testing message with text "${text}"`);
const messageNode = await waitFor(
() => findMessage(hud, text),
() => findWarningMessage(hud, text),
`couldn't find message containing "${text}"`
);
const messageLocationNode = messageNode.querySelector(".message-location");

Просмотреть файл

@ -14,7 +14,7 @@ add_task(async function() {
toolbox.target.logErrorInPage("beware the octopus", "content javascript");
const node = await waitFor(() => findMessage(hud, "octopus"));
const node = await waitFor(() => findErrorMessage(hud, "octopus"));
ok(node, "text is displayed in web console");
ok(node.classList.contains("error"), "the log represents an error");
});

Просмотреть файл

@ -14,7 +14,7 @@ add_task(async function() {
toolbox.target.logWarningInPage("beware the octopus", "content javascript");
const node = await waitFor(() => findMessage(hud, "octopus"));
const node = await waitFor(() => findWarningMessage(hud, "octopus"));
ok(node, "text is displayed in web console");
ok(node.classList.contains("warn"), "the log represents a warning");
});

Просмотреть файл

@ -27,7 +27,7 @@ add_task(async function() {
info("wait for long string expansion");
const onLongStringFullTextDisplayed = waitFor(() =>
findMessage(hud, LONGSTRING)
findConsoleAPIMessage(hud, LONGSTRING)
);
arrow.click();
await onLongStringFullTextDisplayed;
@ -35,7 +35,9 @@ add_task(async function() {
ok(true, "The full text of the longString is displayed");
info("wait for long string collapse");
const onLongStringCollapsed = waitFor(() => !findMessage(hud, LONGSTRING));
const onLongStringCollapsed = waitFor(
() => !findConsoleAPIMessage(hud, LONGSTRING)
);
arrow.click();
await onLongStringCollapsed;

Просмотреть файл

@ -18,7 +18,9 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
// Retrieve the logged message.
const message = await waitFor(() => findMessage(hud, "Test message"));
const message = await waitFor(() =>
findConsoleAPIMessage(hud, "Test message")
);
// Wait until the SVGAnimatedString is expanded.
await waitFor(() => message.querySelectorAll(".arrow").length > 1);
@ -28,7 +30,7 @@ add_task(async function() {
info("wait for long string expansion");
const onLongStringFullTextDisplayed = waitFor(() =>
findMessage(hud, LONGSTRING)
findConsoleAPIMessage(hud, LONGSTRING)
);
arrow.click();
await onLongStringFullTextDisplayed;
@ -36,7 +38,9 @@ add_task(async function() {
ok(true, "The full text of the longString is displayed");
info("wait for long string collapse");
const onLongStringCollapsed = waitFor(() => !findMessage(hud, LONGSTRING));
const onLongStringCollapsed = waitFor(
() => !findConsoleAPIMessage(hud, LONGSTRING)
);
arrow.click();
await onLongStringCollapsed;

Просмотреть файл

@ -11,6 +11,6 @@ const TEST_URI = `data:text/html,<!DOCTYPE html><link rel="stylesheet" href="${C
add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const MSG = `The stylesheet ${CSS_URI} was not loaded because its MIME type, “text/bogus”, is not “text/css”`;
await waitFor(() => findMessage(hud, MSG, ".message.error"), "", 100);
await waitFor(() => findErrorMessage(hud, MSG), "", 100);
ok(true, "MIME type error displayed");
});

Просмотреть файл

@ -41,7 +41,9 @@ add_task(async function task() {
const { hud } = await toolbox.selectTool("webconsole");
const xhrUrl = TEST_PATH + "test-data.json";
const messageNode = await waitFor(() => findMessage(hud, xhrUrl));
const messageNode = await waitFor(() =>
findMessageByType(hud, xhrUrl, ".network")
);
const urlNode = messageNode.querySelector(".url");
info("Network message found.");

Просмотреть файл

@ -19,7 +19,9 @@ add_task(async function() {
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
content.wrappedJSObject.location.reload();
});
const message = await waitFor(() => findMessage(hud, "test-console.html"));
const message = await waitFor(() =>
findMessageByType(hud, "test-console.html", ".network")
);
ok(message, "Network log found in the console");
const currentTab = gBrowser.selectedTab;

Просмотреть файл

@ -28,7 +28,9 @@ add_task(async function task() {
await navigateTo(documentUrl);
info("Document loaded.");
const message = await waitFor(() => findMessage(hud, documentUrl));
const message = await waitFor(() =>
findMessageByType(hud, documentUrl, ".network")
);
const menuPopup = await openContextMenu(hud, message);
const openResendRequestMenuItem = menuPopup.querySelector(
@ -38,7 +40,9 @@ add_task(async function task() {
// Wait for message containing the resent request url
openResendRequestMenuItem.click();
await waitFor(() => findMessages(hud, documentUrl).length === 2);
await waitFor(
() => findMessagesByType(hud, documentUrl, ".network").length === 2
);
ok(true, "The resent request url is correct.");
});

Просмотреть файл

@ -39,7 +39,9 @@ add_task(async function task() {
await onNetworkMessageUpdate;
const xhrUrl = TEST_PATH + "test-data.json";
const messageNode = await waitFor(() => findMessage(hud, xhrUrl, ".network"));
const messageNode = await waitFor(() =>
findMessageByType(hud, xhrUrl, ".network")
);
ok(!!messageNode, "Network message found.");
const statusCodeNode = await waitFor(() =>

Просмотреть файл

@ -34,7 +34,7 @@ add_task(async function() {
content.wrappedJSObject.logNode("h1");
});
const msg = await waitFor(() => findMessage(hud, "<h1>"));
const msg = await waitFor(() => findConsoleAPIMessage(hud, "<h1>"));
const node = msg.querySelector(".objectBox-node");
ok(node !== null, "Node was logged as expected");
const view = node.ownerDocument.defaultView;

Просмотреть файл

@ -34,7 +34,7 @@ add_task(async function() {
content.wrappedJSObject.logNode("h1");
});
const msg = await waitFor(() => findMessage(hud, "<h1>"));
const msg = await waitFor(() => findConsoleAPIMessage(hud, "<h1>"));
const node = msg.querySelector(".objectBox-node");
ok(node !== null, "Node was logged as expected");

Просмотреть файл

@ -15,10 +15,6 @@ const MIME_WARNING_MSG =
add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
await waitFor(
() => findMessage(hud, MIME_WARNING_MSG, ".message.warn"),
"",
100
);
await waitFor(() => findWarningMessage(hud, MIME_WARNING_MSG), "", 100);
ok(true, "MIME type warning displayed");
});

Просмотреть файл

@ -20,15 +20,7 @@ const MIME_ERROR_MSG2 = `Loading script from “${JS_URI}” with importScripts(
add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
await waitFor(
() => findMessage(hud, MIME_ERROR_MSG1, ".message.error"),
"",
100
);
await waitFor(
() => findMessage(hud, MIME_ERROR_MSG2, ".message.error"),
"",
100
);
await waitFor(() => findErrorMessage(hud, MIME_ERROR_MSG1), "", 100);
await waitFor(() => findErrorMessage(hud, MIME_ERROR_MSG2), "", 100);
ok(true, "MIME type error displayed");
});

Просмотреть файл

@ -23,10 +23,9 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI_QUIRKY_DOCTYPE);
const quirkyDocTypeMessage = await waitFor(() =>
findMessage(
findWarningMessage(
hud,
`This page is in Quirks Mode. Page layout may be impacted. For Standards Mode use “<!DOCTYPE html>”`,
".message.warn"
`This page is in Quirks Mode. Page layout may be impacted. For Standards Mode use “<!DOCTYPE html>”`
)
);
ok(!!quirkyDocTypeMessage, "Quirky doctype warning message is visible");
@ -50,10 +49,9 @@ add_task(async function() {
await navigateTo(TEST_URI_ALMOST_STANDARD_DOCTYPE);
const almostStandardDocTypeMessage = await waitFor(() =>
findMessage(
findWarningMessage(
hud,
`This page is in Almost Standards Mode. Page layout may be impacted. For Standards Mode use “<!DOCTYPE html>”`,
".message.warn"
`This page is in Almost Standards Mode. Page layout may be impacted. For Standards Mode use “<!DOCTYPE html>”`
)
);
ok(
@ -80,10 +78,9 @@ add_task(async function() {
await navigateTo(TEST_URI_NO_DOCTYPE);
const noDocTypeMessage = await waitFor(() =>
findMessage(
findWarningMessage(
hud,
`This page is in Quirks Mode. Page layout may be impacted. For Standards Mode use “<!DOCTYPE html>”`,
".message.warn"
`This page is in Quirks Mode. Page layout may be impacted. For Standards Mode use “<!DOCTYPE html>”`
)
);
ok(!!noDocTypeMessage, "No doctype warning message is visible");
@ -106,7 +103,7 @@ add_task(async function() {
info("Wait for a bit to make sure there is no doctype messages");
await wait(1000);
ok(
!findMessage(hud, `doctype`, ".message.warn"),
!findWarningMessage(hud, `doctype`),
"There is no doctype warning message"
);

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const message = findMessage(hud, "Object");
const message = findConsoleAPIMessage(hud, "Object");
const object = message.querySelector(".object-inspector .objectBox-object");
info("Ctrl+click on an object to put it in the sidebar");

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const message = await waitFor(() => findMessage(hud, "Object"));
const message = await waitFor(() => findConsoleAPIMessage(hud, "Object"));
const object = message.querySelector(".object-inspector .objectBox-object");
const onSideBarVisible = waitFor(() =>

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function() {
});
});
const node = await waitFor(() => findMessage(hud, "oi-test"));
const node = await waitFor(() => findConsoleAPIMessage(hud, "oi-test"));
const objectInspectors = [...node.querySelectorAll(".tree")];
is(
objectInspectors.length,

Просмотреть файл

@ -19,7 +19,7 @@ add_task(async function() {
content.wrappedJSObject.console.log("oi-test", obj);
});
const node = await waitFor(() => findMessage(hud, "oi-test"));
const node = await waitFor(() => findConsoleAPIMessage(hud, "oi-test"));
const objectInspector = node.querySelector(".tree");
ok(objectInspector, "Object is printed in the console");

Просмотреть файл

@ -27,7 +27,9 @@ add_task(async function() {
);
});
const node = await waitFor(() => findMessage(hud, "oi-entries-test"));
const node = await waitFor(() =>
findConsoleAPIMessage(hud, "oi-entries-test")
);
const objectInspectors = [...node.querySelectorAll(".tree")];
is(
objectInspectors.length,

Просмотреть файл

@ -82,7 +82,7 @@ add_task(async function() {
);
});
const node = await waitFor(() => findMessage(hud, "oi-test"));
const node = await waitFor(() => findConsoleAPIMessage(hud, "oi-test"));
const oi = node.querySelector(".tree");
expandObjectInspectorNode(oi);

Просмотреть файл

@ -43,7 +43,7 @@ add_task(async function() {
content.wrappedJSObject.console.log("oi-test", a, b, c, d);
});
const node = await waitFor(() => findMessage(hud, "oi-test"));
const node = await waitFor(() => findConsoleAPIMessage(hud, "oi-test"));
const [a, b, c, d] = node.querySelectorAll(".tree");
await testObject(a, {

Просмотреть файл

@ -39,7 +39,7 @@ add_task(async function() {
content.wrappedJSObject.console.log("oi-test", a, b);
});
const node = await waitFor(() => findMessage(hud, "oi-test"));
const node = await waitFor(() => findConsoleAPIMessage(hud, "oi-test"));
const [a, b] = node.querySelectorAll(".tree");
await testObject(a, [null, "[B]", "[C]"]);

Просмотреть файл

@ -27,13 +27,15 @@ async function logMessages(hud) {
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
content.console.log("localStorage", content.localStorage);
});
const localStorageMsg = await waitFor(() => findMessage(hud, "localStorage"));
const localStorageMsg = await waitFor(() =>
findConsoleAPIMessage(hud, "localStorage")
);
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
content.console.log("sessionStorage", content.sessionStorage);
});
const sessionStorageMsg = await waitFor(() =>
findMessage(hud, "sessionStorage")
findConsoleAPIMessage(hud, "sessionStorage")
);
return [localStorageMsg, sessionStorageMsg];

Просмотреть файл

@ -22,7 +22,7 @@ add_task(async function testExpandNestedPromise() {
content.wrappedJSObject.console.log("oi-test", nestedPromise);
});
const node = await waitFor(() => findMessage(hud, "oi-test"));
const node = await waitFor(() => findConsoleAPIMessage(hud, "oi-test"));
const oi = node.querySelector(".tree");
const [promiseNode] = getObjectInspectorNodes(oi);
@ -54,7 +54,7 @@ add_task(async function testExpandCyclicPromise() {
content.wrappedJSObject.console.log("oi-test", cyclicPromise);
});
const node = await waitFor(() => findMessage(hud, "oi-test"));
const node = await waitFor(() => findConsoleAPIMessage(hud, "oi-test"));
const oi = node.querySelector(".tree");
const [promiseNode] = getObjectInspectorNodes(oi);

Просмотреть файл

@ -19,7 +19,7 @@ add_task(async function() {
content.wrappedJSObject.console.log("oi-test", proxy);
});
const node = await waitFor(() => findMessage(hud, "oi-test"));
const node = await waitFor(() => findConsoleAPIMessage(hud, "oi-test"));
const oi = node.querySelector(".tree");
const [proxyNode] = getObjectInspectorNodes(oi);

Просмотреть файл

@ -47,7 +47,9 @@ add_task(async function() {
);
});
const node = await waitFor(() => findMessage(hud, "private-properties-test"));
const node = await waitFor(() =>
findConsoleAPIMessage(hud, "private-properties-test")
);
const objectInspectors = [...node.querySelectorAll(".tree")];
is(
objectInspectors.length,

Просмотреть файл

@ -17,7 +17,7 @@ add_task(async function() {
);
});
const node = await waitFor(() => findMessage(hud, "oi-test"));
const node = await waitFor(() => findConsoleAPIMessage(hud, "oi-test"));
const objectInspector = node.querySelector(".tree");
let onOiMutation = waitForNodeMutation(objectInspector, {

Просмотреть файл

@ -22,7 +22,9 @@ add_task(async function() {
});
});
const node = await waitFor(() => findMessage(hud, "oi-symbols-test"));
const node = await waitFor(() =>
findConsoleAPIMessage(hud, "oi-symbols-test")
);
const objectInspectors = [...node.querySelectorAll(".tree")];
is(
objectInspectors.length,

Просмотреть файл

@ -24,11 +24,11 @@ add_task(async function() {
// Console messages are batched by the Resource watcher API and might be rendered after
// the result message.
const logMessages = await waitFor(() => {
const messages = findMessages(hud, "item-", ".log.message:not(.command)");
const messages = findConsoleAPIMessages(hud, "item-", ".log");
return messages.length === 5 ? messages : null;
});
const commandMessage = findMessage(hud, "", ".command");
const commandMessage = findMessageByType(hud, "", ".command");
is(
commandMessage.nextElementSibling,
logMessages[0],

Просмотреть файл

@ -55,7 +55,7 @@ add_task(async function() {
for (const expectedError of expectedErrors) {
const message = await waitFor(
() => findMessage(hud, expectedError, ".error"),
() => findErrorMessage(hud, expectedError),
`Couldn't find «${expectedError}» message`
);
ok(message, `Found «${expectedError}» message`);
@ -93,10 +93,9 @@ add_task(async function() {
ok(true, "All expected messages were found");
info("Check that object in errors can be expanded");
const rejectedObjectMessage = findMessage(
const rejectedObjectMessage = findErrorMessage(
hud,
`Uncaught (in promise) Object { fav: "eggplant" }`,
".error"
`Uncaught (in promise) Object { fav: "eggplant" }`
);
const oi = rejectedObjectMessage.querySelector(".tree");
ok(true, "The object was rendered in an ObjectInspector");

Просмотреть файл

@ -39,7 +39,7 @@ add_task(async function() {
async function waitForError(hud) {
info("Wait for error message");
await waitFor(() => findMessage(hud, "fooBug597756_error", ".message.error"));
await waitFor(() => findErrorMessage(hud, "fooBug597756_error"));
ok(true, "error message displayed");
}

Просмотреть файл

@ -81,7 +81,7 @@ add_task(async function() {
async function checkErrorMessage(text) {
const message = await waitFor(
() => findMessage(hud, text, ".message.error"),
() => findErrorMessage(hud, text),
undefined,
100
);

Просмотреть файл

@ -29,7 +29,7 @@ add_task(async function() {
info("Open the console");
const hud = await openConsole(tab);
await waitFor(
() => findMessage(hud, "Cached message"),
() => findConsoleAPIMessage(hud, "Cached message"),
"Cached message isn't displayed in the console output"
);
ok(true, "Cached message is displayed in the console");
@ -40,7 +40,7 @@ add_task(async function() {
});
await waitFor(
() => findMessage(hud, "Live message"),
() => findConsoleAPIMessage(hud, "Live message"),
"Live message isn't displayed in the console output"
);
ok(true, "Live message is displayed in the console");

Просмотреть файл

@ -27,7 +27,10 @@ add_task(async function() {
// load second url
await navigateTo(TEST_URI2);
ok(!findMessage(hud, "Permission denied"), "no permission denied errors");
ok(
!findErrorMessage(hud, "Permission denied"),
"no permission denied errors"
);
info("wait for window.location.href after page navigation");
await clearOutput(hud);
@ -38,7 +41,10 @@ add_task(async function() {
".result"
);
ok(!findMessage(hud, "Permission denied"), "no permission denied errors");
ok(
!findErrorMessage(hud, "Permission denied"),
"no permission denied errors"
);
// Navigation clears messages. Wait for that clear to happen before
// continuing the test or it might destroy messages we wait later on (Bug
@ -61,5 +67,8 @@ add_task(async function() {
".result"
);
ok(!findMessage(hud, "Permission denied"), "no permission denied errors");
ok(
!findErrorMessage(hud, "Permission denied"),
"no permission denied errors"
);
});

Просмотреть файл

@ -18,12 +18,14 @@ const TestData = [
jsmsg: "JSMSG_READ_ONLY",
script:
"'use strict'; (Object.freeze({name: 'Elsa', score: 157})).score = 0;",
selector: ".error",
isException: true,
expected: 'TypeError: "score" is read-only',
},
{
jsmsg: "JSMSG_STMT_AFTER_RETURN",
script: "function a() { return; 1 + 1; };",
selector: ".warn",
isException: false,
expected: "unreachable code after return statement",
},
@ -47,7 +49,9 @@ async function testScriptError(hud, testData) {
const msg = "the expected error message was displayed";
info(`waiting for ${msg} to be displayed`);
await waitFor(() => findMessage(hud, testData.expected));
await waitFor(() =>
findMessageByType(hud, testData.expected, testData.selector)
);
ok(true, msg);
// grab the most current error doc URL.

Просмотреть файл

@ -23,7 +23,7 @@ add_task(async function() {
const outputContainer = ui.outputNode.querySelector(".webconsole-output");
info("Console should be scrolled to bottom on initial load from page logs");
await waitFor(() => findMessage(hud, "init-100"));
await waitFor(() => findConsoleAPIMessage(hud, "init-100"));
ok(hasVerticalOverflow(outputContainer), "There is a vertical overflow");
ok(
isScrolledToBottom(outputContainer),
@ -40,7 +40,7 @@ add_task(async function() {
await reloadBrowser();
info("Console should be scrolled to bottom after refresh from page logs");
await waitFor(() => findMessage(hud, "init-100"));
await waitFor(() => findConsoleAPIMessage(hud, "init-100"));
ok(hasVerticalOverflow(outputContainer), "There is a vertical overflow");
ok(
isScrolledToBottom(outputContainer),
@ -357,7 +357,9 @@ function isScrolledToBottom(container) {
// LazyMessageList are disregarded.
function allTraceMessagesAreExpanded(hud) {
return (
findMessage(hud, "trace in C 100") &&
findMessages(hud, "trace in C").every(m => m.querySelector(".frames"))
findConsoleAPIMessage(hud, "trace in C 100") &&
findConsoleAPIMessages(hud, "trace in C").every(m =>
m.querySelector(".frames")
)
);
}

Просмотреть файл

@ -17,7 +17,7 @@ add_task(async function() {
await clearOutput(hud);
await navigateTo(TEST_DOC);
await waitFor(() => findMessage(hud, SAMPLE_MSG, ".message.warn"));
await waitFor(() => findWarningMessage(hud, SAMPLE_MSG));
ok(true, "non-toplevel security warning message was displayed");
});

Просмотреть файл

@ -41,7 +41,7 @@ add_task(async function() {
// We can't use `waitForMessages` here because the `new-messages` event
// can be emitted before we get the `hud`.
await waitFor(() => findMessage(hud, TEST_PATH));
await waitFor(() => findMessageByType(hud, TEST_PATH, ".network"));
ok(true, "The network message was found in the console");
});

Просмотреть файл

@ -19,7 +19,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const message = await waitFor(() => findMessage(hud, "Object"));
const message = await waitFor(() => findConsoleAPIMessage(hud, "Object"));
const object = message.querySelector(".object-inspector .objectBox-object");
const sidebar = await showSidebarWithContextMenu(hud, object, true);
@ -42,7 +42,7 @@ add_task(async function() {
});
await onMessage;
ok(!findMessage(hud, "Object"), "Message with object was pruned");
ok(!findConsoleAPIMessage(hud, "Object"), "Message with object was pruned");
info("Expand the 'c' node in the sidebar");
// Here's what the object in the sidebar looks like:

Просмотреть файл

@ -32,7 +32,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(PAGE_URL);
info("Waiting for css warning");
const node = await waitFor(() => findMessage(hud, "octopus"));
const node = await waitFor(() => findWarningMessage(hud, "octopus"));
ok(!!node, "css warning seen");
info("Waiting for source map to be applied");

Просмотреть файл

@ -15,10 +15,12 @@ add_task(async function() {
]) {
const hud = await openNewTabAndConsole(BASE + test);
const node = await waitFor(() => findMessage(hud, "here"));
const node = await waitFor(() => findConsoleAPIMessage(hud, "here"));
ok(node, "logged text is displayed in web console");
const node2 = await waitFor(() => findMessage(hud, "Source map error"));
const node2 = await waitFor(() =>
findWarningMessage(hud, "Source map error")
);
ok(node2, "source map error is displayed in web console");
}
});

Просмотреть файл

@ -27,6 +27,6 @@ add_task(async function() {
const hud = await openNewTabAndConsole(PAGE_URL);
const node = await waitFor(() => findMessage(hud, "Source map error"));
const node = await waitFor(() => findWarningMessage(hud, "Source map error"));
ok(node, "source map error is displayed in web console");
});

Просмотреть файл

@ -30,7 +30,7 @@ add_task(async function() {
info('Finding "here" message and waiting for source map to be applied');
await waitFor(() => {
const node = findMessage(hud, "here");
const node = findConsoleAPIMessage(hud, "here");
if (!node) {
return false;
}
@ -44,7 +44,7 @@ add_task(async function() {
info("Selecting the console again");
await toolbox.selectTool("webconsole");
const node = await waitFor(() => findMessage(hud, "original source"));
const node = await waitFor(() => findWarningMessage(hud, "original source"));
ok(node, "source map error is displayed in web console");
ok(

Просмотреть файл

@ -26,7 +26,7 @@ add_task(async function() {
async function testOpenInDebugger(hud, toolbox, text) {
info(`Testing message with text "${text}"`);
const messageNode = await waitFor(() => findMessage(hud, text));
const messageNode = await waitFor(() => findConsoleAPIMessage(hud, text));
const framesNode = await waitFor(() => messageNode.querySelector(".frames"));
const frameNodes = framesNode.querySelectorAll(".frame");

Просмотреть файл

@ -30,7 +30,7 @@ add_task(async function() {
});
async function waitForError(hud, text) {
await waitFor(() => findMessage(hud, text, ".message.error"));
await waitFor(() => findErrorMessage(hud, text));
ok(true, "Received expected error message");
}

Просмотреть файл

@ -15,13 +15,13 @@ add_task(async function() {
info(
"Check that the error message is logged in telemetry with the expected key"
);
await waitFor(() => findMessage(hud, "is not a function"));
await waitFor(() => findErrorMessage(hud, "is not a function"));
checkErrorDisplayedTelemetry("JSMSG_NOT_FUNCTION", 1);
await reloadBrowser();
info("Reloading the page (and having the same error) increments the sum");
await waitFor(() => findMessage(hud, "is not a function"));
await waitFor(() => findErrorMessage(hud, "is not a function"));
checkErrorDisplayedTelemetry("JSMSG_NOT_FUNCTION", 2);
info(

Просмотреть файл

@ -22,7 +22,9 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const message = await waitFor(() => findMessage(hud, "test message"));
const message = await waitFor(() =>
findConsoleAPIMessage(hud, "test message")
);
info("Click on the 'jump to definition' button");
const jumpIcon = message.querySelector(".jump-definition");
jumpIcon.click();

Просмотреть файл

@ -21,7 +21,9 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const message = await waitFor(() => findMessage(hud, "test message"));
const message = await waitFor(() =>
findConsoleAPIMessage(hud, "test message")
);
info("Click on the arrow icon to expand the node");
const arrowIcon = message.querySelector(".arrow");

Просмотреть файл

@ -27,7 +27,9 @@ add_task(async function() {
// printed to the console
const hud1 = await openNewTabAndConsole(TEST_URI);
const aTimerCompleted = await waitFor(() => findMessage(hud1, "aTimer: "));
const aTimerCompleted = await waitFor(() =>
findConsoleAPIMessage(hud1, "aTimer: ")
);
ok(
aTimerCompleted.textContent.includes("- timer ended"),
"Calling " + "console.time('a') and console.timeEnd('a')ends the 'a' timer"
@ -40,7 +42,7 @@ add_task(async function() {
const hud2 = await openNewTabAndConsole(TEST_URI2);
const error1 = await waitFor(() =>
findMessage(hud2, "bTimer", ".message.timeEnd.warn")
findWarningMessage(hud2, "bTimer", ".timeEnd")
);
ok(
error1,
@ -58,10 +60,10 @@ add_task(async function() {
// We use this await to 'sync' until the message appears, as the console API
// guarantees us that the smoke signal will be printed after the message for
// console.time("bTimer") (if there were any)
await waitFor(() => findMessage(hud2, "smoke signal"));
await waitFor(() => findConsoleAPIMessage(hud2, "smoke signal"));
is(
findMessage(hud2, "bTimer started"),
findConsoleAPIMessage(hud2, "bTimer started"),
undefined,
"No message is printed to " + "the console when the timer starts"
);
@ -75,7 +77,7 @@ add_task(async function() {
await navigateTo(TEST_URI4);
const error2 = await waitFor(() =>
findMessage(hud2, "bTimer", ".message.timeEnd.warn")
findWarningMessage(hud2, "bTimer", ".timeEnd")
);
ok(
error2,

Просмотреть файл

@ -60,7 +60,7 @@ add_task(async function testContentBlockingMessage() {
info("Test content blocking message");
const message = await waitFor(() =>
findMessage(
findWarningMessage(
hud,
`The resource at \u201chttps://tracking.example.com/\u201d was blocked because ` +
`content blocking is enabled`
@ -84,7 +84,7 @@ add_task(async function testForeignCookieBlockedMessage() {
await pushPref(COOKIE_BEHAVIOR_PREF, COOKIE_BEHAVIORS.REJECT_FOREIGN);
const { hud, win } = await openNewWindowAndConsole(TEST_URI);
const message = await waitFor(() =>
findMessage(
findWarningMessage(
hud,
`Request to access cookie or storage on ${BLOCKED_URL} was blocked because we are ` +
`blocking all third-party storage access requests and content blocking is enabled`
@ -112,7 +112,7 @@ add_task(async function testLimitForeignCookieBlockedMessage() {
const message = await waitFor(
() =>
findMessage(
findWarningMessage(
hud,
`Request to access cookie or storage on ${BLOCKED_URL} was blocked because we are ` +
`blocking all third-party storage access requests and content blocking is enabled`
@ -140,7 +140,7 @@ add_task(async function testAllCookieBlockedMessage() {
const { hud, win } = await openNewWindowAndConsole(TEST_URI);
const message = await waitFor(() =>
findMessage(
findWarningMessage(
hud,
`Request to access cookie or storage on ${BLOCKED_URL} was blocked because we are ` +
`blocking all storage access requests`
@ -163,7 +163,7 @@ add_task(async function testTrackerCookieBlockedMessage() {
const { hud, win } = await openNewWindowAndConsole(TEST_URI);
const message = await waitFor(() =>
findMessage(
findWarningMessage(
hud,
`Request to access cookie or storage on ${BLOCKED_URL} was blocked because it came ` +
`from a tracker and content blocking is enabled`
@ -186,7 +186,7 @@ add_task(async function testForeignCookiePartitionedMessage() {
const { hud, win } = await openNewWindowAndConsole(TEST_URI_THIRD_PARTY_ONLY);
const message = await waitFor(() =>
findMessage(
findWarningMessage(
hud,
`Partitioned cookie or storage access was provided to ${PARTITIONED_URL} because it is ` +
`loaded in the third-party context and dynamic state partitioning is enabled.`
@ -217,7 +217,7 @@ add_task(async function testCookieBlockedByPermissionMessage() {
const { hud, win } = await openNewWindowAndConsole(TEST_URI);
const message = await waitFor(() =>
findMessage(
findWarningMessage(
hud,
`Request to access cookies or ` +
`storage on ${BLOCKED_URL} was blocked because of custom cookie permission`

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше