try-reject-finally-reject.js (729B)
1 // |reftest| async 2 // Copyright 2017 Caitlin Potter. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 author: Caitlin Potter <caitp@igalia.com> 7 esid: pending 8 description: > 9 Implementations must defer rejecting an async function's Promise until after 10 all finally blocks have been evaluated. 11 flags: [async] 12 ---*/ 13 14 var f = async function() { 15 try { 16 await new Promise(function(resolve, reject) { 17 reject("early-reject"); 18 }); 19 } finally { 20 await new Promise(function(resolve, reject) { 21 reject("override"); 22 }); 23 } 24 }; 25 26 f().then($DONE, function(value) { 27 assert.sameValue(value, "override", "Awaited rejection in finally block"); 28 }).then($DONE, $DONE);