From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../test/mochitest/browser_dbg-sourcemaps.js | 50 +++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js') diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js index 7ed70b3310..d7c71aade8 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js @@ -98,6 +98,25 @@ add_task(async function () { "Pending selected location is the expected one" ); + const footerButton = findElement(dbg, "sourceMapFooterButton"); + is( + footerButton.textContent, + "original file", + "The source map button's label mention an original file" + ); + ok( + footerButton.classList.contains("original"), + "The source map icon is original" + ); + ok( + !footerButton.classList.contains("not-mapped"), + "The source map button isn't gray out" + ); + ok( + !footerButton.classList.contains("loading"), + "The source map button isn't reporting in-process loading" + ); + info("Click on jump to generated source link from editor's footer"); let mappedSourceLink = findElement(dbg, "mappedSourceLink"); is( @@ -117,6 +136,23 @@ add_task(async function () { "From entry.js", "The link to mapped source mentions the original source" ); + is( + footerButton.textContent, + "bundle file", + "When moved to the bundle, the source map button's label mention a bundle file" + ); + ok( + !footerButton.classList.contains("original"), + "The source map icon isn't original" + ); + ok( + !footerButton.classList.contains("not-mapped"), + "The source map button isn't gray out" + ); + ok( + !footerButton.classList.contains("loading"), + "The source map button isn't reporting in-process loading" + ); info("Move the cursor within the bundle to another original source"); getCM(dbg).setCursor({ line: 70, ch: 0 }); @@ -126,6 +162,18 @@ add_task(async function () { "From times2.js", "The link to mapped source updates to the newly selected original source within the bundle" ); + + info("Move to the new original file via the source map button/menu"); + await clickOnSourceMapMenuItem(dbg, ".debugger-jump-mapped-source"); + await waitForSelectedSource(dbg, "times2.js"); + + info("Open the related source map file and wait for a new tab to be opened"); + const onTabLoaded = BrowserTestUtils.waitForNewTab( + gBrowser, + `view-source:${EXAMPLE_URL}sourcemaps/bundle.js.map` + ); + await clickOnSourceMapMenuItem(dbg, ".debugger-source-map-link"); + await onTabLoaded; }); function assertBreakpointExists(dbg, source, line) { @@ -143,5 +191,5 @@ async function waitForBreakpointCount(dbg, count) { const { selectors: { getBreakpointCount }, } = dbg; - await waitForState(dbg, state => getBreakpointCount() == count); + await waitForState(dbg, () => getBreakpointCount() == count); } -- cgit v1.2.3