diff --git a/devtools/client/debugger/test/mochitest/browser.ini b/devtools/client/debugger/test/mochitest/browser.ini index 55fa6b9bbc3b..34ad6aca950f 100644 --- a/devtools/client/debugger/test/mochitest/browser.ini +++ b/devtools/client/debugger/test/mochitest/browser.ini @@ -7,6 +7,7 @@ support-files = head.js helpers.js helpers/context.js + !/devtools/client/framework/test/helpers.js !/devtools/client/inspector/test/head.js !/devtools/client/inspector/test/shared-head.js !/devtools/client/shared/test/shared-head.js @@ -176,3 +177,4 @@ skip-if = true #Bug 1456013, Bug 1559547, Bug 1571863 [browser_dbg-gc-sources.js] [browser_dbg-watchpoints.js] skip-if = debug +[browser_dbg-toolbox-unselected-pause.js] diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-toolbox-unselected-pause.js b/devtools/client/debugger/test/mochitest/browser_dbg-toolbox-unselected-pause.js new file mode 100644 index 000000000000..59e3cd8377ec --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg-toolbox-unselected-pause.js @@ -0,0 +1,54 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Test that the debugger pauses in the omniscient browser toolbox even when it +// hasn't been opened. + +"use strict"; + +Services.scriptloader.loadSubScript( + "chrome://mochitests/content/browser/devtools/client/framework/test/helpers.js", + this +); + +add_task(async function() { + await pushPref("devtools.browsertoolbox.fission", true); + + // Make sure the toolbox opens with the webconsole initially selected. + await pushPref("devtools.browsertoolbox.panel", "webconsole"); + + const ToolboxTask = await initBrowserToolboxTask(); + await ToolboxTask.importFunctions({ + waitUntil, + waitForPaused, + isPaused, + waitForState, + info: () => {}, + waitForSelectedSource, + waitForLoadedScopes: () => {}, + }); + + addTab("data:text/html,"); + + // The debugger should automatically be selected. + await ToolboxTask.spawn(null, async () => { + await waitUntil(() => gToolbox.currentToolId == "jsdebugger"); + }); + ok(true, "Debugger selected"); + + // The debugger should pause. + await ToolboxTask.spawn(null, async () => { + // Wait for the debugger to finish loading. + await gToolbox.selectTool("jsdebugger"); + + const dbg = gToolbox.getCurrentPanel().panelWin.dbg; + await waitForPaused(dbg); + if (!gToolbox.isToolHighlighted("jsdebugger")) { + throw new Error("Debugger not highlighted"); + } + }); + ok(true, "Paused in new tab"); + + await ToolboxTask.destroy(); +});