michael@0: // The script and environment of a non-debuggee frame are inaccessible. michael@0: michael@0: load(libdir + 'asserts.js'); michael@0: michael@0: var g = newGlobal(); michael@0: var dbg = new Debugger; michael@0: michael@0: var log; michael@0: dbg.onDebuggerStatement = function (frame) { michael@0: log += frame.type; michael@0: // Initially, 'frame' is a debuggee frame, and we should be able to see its script and environment. michael@0: assertEq(frame.script instanceof Debugger.Script, true); michael@0: assertEq(frame.environment instanceof Debugger.Environment, true); michael@0: michael@0: // If we make g no longer a debuggee, then trying to touch the frame at michael@0: // all show throw. michael@0: dbg.removeDebuggee(g); michael@0: assertThrowsInstanceOf(() => frame.script, Error); michael@0: assertThrowsInstanceOf(() => frame.environment, Error); michael@0: } michael@0: michael@0: g.eval('function f() { debugger; }'); michael@0: michael@0: log = ''; michael@0: dbg.addDebuggee(g); michael@0: g.f(); michael@0: assertEq(log, 'call'); michael@0: michael@0: log = ''; michael@0: dbg.addDebuggee(g); michael@0: g.eval('debugger;'); michael@0: assertEq(log, 'eval');