js/src/jit-test/tests/debug/Frame-live-05.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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