summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-find-01.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/debug/Environment-find-01.js')
-rw-r--r--js/src/jit-test/tests/debug/Environment-find-01.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Environment-find-01.js b/js/src/jit-test/tests/debug/Environment-find-01.js
new file mode 100644
index 0000000000..abce77df16
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Environment-find-01.js
@@ -0,0 +1,19 @@
+// find sees that vars are hoisted out of with statements.
+
+var g = newGlobal({newCompartment: true});
+var dbg = Debugger(g);
+var hits = 0;
+dbg.onDebuggerStatement = function (frame) {
+ assertEq(frame.environment.find("x").type, "with");
+ hits++;
+};
+
+assertEq(g.eval("(function () {\n" +
+ " function g() { x = 1; }\n" +
+ " with ({x: 2}) {\n" +
+ " var x;\n" +
+ " debugger;\n" +
+ " return x;\n" +
+ " }\n" +
+ "})();"), 2);
+assertEq(hits, 1);