summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/promise/settle-now-breaks-all-invariants-7.js
blob: d6920f9b79d27b3b701cb1c61acfb23be166a9f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Don't assert when a side-effect when getting the "then" property settled the promise.

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


var {promise, resolve} = newPromiseCapability();

var thenable = {
    get then() {
        settlePromiseNow(promise);

        // Throw an error to reject the promise.
        throw new Error();
    }
};

resolve(thenable);