summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js')
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js77
1 files changed, 77 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js b/devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js
new file mode 100644
index 0000000000..6f3aaae78a
--- /dev/null
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js
@@ -0,0 +1,77 @@
+/* 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/>. */
+
+add_task(async function() {
+ await pushPref(
+ "devtools.debugger.features.event-listeners-breakpoints",
+ true
+ );
+
+ const dbg = await initDebugger(
+ "doc-event-breakpoints.html",
+ "event-breakpoints"
+ );
+ await selectSource(dbg, "event-breakpoints");
+ await waitForSelectedSource(dbg, "event-breakpoints");
+
+ await dbg.actions.addEventListenerBreakpoints([
+ "event.mouse.click",
+ "event.xhr.load",
+ "timer.timeout.set",
+ "timer.timeout.fire",
+ "script.source.firstStatement",
+ ]);
+
+ invokeInTab("clickHandler");
+ await waitForPaused(dbg);
+ assertPauseLocation(dbg, 12);
+ await resume(dbg);
+
+ invokeInTab("xhrHandler");
+ await waitForPaused(dbg);
+ assertPauseLocation(dbg, 20);
+ await resume(dbg);
+
+ invokeInTab("timerHandler");
+ await waitForPaused(dbg);
+ assertPauseLocation(dbg, 27);
+ await resume(dbg);
+
+ await waitForPaused(dbg);
+ assertPauseLocation(dbg, 28);
+ await resume(dbg);
+
+ invokeInTab("evalHandler");
+ await waitForPaused(dbg);
+ assertPauseLocation(dbg, 2, "http://example.com/eval-test.js");
+ await resume(dbg);
+
+ // Test that we don't pause on event breakpoints when source is blackboxed.
+ await clickElement(dbg, "blackbox");
+ await waitForDispatch(dbg, "BLACKBOX");
+
+ invokeInTab("clickHandler");
+ is(isPaused(dbg), false);
+
+ invokeInTab("xhrHandler");
+ is(isPaused(dbg), false);
+
+ invokeInTab("timerHandler");
+ is(isPaused(dbg), false);
+
+ // Cleanup - unblackbox the source
+ await clickElement(dbg, "blackbox");
+ await waitForDispatch(dbg, "BLACKBOX");
+});
+
+function assertPauseLocation(dbg, line, url = "event-breakpoints.js") {
+ const { location } = dbg.selectors.getVisibleSelectedFrame();
+
+ const source = findSource(dbg, url);
+
+ is(location.sourceId, source.id, `correct sourceId`);
+ is(location.line, line, `correct line`);
+
+ assertPausedLocation(dbg);
+}