aboutsummaryrefslogtreecommitdiff
path: root/test/js/promise_s20.t.js
blob: 4c6a151d924d0ac51ee60f43a24e34cdffa6dcbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*---
includes: []
flags: [async]
---*/

var returnValue = null;
var value = {};
var poisonedThen = Object.defineProperty({}, 'then', {
    get: function() {
        throw value;
    }
});
var promise = new Promise(function(resolve) {
    returnValue = resolve(poisonedThen);
});

assert.sameValue(returnValue, undefined);

promise
.then(
    v => $DONOTEVALUATE(),
    e => {
        assert.sameValue(e, value, 'The promise should be fulfilled with the provided value.');
})
.then($DONE, $DONE);