reject-immed.js (963B)
1 // |reftest| async 2 // Copyright (C) 2016 the V8 project authors. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 /*--- 5 description: Rejecting through immediate invocation of the provided resolving function 6 es6id: 25.4.4.1 7 info: | 8 [...] 9 6. Let promiseCapability be NewPromiseCapability(C). 10 [...] 11 11. Let result be PerformPromiseAll(iteratorRecord, promiseCapability, C). 12 [...] 13 14 25.4.4.1.1 Runtime Semantics: PerformPromiseAll 15 [...] 16 6. Repeat 17 [...] 18 r. Let result be Invoke(nextPromise, "then", resolveElement, 19 promiseCapability.[[Reject]]ยป). 20 21 25.4.1.3.1 Promise Reject Functions 22 [...] 23 6. Return RejectPromise(promise, reason). 24 flags: [async] 25 ---*/ 26 27 var thenable = { 28 then: function(_, reject) { 29 reject(); 30 } 31 }; 32 33 Promise.all([thenable]) 34 .then(function() { 35 $DONE('The promise should not be fulfilled.'); 36 }, function(x) { 37 $DONE(); 38 });