js/src/jit-test/tests/debug/Frame-script-environment-nondebuggee.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // The script and environment of a non-debuggee frame are inaccessible.
michael@0 2
michael@0 3 load(libdir + 'asserts.js');
michael@0 4
michael@0 5 var g = newGlobal();
michael@0 6 var dbg = new Debugger;
michael@0 7
michael@0 8 var log;
michael@0 9 dbg.onDebuggerStatement = function (frame) {
michael@0 10 log += frame.type;
michael@0 11 // Initially, 'frame' is a debuggee frame, and we should be able to see its script and environment.
michael@0 12 assertEq(frame.script instanceof Debugger.Script, true);
michael@0 13 assertEq(frame.environment instanceof Debugger.Environment, true);
michael@0 14
michael@0 15 // If we make g no longer a debuggee, then trying to touch the frame at
michael@0 16 // all show throw.
michael@0 17 dbg.removeDebuggee(g);
michael@0 18 assertThrowsInstanceOf(() => frame.script, Error);
michael@0 19 assertThrowsInstanceOf(() => frame.environment, Error);
michael@0 20 }
michael@0 21
michael@0 22 g.eval('function f() { debugger; }');
michael@0 23
michael@0 24 log = '';
michael@0 25 dbg.addDebuggee(g);
michael@0 26 g.f();
michael@0 27 assertEq(log, 'call');
michael@0 28
michael@0 29 log = '';
michael@0 30 dbg.addDebuggee(g);
michael@0 31 g.eval('debugger;');
michael@0 32 assertEq(log, 'eval');

mercurial