summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/promise/settle-now-breaks-all-invariants-5.js
blob: e5d2ceaafe096908cf2e513db99930319d0a8c11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Test we don't assert when the promise is settled and we then try to call the
// rejecting function.

function newPromiseCapability() {
    var resolve, reject, promise = new Promise(function(r1, r2) {
        resolve = r1;
        reject = r2;
    });
    return {promise, resolve, reject};
}


var {promise, reject} = newPromiseCapability();

settlePromiseNow(promise);

// Don't assert when the promise is already settled.
reject(0);