summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-setVariable-11.js
blob: d2030159d124c55bf6a51208137f9ff598329c88 (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({newCompartment: true});
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() { eval(\"\"); debugger; })();");
assertEq(hits, 1);