js/src/jit-test/tests/debug/Frame-onPop-14.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-onPop-14.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,25 @@
     1.4 +// A frame's onPop handler is called only once, even if it is for a function
     1.5 +// called from a loop.
     1.6 +var g = newGlobal();
     1.7 +var dbg = new Debugger(g);
     1.8 +var log;
     1.9 +
    1.10 +var count;
    1.11 +dbg.onDebuggerStatement = function handleDebug(frame) {
    1.12 +    log += 'd';
    1.13 +    assertEq(frame.type, "call");
    1.14 +    count++;
    1.15 +    if (count == 10) {
    1.16 +        frame.onPop = function handlePop(c) {
    1.17 +            log += ')' + this.arguments[0];
    1.18 +            assertEq(c.return, "snifter");
    1.19 +        };
    1.20 +    }
    1.21 +};
    1.22 +
    1.23 +g.eval("function f(n) { debugger; return 'snifter'; }");
    1.24 +log = '';
    1.25 +count = 0;
    1.26 +g.eval("for (i = 0; i < 20; i++) f(i);");
    1.27 +assertEq(count, 20);
    1.28 +assertEq(log, "dddddddddd)9dddddddddd");

mercurial