js/src/jit-test/tests/debug/Frame-live-05.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 // frame.live is false for frames removed after their compartments stopped being debuggees.
     3 var g1 = newGlobal();
     4 var g2 = newGlobal();
     5 var dbg = Debugger(g1, g2);
     6 var hits = 0;
     7 var snapshot = [];
     8 dbg.onDebuggerStatement = function (frame) {
     9     if (hits++ === 0) {
    10         assertEq(frame.eval("x();"), null);
    11     } else {
    12         for (var f = frame; f; f = f.older) {
    13             if (f.type === "call" && f.script !== null)
    14                 snapshot.push(f);
    15         }
    16         dbg.removeDebuggee(g2);
    17         return null;
    18     }
    19 };
    21 g1.eval("function z() { debugger; }");
    22 g2.z = g1.z;
    23 g2.eval("function y() { z(); }");
    24 g2.eval("function x() { y(); }");
    25 assertEq(g2.eval("debugger; 'ok';"), "ok");
    26 assertEq(hits, 2);
    27 assertEq(snapshot.length, 3);
    28 for (var i = 0; i < snapshot.length; i++)
    29     assertEq(snapshot[i].live, false);

mercurial