tor-browser

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

iterator-next-throws.js (756B)


      1 // Copyright (c) 2023 Ecma International.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-map.groupby
      6 description: Map.groupBy throws when iterator next throws
      7 info: |
      8  Map.groupBy ( items, callbackfn )
      9 
     10  ...
     11 
     12  GroupBy ( items, callbackfn, coercion )
     13 
     14  6. Repeat,
     15    b. Let next be ? IteratorStep(iteratorRecord).
     16 
     17  ...
     18 features: [array-grouping, Map, Symbol.iterator]
     19 ---*/
     20 
     21 const throwingIterator = {
     22  [Symbol.iterator]: function () {
     23    return this;
     24  },
     25  next: function next() {
     26    throw new Test262Error('next() method was called');
     27  }
     28 };
     29 
     30 assert.throws(Test262Error, function () {
     31  Map.groupBy(throwingIterator, function () {
     32    return 'key';
     33  });
     34 });
     35 
     36 reportCompare(0, 0);