js/src/jit-test/tests/debug/Frame-eval-stack.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-eval-stack.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,19 @@
     1.4 +var g = newGlobal();
     1.5 +var dbg = new Debugger(g);
     1.6 +
     1.7 +g.eval("function h() { debugger; }");
     1.8 +g.eval("function g() { h() }");
     1.9 +g.eval("function f() { var blah = 333; g() }");
    1.10 +
    1.11 +dbg.onDebuggerStatement = function(frame) {
    1.12 +    frame = frame.older;
    1.13 +    g.trace = frame.older.eval("(new Error()).stack;").return;
    1.14 +}
    1.15 +g.f();
    1.16 +
    1.17 +assertEq(typeof g.trace, "string");
    1.18 +
    1.19 +var frames = g.trace.split("\n");
    1.20 +assertEq(frames[0].contains("eval code"), true);
    1.21 +assertEq(frames[1].startsWith("f@"), true);
    1.22 +assertEq(frames[2].startsWith("@"), true);

mercurial