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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/debug/Frame-live-04.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,27 @@
     1.4 +// frame.live is false for frames discarded during uncatchable error unwinding.
     1.5 +
     1.6 +var g = newGlobal();
     1.7 +var dbg = Debugger(g);
     1.8 +var hits = 0;
     1.9 +var snapshot;
    1.10 +dbg.onDebuggerStatement = function (frame) {
    1.11 +    var stack = [];
    1.12 +    for (var f = frame; f; f = f.older) {
    1.13 +        if (f.type === "call" && f.script !== null)
    1.14 +            stack.push(f);
    1.15 +    }
    1.16 +    snapshot = stack;
    1.17 +    if (hits++ === 0)
    1.18 +        assertEq(frame.eval("x();"), null);
    1.19 +    else
    1.20 +        return null;
    1.21 +};
    1.22 +
    1.23 +g.eval("function z() { debugger; }");
    1.24 +g.eval("function y() { z(); }");
    1.25 +g.eval("function x() { y(); }");
    1.26 +assertEq(g.eval("debugger; 'ok';"), "ok");
    1.27 +assertEq(hits, 2);
    1.28 +assertEq(snapshot.length, 3);
    1.29 +for (var i = 0; i < snapshot.length; i++)
    1.30 +    assertEq(snapshot[i].live, false);

mercurial