js/src/jit-test/tests/debug/resumption-03.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/resumption-03.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +// |jit-test| debug
     1.5 +// Returning and throwing objects.
     1.6 +
     1.7 +load(libdir + "asserts.js");
     1.8 +
     1.9 +var g = newGlobal();
    1.10 +g.debuggeeGlobal = this;
    1.11 +g.eval("(" + function () {
    1.12 +        var how, what;
    1.13 +        var dbg = new Debugger(debuggeeGlobal);
    1.14 +        dbg.onDebuggerStatement = function (frame) {
    1.15 +            if (frame.callee.name === "configure") {
    1.16 +                how = frame.arguments[0];
    1.17 +                what = frame.arguments[1];
    1.18 +            } else {
    1.19 +                var resume = {};
    1.20 +                resume[how] = what;
    1.21 +                return resume;
    1.22 +            }
    1.23 +        };
    1.24 +    } + ")();");
    1.25 +
    1.26 +function configure(how, what) { debugger; }
    1.27 +function fire() { debugger; }
    1.28 +
    1.29 +var d = new Date;
    1.30 +configure('return', d);
    1.31 +assertEq(fire(), d);
    1.32 +configure('return', Math);
    1.33 +assertEq(fire(), Math);
    1.34 +
    1.35 +var x = new Error('oh no what are you doing');
    1.36 +configure('throw', x);
    1.37 +assertThrowsValue(fire, x);
    1.38 +configure('throw', parseInt);
    1.39 +assertThrowsValue(fire, parseInt);

mercurial