summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/promise/settle-now-breaks-all-invariants-4.js
blob: a9d147ccaa653f6166d5bdc48e01292763c6cc41 (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
// resolving function.

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


var {promise, resolve} = newPromiseCapability();

settlePromiseNow(promise);

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