summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-setVariable-11.js
blob: 6491468e2513cefa1ce79d9b9c8b586ecbb2cbda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// setVariable cannot modify the binding for a FunctionExpression's name.

load(libdir + "asserts.js");

var g = newGlobal();
var dbg = Debugger(g);
var hits = 0;
dbg.onDebuggerStatement = function (frame) {
    var env = frame.environment.find("f");
    assertEq(env.getVariable("f"), frame.callee);
    assertThrowsInstanceOf(function () { env.setVariable("f", 0) }, TypeError);
    assertThrowsInstanceOf(function () { env.setVariable("f", frame.callee) }, TypeError);
    hits++;
};
g.eval("(function f() { debugger; })();");
assertEq(hits, 1);