js/src/jit-test/tests/debug/Script-getOffsetLine-02.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/Script-getOffsetLine-02.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,19 @@
     1.4 +// Frame.script/offset and Script.getOffsetLine work in non-top frames.
     1.5 +
     1.6 +var g = newGlobal();
     1.7 +var dbg = Debugger(g);
     1.8 +var hits = 0;
     1.9 +dbg.onDebuggerStatement = function (frame) {
    1.10 +    var a = [];
    1.11 +    for (; frame.type == "call"; frame = frame.older)
    1.12 +        a.push(frame.script.getOffsetLine(frame.offset) - g.line0);
    1.13 +    assertEq(a.join(","), "1,2,3,4");
    1.14 +    hits++;
    1.15 +};
    1.16 +g.eval("var line0 = Error().lineNumber;\n" +
    1.17 +       "function f0() { debugger; }\n" +
    1.18 +       "function f1() { f0(); }\n" +
    1.19 +       "function f2() { f1(); }\n" +
    1.20 +       "function f3() { f2(); }\n" +
    1.21 +       "f3();\n");
    1.22 +assertEq(hits, 1);

mercurial