summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-setVariable-13.js
blob: a9e51ca6b4a62b6ecc4427fa10a36a0ab0d5948a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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();