aboutsummaryrefslogtreecommitdiff
path: root/test/js/promise_s21.t.js
blob: 77689f6f68d96528ffe66398a633ca5b48f77e57 (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
26
27
28
29
30
31
32
/*---
includes: []
flags: [async]
---*/

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

var p1 = new Promise(function(_resolve) {
    resolve = _resolve;
});

var p2;

p2 = p1.then(function() {
    return poisonedThen;
});

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

resolve();