summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-toggle.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-toggle.js
parentInitial commit. (diff)
downloadfirefox-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-sourcemapped-toggle.js')
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-toggle.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-toggle.js b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-toggle.js
new file mode 100644
index 0000000000..270375a87c
--- /dev/null
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-toggle.js
@@ -0,0 +1,48 @@
+/* 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/>. */
+
+"use strict";
+
+// Tests for preview through Babel's compile output.
+requestLongerTimeout(5);
+
+// Test pausing with mapScopes enabled and disabled
+add_task(async function () {
+ const dbg = await initDebugger("doc-sourcemapped.html");
+ dbg.actions.toggleMapScopes();
+
+ info("1. Pause on line 20");
+ const url = "webpack3-babel6://./esmodules-cjs/input.js";
+ await waitForSources(dbg, url);
+ const source = findSource(dbg, url);
+ await selectSource(dbg, source);
+ await addBreakpoint(dbg, source, 20, 2);
+ invokeInTab("webpack3Babel6EsmodulesCjs");
+ await waitForPaused(dbg);
+
+ info("2. Hover on a token with mapScopes enabled");
+ await previewToken(dbg, 20, 16, '"a-default"');
+ ok(getOriginalScope(dbg) != null, "Scopes are mapped");
+
+ info("3. Hover on a token with mapScopes disabled");
+ clickElement(dbg, "mapScopesCheckbox");
+ await previewToken(dbg, 21, 16, "undefined");
+
+ info("4. StepOver with mapScopes disabled");
+ await stepOver(dbg);
+ await previewToken(dbg, 20, 16, "undefined");
+ ok(getOriginalScope(dbg) == null, "Scopes are not mapped");
+});
+
+function getOriginalScope(dbg) {
+ return dbg.selectors.getSelectedOriginalScope(
+ dbg.selectors.getCurrentThread()
+ );
+}
+
+async function previewToken(dbg, line, column, value) {
+ const previewEl = await tryHovering(dbg, line, column, "previewPopup");
+ is(previewEl.innerText, value);
+ dbg.actions.clearPreview(getContext(dbg));
+}