summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-onStep-19.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 /js/src/jit-test/tests/debug/Frame-onStep-19.js
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/debug/Frame-onStep-19.js')
-rw-r--r--js/src/jit-test/tests/debug/Frame-onStep-19.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Frame-onStep-19.js b/js/src/jit-test/tests/debug/Frame-onStep-19.js
new file mode 100644
index 0000000000..019c026a8e
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Frame-onStep-19.js
@@ -0,0 +1,41 @@
+// Stepping should ignore nested function declarations.
+
+// Nested functions are hoisted to the top of the function body,
+// so technically the first thing that happens when you call the outer function
+// is that each inner function is created and bound to a local variable.
+// But users don't actually want to see that happen when they're stepping.
+// It's super confusing.
+
+load(libdir + "stepping.js");
+
+testStepping(
+ `\
+ (function() { // line 1
+ let x = 1; // line 2
+ funcb("funcb"); // line 3
+ function funcb(msg) { // line 4
+ console.log(msg)
+ }
+ }) // line 7
+ `,
+ [1, 2, 3, 7]);
+
+// Stopping at the ClassDeclaration on line 8 is fine. For that matter,
+// stopping on line 5 wouldn't be so bad if we did it after line 3 and before
+// line 8; alas, the actual order of execution is 5, 2, 3, 8... which is too
+// confusing.
+testStepping(
+ `\
+ function f() { // 1
+ var x = 0; // 2
+ a(); // 3
+
+ function a() { // 5
+ x += 1; // 6
+ } // 7
+ class Car {} // 8
+ return x; // 9
+ } // 10
+ f
+ `,
+ [1, 2, 3, 8, 9, 10]);