tor-browser

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

reject-all-mixed.js (758B)


      1 // |reftest| async
      2 // Copyright (C) 2020 Rick Waldron. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 esid: sec-promise.any
      7 description: >
      8  Promise.any rejection reasons from various rejections are all present
      9 flags: [async]
     10 features: [Promise.any, arrow-function]
     11 ---*/
     12 
     13 let rejections = [
     14  Promise.reject('a'),
     15  new Promise((_, reject) => reject('b')),
     16  Promise.all([Promise.reject('c')]),
     17  Promise.resolve(Promise.reject('d')),
     18 ];
     19 
     20 Promise.any(rejections)
     21  .then(
     22    () => $DONE('The promise should be rejected, but was resolved'),
     23    error => {
     24      assert.sameValue(error.errors.length, rejections.length);
     25      assert.sameValue(error.errors.join(''), 'abcd');
     26    }
     27  ).then($DONE, $DONE);