summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-findScripts-ghost.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/Debugger-findScripts-ghost.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 '')
-rw-r--r--js/src/jit-test/tests/debug/Debugger-findScripts-ghost.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Debugger-findScripts-ghost.js b/js/src/jit-test/tests/debug/Debugger-findScripts-ghost.js
new file mode 100644
index 0000000000..c20e5ac1cc
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-ghost.js
@@ -0,0 +1,37 @@
+// |jit-test| skip-if: isLcovEnabled()
+
+var g = newGlobal({newCompartment: true});
+var dbg = new Debugger(g);
+
+g.eval(`
+function f(
+ a = (
+ b = (
+ c = function g() {
+ },
+ ) => {
+ },
+ d = (
+ e = (
+ f = (
+ ) => {
+ },
+ ) => {
+ },
+ ) => {
+ },
+ ) => {
+ },
+) {
+}
+`);
+
+// Debugger shouldn't find ghost functions.
+var allScripts = dbg.findScripts();
+assertEq(allScripts.filter(s => s.startLine == 2).length, 1); // function f
+assertEq(allScripts.filter(s => s.startLine == 3).length, 1); // a = ...
+assertEq(allScripts.filter(s => s.startLine == 4).length, 1); // b = ...
+assertEq(allScripts.filter(s => s.startLine == 5).length, 1); // function g
+assertEq(allScripts.filter(s => s.startLine == 9).length, 1); // d = ...
+assertEq(allScripts.filter(s => s.startLine == 10).length, 1); // e = ...
+assertEq(allScripts.filter(s => s.startLine == 11).length, 1); // f = ...