capability-invocation-error.js (821B)
1 // Copyright (C) 2016 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 description: Abrupt completion returned by "resolve" capability 5 esid: sec-promise.resolve 6 info: | 7 1. Let C be the this value. 8 [...] 9 4. Let promiseCapability be ? NewPromiseCapability(C). 10 5. Perform ? Call(promiseCapability.[[Resolve]], undefined, « x »). 11 12 25.4.1.5 NewPromiseCapability 13 [...] 14 6. Let promise be Construct(C, «executor»). 15 7. ReturnIfAbrupt(promise). 16 ---*/ 17 18 var P = function(executor) { 19 return new Promise(function() { 20 executor( 21 function() { 22 throw new Test262Error(); 23 }, 24 function() {} 25 ); 26 }); 27 }; 28 29 assert.throws(Test262Error, function() { 30 Promise.resolve.call(P); 31 }); 32 33 reportCompare(0, 0);