summaryrefslogtreecommitdiff
path: root/js/src/jit-test/tests/debug/onExceptionUnwind-resumption-async.js
blob: 0b2ee766bfbfdd5dba1f8994a52fc8d13bdcd6db (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
load(libdir + "asserts.js");

var g = newGlobal();
var dbg = Debugger(g);

g.eval(`
async function f() {
    return e;
}
`);

// Just continue
dbg.onExceptionUnwind = function(frame) {
    return undefined;
};
g.eval(`
var E;
f().catch(e => { exc = e });
drainJobQueue();
assertEq(exc instanceof ReferenceError, true);
`);

// Return with resumption value.
dbg.onExceptionUnwind = function(frame) {
    return {
        return: 10
    };
};
var val = g.eval(`
var val;
f().then(v => { val = v });
drainJobQueue();
val;
`);
assertEq(val, 10);