summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-findScripts-ghost.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/debug/Debugger-findScripts-ghost.js')
-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 = ...