Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/resolve/resolve-non-thenable.js

raw
1 // 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 /*---
4 description: Resolving with a non-thenable object value
5 es6id: 25.4.4.5
6 info: |
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 [...]
17 10. Let thenAction be then.[[value]].
18 11. If IsCallable(thenAction) is false, then
19 a. Return FulfillPromise(promise, resolution).
20 flags: [async]
21 ---*/
22
23 var value = {};
24
25 Promise.resolve(value).then(function(value) {
26 if (value !== value) {
27 $DONE('The promise should be fulfilled with the provided value.');
28 return;
29 }
30
31 $DONE();
32 }, function() {
33 $DONE('The promise should not be rejected.');
34 });