diff options
Diffstat (limited to 'devtools/client/webconsole/test')
12 files changed, 59 insertions, 11 deletions
diff --git a/devtools/client/webconsole/test/browser/_jsterm.toml b/devtools/client/webconsole/test/browser/_jsterm.toml index c9be46216a..fd23edd9c6 100644 --- a/devtools/client/webconsole/test/browser/_jsterm.toml +++ b/devtools/client/webconsole/test/browser/_jsterm.toml @@ -28,7 +28,7 @@ support-files = [ "!/devtools/client/framework/browser-toolbox/test/helpers-browser-toolbox.js", "!/devtools/client/shared/test/telemetry-test-helpers.js", "!/devtools/client/shared/test/highlighter-test-actor.js", - "../../../../../toolkit/components/reader/test/readerModeArticle.html", + "../../../../../toolkit/components/reader/tests/browser/readerModeArticle.html", ] ["browser_jsterm_add_edited_input_to_history.js"] diff --git a/devtools/client/webconsole/test/browser/browser_console_webconsole_private_browsing.js b/devtools/client/webconsole/test/browser/browser_console_webconsole_private_browsing.js index 0fed8c03c5..96033f84d8 100644 --- a/devtools/client/webconsole/test/browser/browser_console_webconsole_private_browsing.js +++ b/devtools/client/webconsole/test/browser/browser_console_webconsole_private_browsing.js @@ -141,7 +141,7 @@ add_task(async function () { info("close the private window and check if private messages are removed"); const onPrivateMessagesCleared = hud.ui.once("private-messages-cleared"); - privateWindow.BrowserTryToCloseWindow(); + privateWindow.BrowserCommands.tryToCloseWindow(); await onPrivateMessagesCleared; ok( diff --git a/devtools/client/webconsole/test/browser/browser_jsterm_await_paused.js b/devtools/client/webconsole/test/browser/browser_jsterm_await_paused.js index 421837e9eb..f0dbca4dd8 100644 --- a/devtools/client/webconsole/test/browser/browser_jsterm_await_paused.js +++ b/devtools/client/webconsole/test/browser/browser_jsterm_await_paused.js @@ -12,7 +12,7 @@ add_task(async function () { await pushPref("devtools.debugger.features.map-await-expression", true); // Force the split console to be closed. - await pushPref("devtools.toolbox.splitconsoleEnabled", false); + await pushPref("devtools.toolbox.splitconsole.open", false); const hud = await openNewTabAndConsole(TEST_URI); const pauseExpression = `(() => { diff --git a/devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation.js b/devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation.js index 194cc64531..dae99c1961 100644 --- a/devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation.js +++ b/devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation.js @@ -310,7 +310,7 @@ add_task(async function () { EventUtils.synthesizeKey("KEY_ArrowDown"); // Navigates to the XMLDocument item in the popup - await waitForEagerEvaluationResult(hud, `function ()`); + await waitForEagerEvaluationResult(hud, `function XMLDocument()`); onPopupClose = popup.once("popup-closed"); EventUtils.sendString(" "); diff --git a/devtools/client/webconsole/test/browser/browser_jsterm_editor_reverse_search_keyboard_navigation.js b/devtools/client/webconsole/test/browser/browser_jsterm_editor_reverse_search_keyboard_navigation.js index 0b9b828ce3..bbdc251107 100644 --- a/devtools/client/webconsole/test/browser/browser_jsterm_editor_reverse_search_keyboard_navigation.js +++ b/devtools/client/webconsole/test/browser/browser_jsterm_editor_reverse_search_keyboard_navigation.js @@ -6,7 +6,7 @@ // Ensure keyboard navigation works in editor mode and does // not trigger reader mode (See 1682340). -const TEST_URI = `http://example.com/browser/toolkit/components/reader/test/readerModeArticle.html`; +const TEST_URI = `http://example.com/browser/toolkit/components/reader/tests/browser/readerModeArticle.html`; const isMacOS = AppConstants.platform === "macosx"; add_task(async function () { @@ -42,7 +42,7 @@ add_task(async function () { await wait(1000); is( readerModeButtonEl.getAttribute("readeractive"), - "", + null, "reader mode wasn't activated" ); @@ -72,7 +72,7 @@ add_task(async function () { await wait(1000); is( readerModeButtonEl.getAttribute("readeractive"), - "", + null, "reader mode still wasn't activated" ); diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_console_api_iframe.js b/devtools/client/webconsole/test/browser/browser_webconsole_console_api_iframe.js index 9670312e85..977710b78e 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_console_api_iframe.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_console_api_iframe.js @@ -17,7 +17,7 @@ add_task(async function () { ok(true, "The initial message is displayed in the console"); // Create a promise for the message logged after the reload. const onMessage = waitForMessageByType(hud, loggedString, ".console-api"); - BrowserReload(); + BrowserCommands.reload(); await onMessage; ok(true, "The message is also displayed after a page reload"); }); diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_cors_errors.js b/devtools/client/webconsole/test/browser/browser_webconsole_cors_errors.js index b29da33bab..c20991c1bf 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_cors_errors.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_cors_errors.js @@ -6,6 +6,9 @@ "use strict"; +// The test can take a bit long on slow machines. +requestLongerTimeout(2); + const TEST_URI = "http://example.com/browser/devtools/client/webconsole/test/browser/test-network-request.html"; const BASE_CORS_ERROR_URL = @@ -40,6 +43,7 @@ add_task(async function () { await checkCorsMessage(hud, message, "CORSDisabled"); await pushPref("content.cors.disable", false); + await clearOutput(hud); info("Test CORSPreflightDidNotSucceed"); onCorsMessage = waitForMessageByType( hud, @@ -50,6 +54,7 @@ add_task(async function () { message = await onCorsMessage; await checkCorsMessage(hud, message, "CORSPreflightDidNotSucceed"); + await clearOutput(hud); info("Test CORS did not succeed"); onCorsMessage = waitForMessageByType( hud, @@ -60,6 +65,7 @@ add_task(async function () { message = await onCorsMessage; await checkCorsMessage(hud, message, "CORSDidNotSucceed"); + await clearOutput(hud); info("Test CORSExternalRedirectNotAllowed"); onCorsMessage = waitForMessageByType( hud, @@ -70,6 +76,7 @@ add_task(async function () { message = await onCorsMessage; await checkCorsMessage(hud, message, "CORSExternalRedirectNotAllowed"); + await clearOutput(hud); info("Test CORSMissingAllowOrigin"); onCorsMessage = waitForMessageByType( hud, @@ -82,6 +89,7 @@ add_task(async function () { message = await onCorsMessage; await checkCorsMessage(hud, message, "CORSMissingAllowOrigin"); + await clearOutput(hud); info("Test CORSMultipleAllowOriginNotAllowed"); onCorsMessage = waitForMessageByType( hud, @@ -94,6 +102,7 @@ add_task(async function () { message = await onCorsMessage; await checkCorsMessage(hud, message, "CORSMultipleAllowOriginNotAllowed"); + await clearOutput(hud); info("Test CORSAllowOriginNotMatchingOrigin"); onCorsMessage = waitForMessageByType( hud, @@ -107,6 +116,7 @@ add_task(async function () { message = await onCorsMessage; await checkCorsMessage(hud, message, "CORSAllowOriginNotMatchingOrigin"); + await clearOutput(hud); info("Test CORSNotSupportingCredentials"); onCorsMessage = waitForMessageByType( hud, @@ -118,6 +128,7 @@ add_task(async function () { message = await onCorsMessage; await checkCorsMessage(hud, message, "CORSNotSupportingCredentials"); + await clearOutput(hud); info("Test CORSMethodNotFound"); onCorsMessage = waitForMessageByType( hud, @@ -129,6 +140,7 @@ add_task(async function () { message = await onCorsMessage; await checkCorsMessage(hud, message, "CORSMethodNotFound"); + await clearOutput(hud); info("Test CORSMissingAllowCredentials"); onCorsMessage = waitForMessageByType( hud, @@ -140,6 +152,7 @@ add_task(async function () { message = await onCorsMessage; await checkCorsMessage(hud, message, "CORSMissingAllowCredentials"); + await clearOutput(hud); info("Test CORSInvalidAllowMethod"); onCorsMessage = waitForMessageByType( hud, @@ -151,6 +164,7 @@ add_task(async function () { message = await onCorsMessage; await checkCorsMessage(hud, message, "CORSInvalidAllowMethod"); + await clearOutput(hud); info("Test CORSInvalidAllowHeader"); onCorsMessage = waitForMessageByType( hud, @@ -162,6 +176,7 @@ add_task(async function () { message = await onCorsMessage; await checkCorsMessage(hud, message, "CORSInvalidAllowHeader"); + await clearOutput(hud); info("Test CORSMissingAllowHeaderFromPreflight"); onCorsMessage = waitForMessageByType( hud, diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_split_escape_key.js b/devtools/client/webconsole/test/browser/browser_webconsole_split_escape_key.js index 84c6935510..8127ae1709 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_split_escape_key.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_split_escape_key.js @@ -53,4 +53,27 @@ add_task(async function () { await onSplitConsoleEvent; ok(!toolbox.splitConsole, "Split console is hidden."); + + info("Test if Split console Shortcut stops working when it's disabled."); + + info("Setting the Pref to false and sending ESCAPE key."); + await pushPref("devtools.toolbox.splitconsole.enabled", false); + // pushPref doesn't trigger _prefChanged of toolbox-options.js, so we invoke the toolbox setting update manually + toolbox.updateIsSplitConsoleEnabled(); + const onSplitConsole = toolbox.once("split-console"); + const onTimeout = wait(1000).then(() => "TIMEOUT"); + EventUtils.sendKey("ESCAPE", toolbox.win); + const raceResult = await Promise.race([onSplitConsole, onTimeout]); + is(raceResult, "TIMEOUT", "split-console wasn't emitted"); + + ok(!toolbox.splitConsole, "Split console didn't get Triggered."); + + info("Setting the Pref to true and sending ESCAPE key again."); + await pushPref("devtools.toolbox.splitconsole.enabled", true); + toolbox.updateIsSplitConsoleEnabled(); + const onSplitConsoleReadyAgain = toolbox.once("split-console"); + EventUtils.sendKey("ESCAPE", toolbox.win); + await onSplitConsoleReadyAgain; + + ok(toolbox.splitConsole, "Split console Shortcut is working again."); }); diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_split_persist.js b/devtools/client/webconsole/test/browser/browser_webconsole_split_persist.js index 2442b64b5b..2f037c6ee0 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_split_persist.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_split_persist.js @@ -99,7 +99,7 @@ add_task(async function () { }); function getVisiblePrefValue() { - return Services.prefs.getBoolPref("devtools.toolbox.splitconsoleEnabled"); + return Services.prefs.getBoolPref("devtools.toolbox.splitconsole.open"); } function getHeightPrefValue() { diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_stubs_console_api.js b/devtools/client/webconsole/test/browser/browser_webconsole_stubs_console_api.js index 9718a8efd1..86e62b173d 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_stubs_console_api.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_stubs_console_api.js @@ -68,6 +68,11 @@ async function generateConsoleApiStubs() { await commands.targetCommand.startListening(); const resourceCommand = commands.resourceCommand; + // Ensure waiting for sources in order to populate message.sourceId correctly. + await resourceCommand.watchResources([resourceCommand.TYPES.SOURCE], { + onAvailable() {}, + }); + // The resource-watcher only supports a single call to watch/unwatch per // instance, so we attach a unique watch callback, which will forward the // resource to `handleConsoleMessage`, dynamically updated for each command. diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_stubs_page_error.js b/devtools/client/webconsole/test/browser/browser_webconsole_stubs_page_error.js index d6610b7309..50029a3139 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_stubs_page_error.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_stubs_page_error.js @@ -70,6 +70,11 @@ async function generatePageErrorStubs() { await commands.targetCommand.startListening(); const resourceCommand = commands.resourceCommand; + // Ensure waiting for sources in order to populate message.sourceId correctly. + await resourceCommand.watchResources([resourceCommand.TYPES.SOURCE], { + onAvailable() {}, + }); + // The resource-watcher only supports a single call to watch/unwatch per // instance, so we attach a unique watch callback, which will forward the // resource to `handleErrorMessage`, dynamically updated for each command. diff --git a/devtools/client/webconsole/test/chrome/head.js b/devtools/client/webconsole/test/chrome/head.js index 2f984d564d..3f4988c2d0 100644 --- a/devtools/client/webconsole/test/chrome/head.js +++ b/devtools/client/webconsole/test/chrome/head.js @@ -4,8 +4,8 @@ "use strict"; -var { BrowserLoader } = ChromeUtils.import( - "resource://devtools/shared/loader/browser-loader.js" +var { BrowserLoader } = ChromeUtils.importESModule( + "resource://devtools/shared/loader/browser-loader.sys.mjs" ); var { require: browserRequire } = BrowserLoader({ |