1
// setVariable works on non-innermost environments.
3
// (The debuggee code here is a bit convoluted to defeat optimizations that
4
// could make obj.b a null closure or obj.i a flat closure--that is, a function
5
// that gets a frozen copy of i instead of a reference to the runtime
6
// environment that contains it. setVariable does not currently detect this
9
var g = newGlobal('new-compartment');
10
g.eval("function d() { debugger; }\n" +
13
" var obj = {b: function (i) { d(obj); return i; },\n" +
14
" i: function () { return i; }};\n" +
15
" var i = 'FAIL2';\n" +
19
var dbg = Debugger(g);
20
dbg.onDebuggerStatement = function (frame) {
22
for (var env = frame.older.environment; env; env = env.parent) {
23
if (env.getVariable("i") !== undefined)
24
env.setVariable("i", x++);
29
var r = obj.b('FAIL3');