From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- ...browser_dbg-browser-toolbox-unselected-pause.js | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 devtools/client/debugger/test/mochitest/browser_dbg-browser-toolbox-unselected-pause.js (limited to 'devtools/client/debugger/test/mochitest/browser_dbg-browser-toolbox-unselected-pause.js') diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-browser-toolbox-unselected-pause.js b/devtools/client/debugger/test/mochitest/browser_dbg-browser-toolbox-unselected-pause.js new file mode 100644 index 0000000000..1380eb7549 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg-browser-toolbox-unselected-pause.js @@ -0,0 +1,67 @@ +/* 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 . */ + +// Test that the debugger pauses in the multiprocess browser toolbox even when +// it hasn't been opened. + +"use strict"; + +requestLongerTimeout(4); + +Services.scriptloader.loadSubScript( + "chrome://mochitests/content/browser/devtools/client/framework/browser-toolbox/test/helpers-browser-toolbox.js", + this +); + +add_task(async function () { + await pushPref("devtools.browsertoolbox.scope", "everything"); + + // Make sure the toolbox opens with the webconsole initially selected. + await pushPref("devtools.browsertoolbox.panel", "webconsole"); + + const ToolboxTask = await initBrowserToolboxTask(); + await ToolboxTask.importFunctions({ + createDebuggerContext, + waitUntil, + waitForPaused, + isPaused, + waitForState, + waitForSelectedSource, + waitForLoadedScopes, + waitForElement, + findElement, + getSelector, + findElementWithSelector, + createLocation, + }); + // ToolboxTask.spawn pass input arguments by stringify them via string concatenation. + // This mean we have to stringify the input object, but don't have to parse it from the task. + await ToolboxTask.spawn(selectors, async _selectors => { + this.selectors = _selectors; + }); + + addTab("data:text/html,"); + + // The debugger should automatically be selected. + await ToolboxTask.spawn(null, async () => { + /* global gToolbox */ + 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.getPanelWhenReady("jsdebugger"); + + const dbg = createDebuggerContext(gToolbox); + await waitForPaused(dbg); + if (!gToolbox.isHighlighted("jsdebugger")) { + throw new Error("Debugger not highlighted"); + } + }); + ok(true, "Paused in new tab"); + + await ToolboxTask.destroy(); +}); -- cgit v1.2.3