reject-via-abrupt.js (1028B)
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 description: Rejecting through an abrupt completion 6 es6id: 25.4.3.1 7 info: | 8 [...] 9 9. Let completion be Call(executor, undefined, 10 «resolvingFunctions.[[Resolve]], resolvingFunctions.[[Reject]]»). 11 10. If completion is an abrupt completion, then 12 a. Let status be Call(resolvingFunctions.[[Reject]], undefined, 13 «completion.[[value]]»). 14 b. ReturnIfAbrupt(status). 15 11. Return promise. 16 17 25.4.1.3.1 Promise Reject Functions 18 [...] 19 6. Return RejectPromise(promise, reason). 20 flags: [async] 21 ---*/ 22 23 var thenable = new Promise(function() {}); 24 var p = new Promise(function() { 25 throw thenable; 26 }); 27 28 p.then(function() { 29 $DONE('The promise should not be fulfilled.'); 30 }, function(x) { 31 if (x !== thenable) { 32 $DONE('The promise should be rejected with the resolution value.'); 33 return; 34 } 35 36 $DONE(); 37 });