resolve-ignores-late-rejection.js (889B)
1 // |reftest| async 2 // Copyright (C) 2019 Leo Balter, 2020 Rick Waldron. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 description: > 7 Resolved promises ignore rejections through immediate invocation of the 8 provided resolving function 9 esid: sec-promise.any 10 info: | 11 5. Let result be PerformPromiseAny(iteratorRecord, C, promiseCapability). 12 13 Runtime Semantics: PerformPromiseAny 14 15 8. Repeat 16 ... 17 r. Perform ? Invoke(nextPromise, "then", « resultCapability.[[Resolve]], rejectElement »). 18 19 flags: [async] 20 features: [Promise.any, arrow-function] 21 ---*/ 22 23 var resolver = { 24 then(resolve) { 25 resolve(42); 26 } 27 }; 28 var lateRejector = { 29 then(resolve, reject) { 30 resolve(33); 31 reject(); 32 } 33 }; 34 35 Promise.any([resolver, lateRejector]) 36 .then(resolution => { 37 assert.sameValue(resolution, 42); 38 }).then($DONE, $DONE);