summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/uncaughtExceptionHook-resumption-02.js
blob: 3ba7070a7b9acf9d4088bd06344c086245a90f2a (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
// uncaughtExceptionHook resumption value other than undefined does not cause
// further hooks to be skipped.

var g = newGlobal({newCompartment: true});
var log;

function makeDebug(g, name) {
    var dbg = new Debugger(g);
    dbg.onDebuggerStatement = function (frame) {
        log += name;
        throw new Error(name);
    };
    dbg.uncaughtExceptionHook = function (exc) {
        assertEq(exc.message, name);
        return name == "2" ? {return: 42} : undefined;
    };
}

var arr = [];
for (var i = 0; i < 6; i++)
    arr[i] = makeDebug(g, "" + i);

log = '';
assertEq(g.eval("debugger;"), 42);
assertEq(log, "012345");