invoke-resolve-get-error.js (1016B)
1 // |reftest| async 2 // Copyright (C) 2015 the V8 project authors. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-promise.all 7 description: > 8 Promise.resolve is retrieved before GetIterator call (abrupt lookup). 9 info: | 10 Promise.all ( iterable ) 11 12 [...] 13 3. Let promiseResolve be GetPromiseResolve(C). 14 4. IfAbruptRejectPromise(promiseResolve, promiseCapability). 15 16 GetPromiseResolve ( promiseConstructor ) 17 18 [...] 19 2. Let promiseResolve be ? Get(promiseConstructor, "resolve"). 20 flags: [async] 21 features: [Symbol.iterator] 22 ---*/ 23 24 const iter = { 25 get [Symbol.iterator]() { 26 throw new Test262Error('unreachable'); 27 }, 28 }; 29 30 const resolveError = { name: 'MyError' }; 31 Object.defineProperty(Promise, 'resolve', { 32 get() { 33 throw resolveError; 34 }, 35 }); 36 37 Promise.all(iter).then(() => { 38 throw new Test262Error('The promise should be rejected, but it was resolved'); 39 }, (reason) => { 40 assert.sameValue(reason, resolveError); 41 }).then($DONE, $DONE);