summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/promise/unhandled-rejections-different-realm.js
blob: 866a865e2dee4313ba4c17085dc5e82b1bcd8599 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// |jit-test| error:Unhandled rejection: "some reason"

// Test JS shell's unhandled rejection tracking.

var z = newGlobal();

Promise.prototype.then = z.Promise.prototype.then;

// Add unhandled rejection from other realm.
evalcx("var p = (async function() { throw 'some reason' })()", z);

// Add unhandled rejection from this realm.
var p = (async function f() { throw 'other reason'; })();

// Remove unhandled rejection from this realm.
p.then();

// Remove unhandled rejection from other realm.
evalcx("p.then()", z);