PageRenderTime 25ms CodeModel.GetById 16ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/zpao/v8monkey
JavaScript | 29 lines | 26 code | 2 blank | 1 comment | 6 complexity | d4dc8b25005d6703887949c8201c7d54 MD5 | raw file
 1// frame.live is false for frames removed after their compartments stopped being debuggees.
 2
 3var g1 = newGlobal('new-compartment');
 4var g2 = newGlobal('new-compartment');
 5var dbg = Debugger(g1, g2);
 6var hits = 0;
 7var snapshot = [];
 8dbg.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};
20
21g1.eval("function z() { debugger; }");
22g2.z = g1.z;
23g2.eval("function y() { z(); }");
24g2.eval("function x() { y(); }");
25assertEq(g2.eval("debugger; 'ok';"), "ok");
26assertEq(hits, 2);
27assertEq(snapshot.length, 3);
28for (var i = 0; i < snapshot.length; i++)
29    assertEq(snapshot[i].live, false);