js/src/jit-test/tests/debug/Frame-onPop-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-onPop-04.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,30 @@
     1.4 +// When a termination is propagated out of multiple frames, their onPop
     1.5 +// handlers are called in the correct order, and no onExceptionUnwind
     1.6 +// handlers are called.
     1.7 +var g = newGlobal();
     1.8 +g.eval("function f() { terminate(); }");
     1.9 +g.eval("function g() { f(); }");
    1.10 +g.eval("function h() { g(); }");
    1.11 +g.eval("function i() { h(); }");
    1.12 +
    1.13 +var dbg = new Debugger(g);
    1.14 +var log;
    1.15 +var count = 0;
    1.16 +function makePopHandler(label, resumption) {
    1.17 +    return function handlePop(completion) { 
    1.18 +        log += label;
    1.19 +        assertEq(completion, null);
    1.20 +        return resumption;
    1.21 +    };
    1.22 +}
    1.23 +dbg.onEnterFrame = function handleEnter(f) {
    1.24 +    log += "(" + f.callee.name;
    1.25 +    f.onPop = makePopHandler(f.callee.name + ")",
    1.26 +                             count++ == 0 ? { return: 'king' } : undefined);
    1.27 +};
    1.28 +dbg.onExceptionUnwind = function handleExceptionUnwind(f, x) {
    1.29 +    log += 'u';  
    1.30 +};
    1.31 +log = '';
    1.32 +assertEq(g.i(), 'king');
    1.33 +assertEq(log, "(i(h(g(ff)g)h)i)");

mercurial