summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/uncaughtExceptionHook-resumption-01.js
blob: 5ef62b6f6d6c35d7c6d7b5c9bf380298544df4c3 (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 returns a resumption value.

load(libdir + "asserts.js");

var g = newGlobal({newCompartment: true});
var dbg = new Debugger(g);
var rv;
dbg.onDebuggerStatement = function () { throw 15; };
dbg.uncaughtExceptionHook = function (exc) {
    assertEq(exc, 15);
    return rv;
};

// case 1: undefined
rv = undefined;
g.eval("debugger");

// case 2: throw
rv = {throw: 57};
var result;
assertThrowsValue(function () { g.eval("debugger"); }, 57);

// case 3: return
rv = {return: 42};
assertEq(g.eval("debugger;"), 42);