tor-browser

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

S25.4.4.1_A3.1_T3.js (842B)


      1 // |reftest| async
      2 // Copyright 2014 Cubane Canada, Inc.  All rights reserved.
      3 // See LICENSE for details.
      4 
      5 /*---
      6 info: |
      7    Promise.all expects an iterable argument;
      8    fails if GetIterator returns an abrupt completion.
      9 es6id: S25.4.4.1_A3.1_T3
     10 author: Sam Mikes
     11 description: Promise.all((throw on GetIterator)) returns Promise rejected with TypeError
     12 features: [Symbol.iterator]
     13 flags: [async]
     14 ---*/
     15 
     16 var iterThrows = {};
     17 Object.defineProperty(iterThrows, Symbol.iterator, {
     18  get: function() {
     19    throw new Error("abrupt completion");
     20  }
     21 });
     22 
     23 Promise.all(iterThrows).then(function() {
     24  throw new Test262Error('Promise unexpectedly fulfilled: Promise.all(iterThrows) should throw TypeError');
     25 }, function(err) {
     26  assert(!!(err instanceof Error), 'The value of !!(err instanceof Error) is expected to be true');
     27 }).then($DONE, $DONE);