summaryrefslogtreecommitdiffstats
path: root/devtools/server/tests/xpcshell/test_stepping-16.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /devtools/server/tests/xpcshell/test_stepping-16.js
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/server/tests/xpcshell/test_stepping-16.js')
-rw-r--r--devtools/server/tests/xpcshell/test_stepping-16.js81
1 files changed, 81 insertions, 0 deletions
diff --git a/devtools/server/tests/xpcshell/test_stepping-16.js b/devtools/server/tests/xpcshell/test_stepping-16.js
new file mode 100644
index 0000000000..e3bd94b747
--- /dev/null
+++ b/devtools/server/tests/xpcshell/test_stepping-16.js
@@ -0,0 +1,81 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/**
+ * Test stepping from inside a blackboxed function
+ * test-page: https://dbg-blackbox-stepping2.glitch.me/
+ */
+
+async function invokeAndPause({ global, threadFront }, expression, url) {
+ return executeOnNextTickAndWaitForPause(
+ () => Cu.evalInSandbox(expression, global, "1.8", url, 1),
+ threadFront
+ );
+}
+
+add_task(
+ threadFrontTest(async ({ commands, threadFront, debuggee }) => {
+ const dbg = { global: debuggee, threadFront };
+ invokeAndPause(
+ dbg,
+ `function outermost() {
+ blackboxed(
+ function inner1() {
+ return 1;
+ },
+ function inner2() {
+ return 2;
+ }
+ );
+ }`,
+ "http://example.com/unblackboxed.js"
+ );
+ invokeAndPause(
+ dbg,
+ `function blackboxed(...args) {
+ for (const arg of args) {
+ arg();
+ }
+ }`,
+ "http://example.com/blackboxed.js"
+ );
+
+ const { sources } = await getSources(threadFront);
+ const blackboxedSourceFront = threadFront.source(
+ sources.find(source => source.url == "http://example.com/blackboxed.js")
+ );
+ const unblackboxedSource = sources.find(
+ source => source.url == "http://example.com/unblackboxed.js"
+ );
+ const unblackboxedActor = unblackboxedSource.actor;
+ const unblackboxedSourceFront = threadFront.source(unblackboxedSource);
+
+ await setBreakpoint(threadFront, {
+ sourceUrl: unblackboxedSourceFront.url,
+ line: 4,
+ });
+ blackBox(blackboxedSourceFront);
+
+ async function testStepping(action, expectedLine) {
+ commands.scriptCommand.execute("outermost()");
+ await waitForPause(threadFront);
+ await stepOver(threadFront);
+ const packet = await action(threadFront);
+ const { actor, line } = packet.frame.where;
+ equal(actor, unblackboxedActor, "Paused in unblackboxed source");
+ equal(line, expectedLine, "Paused at correct line");
+ await threadFront.resume();
+ }
+
+ info("Step Out to outermost");
+ await testStepping(stepOut, 10);
+
+ info("Step Over to outermost");
+ await testStepping(stepOver, 10);
+
+ info("Step In to inner2");
+ await testStepping(stepIn, 7);
+ })
+);