invoke-resolve-get-error-reject.js (1210B)
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 description: > 7 Error retrieving the constructor's `resolve` method (rejecting promise) 8 esid: sec-performpromiseall 9 info: | 10 11. Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability). 11 12. If result is an abrupt completion, 12 a. If iteratorRecord.[[done]] is false, let result be 13 IteratorClose(iterator, result). 14 b. IfAbruptRejectPromise(result, promiseCapability). 15 16 [...] 17 18 Runtime Semantics: PerformPromiseAll 19 20 ... 21 1. Let promiseResolve be ? Get(constructor, `"resolve"`). 22 ... 23 1. Repeat, 24 1. Let next be IteratorStep(iteratorRecord). 25 ... 26 1. Let nextPromise be ? Call(promiseResolve, constructor, < nextValue >). 27 flags: [async] 28 ---*/ 29 30 var error = new Test262Error(); 31 Object.defineProperty(Promise, 'resolve', { 32 get: function() { 33 throw error; 34 } 35 }); 36 37 Promise.all([new Promise(function() {})]).then(function() { 38 throw new Test262Error('The promise should be rejected'); 39 }, function(reason) { 40 assert.sameValue(reason, error); 41 }).then($DONE, $DONE);