js/src/jit-test/tests/debug/Object-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 function are null.
     3 var g = newGlobal();
     4 g.eval('function f() { return "from f"; }');
     6 var dbg = new Debugger;
     7 var gw = dbg.makeGlobalObjectReference(g);
     8 var fw = gw.getOwnPropertyDescriptor('f').value;
    10 // g is not a debuggee, so we can't fetch f's script or environment.
    11 assertEq(fw.script, null);
    12 assertEq(fw.environment, null);
    14 // If we add g as a debuggee, we can fetch f's script and environment.
    15 dbg.addDebuggee(g);
    16 var fscript = fw.script;
    17 var fenv = fw.environment;
    18 assertEq(fscript instanceof Debugger.Script, true);
    19 assertEq(fenv instanceof Debugger.Environment, true);
    21 // Removing g as a debuggee makes the script and environment inaccessible again.
    22 dbg.removeDebuggee(g);
    23 assertEq(fw.script, null);
    24 assertEq(fw.environment, null);

mercurial