diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-breakpoints-columns.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-breakpoints-columns.js')
-rw-r--r-- | devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-breakpoints-columns.js | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-breakpoints-columns.js b/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-breakpoints-columns.js new file mode 100644 index 0000000000..e5dcfc4f4c --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-breakpoints-columns.js @@ -0,0 +1,119 @@ +/* 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/>. */ + +// Tests that breakpoints set in the pretty printed files display and paused +// correctly. + +"use strict"; + +add_task(async function () { + const dbg = await initDebugger("doc-pretty.html", "pretty.js"); + + await selectSource(dbg, "pretty.js"); + await prettyPrint(dbg); + + info( + "Add breakpoint in funcWithMultipleBreakableColumns, on the for-loop line" + ); + const LINE_INDEX_TO_BREAK_ON = 15; + const prettySourceFileName = "pretty.js:formatted"; + await addBreakpoint(dbg, prettySourceFileName, LINE_INDEX_TO_BREAK_ON); + const prettySource = findSource(dbg, prettySourceFileName); + + info("Check that multiple column breakpoints can be set"); + const columnBreakpointMarkers = await waitForAllElements( + dbg, + "columnBreakpoints" + ); + /* + * We're pausing on the following line, which should have those breakpoints (marked with ➤) + * + * for( ➤let i=0; ➤i < items.length; ➤i++ ) { + * + */ + is( + columnBreakpointMarkers.length, + 3, + "We have the expected numbers of possible column breakpoints" + ); + + info("Enable the second column breakpoint"); + columnBreakpointMarkers[1].click(); + await waitForBreakpointCount(dbg, 2); + await waitForAllElements(dbg, "breakpointItems", 2); + + info("Check that we do pause at expected locations"); + invokeInTab("funcWithMultipleBreakableColumns"); + + info("We pause on the first column breakpoint (before `i` init)"); + await waitForPaused(dbg); + await waitForInlinePreviews(dbg); + await assertPausedAtSourceAndLine( + dbg, + prettySource.id, + LINE_INDEX_TO_BREAK_ON, + 15 + ); + await resume(dbg); + + info( + "We pause at the second column breakpoint, before the first loop iteration" + ); + await waitForPaused(dbg); + await waitForInlinePreviews(dbg); + await assertPausedAtSourceAndLine( + dbg, + prettySource.id, + LINE_INDEX_TO_BREAK_ON, + 18 + ); + const assertScopesForSecondColumnBreakpoint = topBlockItems => + assertScopes(dbg, [ + "Block", + ["<this>", "Window"], + ...topBlockItems, + "funcWithMultipleBreakableColumns", + ["arguments", "Arguments"], + ["items", "(2) […]"], + ]); + await assertScopesForSecondColumnBreakpoint([["i", "0"]]); + await resume(dbg); + + info( + "We pause at the second column breakpoint, before the second loop iteration" + ); + await waitForPaused(dbg); + await waitForInlinePreviews(dbg); + await assertPausedAtSourceAndLine( + dbg, + prettySource.id, + LINE_INDEX_TO_BREAK_ON, + 18 + ); + await assertScopesForSecondColumnBreakpoint([["i", "1"]]); + await resume(dbg); + + info( + "We pause at the second column breakpoint, before we exit the loop (`items.length` is 2, so the condition will fail)" + ); + await waitForPaused(dbg); + await waitForInlinePreviews(dbg); + await assertPausedAtSourceAndLine( + dbg, + prettySource.id, + LINE_INDEX_TO_BREAK_ON, + 18 + ); + await assertScopesForSecondColumnBreakpoint([["i", "2"]]); + await resume(dbg); + + info("Remove all breakpoints"); + await clickGutter(dbg, LINE_INDEX_TO_BREAK_ON); + await waitForBreakpointCount(dbg, 0); + + ok( + !findAllElements(dbg, "columnBreakpoints").length, + "There is no column breakpoints anymore after clicking on the gutter" + ); +}); |