From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../mochitest/browser_dbg-breaking-from-console.js | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 devtools/client/debugger/test/mochitest/browser_dbg-breaking-from-console.js (limited to 'devtools/client/debugger/test/mochitest/browser_dbg-breaking-from-console.js') diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-breaking-from-console.js b/devtools/client/debugger/test/mochitest/browser_dbg-breaking-from-console.js new file mode 100644 index 0000000000..5791524b6b --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg-breaking-from-console.js @@ -0,0 +1,38 @@ +/* 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 . */ + +"use strict"; + +// Tests that `debugger` statements are hit before the debugger even +// initializes and it properly highlights the right location in the +// debugger. + +add_task(async function() { + const url = `${EXAMPLE_URL}doc-script-switching.html`; + const toolbox = await openNewTabAndToolbox(url, "webconsole"); + + // Type "debugger" into console + const wrapper = toolbox.getPanel("webconsole").hud.ui.wrapper; + const onSelected = toolbox.once("jsdebugger-selected"); + wrapper.dispatchEvaluateExpression("debugger"); + + // Wait for the debugger to be selected and make sure it's paused + await onSelected; + is(toolbox.threadFront.state, "paused"); + + // Create a dbg context + const dbg = createDebuggerContext(toolbox); + + // Make sure the thread is paused in the right source and location + await waitForPaused(dbg); + const selectedSource = dbg.selectors.getSelectedSource(); + ok( + !selectedSource.url, + "The selected source is the console evaluation and doesn't have a URL" + ); + is(getCM(dbg).getValue(), "debugger"); + assertPausedAtSourceAndLine(dbg, selectedSource.id, 1); + + await resume(dbg); +}); -- cgit v1.2.3