summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/promise/allSettled-dead.js
blob: 8ae8e53d6bbb319b7e08d203b9c3607502b0c0b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
newGlobal();
const g = newGlobal({
    "newCompartment": true,
});
const p1 = g.eval(`
Promise.resolve();
`);
const p2 = p1.then();
nukeAllCCWs();
ignoreUnhandledRejections();
Promise.resolve = function() {
  return p2;
};
let caught = false;
Promise.allSettled([1]).catch(e => {
  caught = true;
  assertEq(e.message.includes("dead object"), true);
});
drainJobQueue();
assertEq(caught, true);