Object-executeInGlobal-10.js (544B)
1 var g = newGlobal({newCompartment: true}); 2 var dbg = new Debugger; 3 var gw = dbg.addDebuggee(g); 4 5 // executeInGlobal should be able to introduce and persist lexical bindings. 6 assertEq(gw.executeInGlobal(`let x = 42; x;`).return, 42); 7 assertEq(gw.executeInGlobal(`x;`).return, 42); 8 9 // By contrast, Debugger.Frame.eval is like direct eval, and shouldn't be able 10 // to introduce new lexical bindings. 11 dbg.onDebuggerStatement = function (frame) { frame.eval(`let y = 84;`); }; 12 g.eval(`debugger;`); 13 assertEq(!!gw.executeInGlobal(`y;`).throw, true);