tor-browser

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

set-iterator-value-failure.js (799B)


      1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-set-constructor
      5 description: >
      6    Set ( [ iterable ] )
      7 
      8    When the Set function is called with optional argument iterable the following steps are taken:
      9 
     10    ...
     11    9. Repeat
     12      ...
     13      d. Let nextValue be IteratorValue(next).
     14      e. ReturnIfAbrupt(nextValue).
     15 features: [Symbol.iterator]
     16 ---*/
     17 
     18 var count = 0;
     19 var iterable = {};
     20 
     21 function MyError() {}
     22 iterable[Symbol.iterator] = function() {
     23  return {
     24    next: function() {
     25      return {
     26        get value() {
     27          throw new MyError();
     28        },
     29        done: false
     30      };
     31    }
     32  };
     33 };
     34 
     35 assert.throws(MyError, function() {
     36  new Set(iterable);
     37 });
     38 
     39 reportCompare(0, 0);