blob: 28983a300e8d9d4190a8227222e46513c7598ac8 [file] [log] [blame]
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00001// Copyright (C) 2016 the V8 project authors. All rights reserved.
2// This code is governed by the BSD license found in the LICENSE file.
3/*---
4description: Resolving with an object with a "poisoned" then property
5es6id: 25.4.4.5
6info: >
7 [...]
8 6. Let resolveResult be Call(promiseCapability.[[Resolve]], undefined,
9 «x»).
10 [...]
11
12 25.4.1.3.2 Promise Resolve Functions
13 [...]
14 8. Let then be Get(resolution, "then").
15 9. If then is an abrupt completion, then
16 a. Return RejectPromise(promise, then.[[value]]).
17flags: [async]
18---*/
19
20var value = {};
21var resolve;
22var poisonedThen = Object.defineProperty({}, 'then', {
23 get: function() {
24 throw value;
25 }
26});
27
28Promise.resolve(poisonedThen).then(function() {
29 $DONE('The promise should not be fulfilled.');
30 }, function(val) {
31 if (val !== value) {
32 $DONE('The promise should be rejected with the provided value.');
33 return;
34 }
35
36 $DONE();
37 });