tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/reject-ignored-via-fn-deferred.js
raw symbols SCIP| 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: > |
| 5 | Resolved promises ignore rejections through deferred invocation of the |
| 6 | provided resolving function |
| 7 | es6id: 25.4.3.1 |
| 8 | info: | |
| 9 | [...] |
| 10 | 9. Let completion be Call(executor, undefined, |
| 11 | «resolvingFunctions.[[Resolve]], resolvingFunctions.[[Reject]]»). |
| 12 | 10. If completion is an abrupt completion, then |
| 13 | [...] |
| 14 | 11. Return promise. |
| 15 | |
| 16 | 25.4.1.3.1 Promise Reject Functions |
| 17 | [...] |
| 18 | 3. Let alreadyResolved be the value of F's [[AlreadyResolved]] internal |
| 19 | slot. |
| 20 | 4. If alreadyResolved.[[value]] is true, return undefined. |
| 21 | flags: [async] |
| 22 | ---*/ |
| 23 | |
| 24 | var returnValue = null; |
| 25 | var thenable = new Promise(function() {}); |
| 26 | var resolve, reject; |
| 27 | var p = new Promise(function(_resolve, _reject) { |
| 28 | resolve = _resolve; |
| 29 | reject = _reject; |
| 30 | }); |
| 31 | |
| 32 | p.then(function() { |
| 33 | $DONE(); |
| 34 | }, function() { |
| 35 | $DONE('The promise should not be rejected.'); |
| 36 | }); |
| 37 | |
| 38 | resolve(); |
| 39 | returnValue = reject(thenable); |
| 40 | |
| 41 | assert.sameValue(returnValue, undefined, '"reject" function return value'); |