summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-setVariable-13.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/debug/Environment-setVariable-13.js')
-rw-r--r--js/src/jit-test/tests/debug/Environment-setVariable-13.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Environment-setVariable-13.js b/js/src/jit-test/tests/debug/Environment-setVariable-13.js
new file mode 100644
index 000000000..a9e51ca6b
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Environment-setVariable-13.js
@@ -0,0 +1,20 @@
+// Debugger.Environment should throw trying to setVariable on optimized out scope.
+
+load(libdir + "asserts.js");
+
+var g = newGlobal();
+var dbg = new Debugger;
+dbg.addDebuggee(g);
+
+g.eval("" + function f() {
+ var x = 42;
+ function g() { }
+ g();
+});
+
+dbg.onEnterFrame = function (f) {
+ if (f.callee && (f.callee.name === "g"))
+ assertThrowsInstanceOf(function () { f.environment.parent.setVariable("x", 43) }, ReferenceError);
+}
+
+g.f();