js/src/jit-test/tests/baseline/bug836742.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/baseline/bug836742.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +// |jit-test| debug
     1.5 +// Ensure the correct frame is passed to exception unwind hooks.
     1.6 +var g = newGlobal();
     1.7 +g.debuggeeGlobal = this;
     1.8 +g.eval("(" + function () {
     1.9 +    frames = [];
    1.10 +    var dbg = Debugger(debuggeeGlobal);
    1.11 +    dbg.onEnterFrame = function(frame) {
    1.12 +	frames.push(frame);
    1.13 +    };
    1.14 +    dbg.onExceptionUnwind = function(frame) {
    1.15 +	assertEq(frames.indexOf(frame), frames.length - 1);
    1.16 +	frames.pop();
    1.17 +	assertEq(frame, dbg.getNewestFrame());
    1.18 +    }
    1.19 +} + ")()");
    1.20 +
    1.21 +function f(n) {
    1.22 +    debugger;
    1.23 +    n--;
    1.24 +    if (n > 0) {
    1.25 +        f(n);
    1.26 +    } else {
    1.27 +	assertEq(g.frames.length, 10);
    1.28 +        throw "fit";
    1.29 +    }
    1.30 +}
    1.31 +try {
    1.32 +    f(10);
    1.33 +    assertEq(0, 1);
    1.34 +} catch (e) {
    1.35 +    assertEq(e, "fit");
    1.36 +}
    1.37 +assertEq(g.frames.length, 0);

mercurial