summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/resumption-03.js
blob: f48992ced6019879087e99e8a3ec8bdd004d7ae8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Returning and throwing objects.

load(libdir + "asserts.js");

var g = newGlobal({newCompartment: true});
g.debuggeeGlobal = this;
g.eval("(" + function () {
        var how, what;
        var dbg = new Debugger(debuggeeGlobal);
        dbg.onDebuggerStatement = function (frame) {
            if (frame.callee.name === "configure") {
                how = frame.arguments[0];
                what = frame.arguments[1];
            } else {
                var resume = {};
                resume[how] = what;
                return resume;
            }
        };
    } + ")();");

function configure(how, what) { debugger; }
function fire() { debugger; }

var d = new Date;
configure('return', d);
assertEq(fire(), d);
configure('return', Math);
assertEq(fire(), Math);

var x = new Error('oh no what are you doing');
configure('throw', x);
assertThrowsValue(fire, x);
configure('throw', parseInt);
assertThrowsValue(fire, parseInt);