tor-browser

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

S25.4.4.3_A4.1_T2.js (906B)


      1 // |reftest| async
      2 // Copyright 2014 Cubane Canada, Inc.  All rights reserved.
      3 // See LICENSE for details.
      4 
      5 /*---
      6 es6id: S25.4.4.3_A4.1_T2
      7 author: Sam Mikes
      8 description: Promise.race rejects if IteratorStep throws
      9 features: [Symbol.iterator]
     10 flags: [async]
     11 ---*/
     12 
     13 var iterThrows = {};
     14 Object.defineProperty(iterThrows, Symbol.iterator, {
     15  get: function() {
     16    return {
     17      next: function() {
     18        var v = {};
     19        Object.defineProperty(v, 'value', {
     20          get: function() {
     21            throw new Error("abrupt completion");
     22          }
     23        });
     24        return v;
     25      }
     26    };
     27  }
     28 });
     29 
     30 Promise.race(iterThrows).then(function() {
     31  throw new Test262Error('Promise unexpectedly fulfilled: Promise.race(iterThrows) should throw TypeError');
     32 }, function(err) {
     33  assert(!!(err instanceof TypeError), 'The value of !!(err instanceof TypeError) is expected to be true');
     34 }).then($DONE, $DONE);