invoke-resolve.js (990B)
1 // |reftest| async 2 // Copyright (C) 2019 Sergey Rubanov, 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 Invocation of the constructor's `resolve` method 8 esid: sec-promise.any 9 info: | 10 5. Let result be PerformPromiseAny(iteratorRecord, C, promiseCapability). 11 12 Runtime Semantics: PerformPromiseAny 13 14 8. Repeat 15 ... 16 i. Let nextPromise be ? Call(promiseResolve, constructor, « nextValue »). 17 ... 18 r. Perform ? Invoke(nextPromise, "then", « resultCapability.[[Resolve]], rejectElement »). 19 20 flags: [async] 21 features: [Promise.any, arrow-function] 22 ---*/ 23 24 let boundPromiseResolve = Promise.resolve.bind(Promise); 25 26 Promise.resolve = function(...args) { 27 assert.sameValue(args.length, 1, '`resolve` invoked with a single argument'); 28 assert.sameValue(this, Promise, '`this` value is the constructor'); 29 return boundPromiseResolve(...args); 30 }; 31 32 Promise.any([1]).then(() => $DONE(), $DONE);