reject-ignored-deferred.js (1478B)
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: > 6 Resolved promises ignore rejections through deferred invocation of the 7 provided resolving function 8 es6id: 25.4.4.1 9 info: | 10 [...] 11 6. Let promiseCapability be NewPromiseCapability(C). 12 [...] 13 11. Let result be PerformPromiseAll(iteratorRecord, promiseCapability, C). 14 [...] 15 16 25.4.4.1.1 Runtime Semantics: PerformPromiseAll 17 [...] 18 6. Repeat 19 [...] 20 r. Let result be Invoke(nextPromise, "then", resolveElement, 21 promiseCapability.[[Reject]]ยป). 22 23 25.4.1.3.1 Promise Reject Functions 24 [...] 25 2. Let promise be the value of F's [[Promise]] internal slot. 26 3. Let alreadyResolved be the value of F's [[AlreadyResolved]] internal 27 slot. 28 4. If alreadyResolved.[[value]] is true, return undefined. 29 flags: [async] 30 ---*/ 31 32 var fulfiller = { 33 then: function(resolve) { 34 new Promise(function(resolve) { 35 resolve(); 36 }) 37 .then(function() { 38 resolve(); 39 }); 40 } 41 }; 42 var rejector = { 43 then: function(resolve, reject) { 44 new Promise(function(resolve) { 45 resolve(); 46 }) 47 .then(function() { 48 resolve(); 49 reject(); 50 }); 51 } 52 }; 53 54 Promise.all([fulfiller, rejector]) 55 .then(function() { 56 $DONE(); 57 }, function() { 58 $DONE('The promise should not be rejected.'); 59 });