js/src/jit-test/tests/debug/Frame-onPop-throw.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-throw.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     1.4 +// |jit-test| error: TestComplete
     1.5 +// onPop fires when frames throw an exception.
     1.6 +
     1.7 +load(libdir + "asserts.js");
     1.8 +var g = newGlobal();
     1.9 +var dbg = new Debugger(g);
    1.10 +
    1.11 +function test(type, provocation) {
    1.12 +    var log;
    1.13 +
    1.14 +    // Help people figure out which 'test' call failed.
    1.15 +    print("type:        " + uneval(type));
    1.16 +    print("provocation: " + uneval(provocation));
    1.17 +
    1.18 +    dbg.onDebuggerStatement = function handleDebuggerStatement(f) {
    1.19 +        log += 'd';
    1.20 +    };
    1.21 +
    1.22 +    dbg.onEnterFrame = function handleEnterFrame(f) {
    1.23 +        log += '(';
    1.24 +        assertEq(f.type, type);
    1.25 +        f.onPop = function handlePop(c) {
    1.26 +            log += ')';
    1.27 +            assertEq(c.throw, 'mud');
    1.28 +        };
    1.29 +    };
    1.30 +
    1.31 +    log = '';
    1.32 +    assertThrowsValue(provocation, 'mud');
    1.33 +    assertEq(log, "(d)");
    1.34 +
    1.35 +    print();
    1.36 +}
    1.37 +
    1.38 +g.eval("function f() { debugger; throw 'mud'; }");
    1.39 +test("call", g.f);
    1.40 +test("call", function () { return new g.f; });
    1.41 +test("eval", function () { return g.eval("debugger; throw \'mud\';"); });
    1.42 +test("global", function () { return g.evaluate("debugger; throw \'mud\';"); });
    1.43 +throw 'TestComplete';

mercurial