invoke-resolve-error-reject.js (1145B)
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 /*--- 6 description: Promise rejection in response to error 7 esid: sec-promise.all 8 info: | 9 11. Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability). 10 12. If result is an abrupt completion, 11 a. If iteratorRecord.[[done]] is false, let result be 12 IteratorClose(iterator, result). 13 b. IfAbruptRejectPromise(result, promiseCapability). 14 15 [...] 16 17 25.4.4.1.1 Runtime Semantics: PerformPromiseAll 18 19 [...] 20 6. Repeat 21 [...] 22 i. Let nextPromise be Invoke(constructor, "resolve", «nextValue»). 23 j. ReturnIfAbrupt(nextPromise ). 24 flags: [async] 25 ---*/ 26 27 var thrown = new Test262Error(); 28 Promise.resolve = function() { 29 throw thrown; 30 }; 31 32 Promise.all([1]) 33 .then(function() { 34 throw new Test262Error('The promise should not be fulfilled.'); 35 }, function(reason) { 36 if (reason !== thrown) { 37 throw new Test262Error('The promise should be rejected with the thrown error object'); 38 } 39 }).then($DONE, $DONE);