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

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial