Bug 1879086 - [devtools] Fix browser_webconsole_custom_formatters_errors.js failure on beta. r=devtools-reviewers,ochameau.

Differential Revision: https://phabricator.services.mozilla.com/D201114
This commit is contained in:
Nicolas Chevobbe 2024-02-09 06:28:52 +00:00
parent 0f9fbab09b
commit 98fe2b2dd4

View File

@ -11,9 +11,6 @@ const TEST_URI =
add_task(async function () { add_task(async function () {
await pushPref("devtools.custom-formatters.enabled", true); await pushPref("devtools.custom-formatters.enabled", true);
// enable "can't access property "y", x is undefined" error message
await pushPref("javascript.options.property_error_message_fix", true);
const hud = await openNewTabAndConsole(TEST_URI); const hud = await openNewTabAndConsole(TEST_URI);
// Reload the browser to ensure the custom formatters are picked up // Reload the browser to ensure the custom formatters are picked up
@ -153,9 +150,13 @@ async function testInvalidTagname(hud) {
async function testNoPrivilegedAccess(hud) { async function testNoPrivilegedAccess(hud) {
info(`Test for denied access to windowUtils from hook`); info(`Test for denied access to windowUtils from hook`);
await testCustomFormatting(hud, { const node = await testCustomFormatting(hud, {
messageText: `Custom formatter failed: devtoolsFormatters[17].header threw: can't access property "garbageCollect", window.windowUtils is undefined`, messageText: `Custom formatter failed: devtoolsFormatters[17].header threw`,
}); });
ok(
node.textContent.includes("window.windowUtils is undefined"),
"Access to windowUtils triggered expected error"
);
} }
async function testCustomFormatting(hud, { messageText, source, bodyText }) { async function testCustomFormatting(hud, { messageText, source, bodyText }) {
@ -194,4 +195,6 @@ async function testCustomFormatting(hud, { messageText, source, bodyText }) {
"The arrow of the node has the expected class after clicking on it" "The arrow of the node has the expected class after clicking on it"
); );
} }
return headerNode;
} }