tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

try-throw-finally-reject.js (666B)


      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    throw "early-throw";
     17  } finally {
     18    await new Promise(function(resolve, reject) {
     19      reject("override");
     20    });
     21  }
     22 };
     23 
     24 f().then($DONE, function(value) {
     25  assert.sameValue(value, "override", "Awaited rejection in finally block");
     26 }).then($DONE, $DONE);