blob: bfdc586c066e7f90b151f4478b35aff7e8d2cac1 (
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
|
load(libdir + "asserts.js");
var g = newGlobal({newCompartment: true})
// Throw an exception from a different compartment.
var thrower = g.Function(`
throw 0;
`);
async function throwAndAwait() {
try {
thrower();
} finally {
// The |finally| block is entered with the exception stack on the function
// stack. The function stack is saved in the generator object when executing
// |await|, so the exception stack, which was created in a different
// compartment, has to be wrapped into the current compartment.
await {};
}
}
throwAndAwait().then(() => {
throw new Error("missing error");
}, e => {
assertEq(e, 0);
});
|