tor-browser

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

non-constructible.js (683B)


      1 // Copyright (C) 2020 Rick Waldron. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-iterator.from
      5 description: >
      6  Iterator.from is not constructible.
      7 
      8  Built-in function objects that are not identified as constructors do not implement the [[Construct]] internal method unless otherwise specified in the description of a particular function.
      9 features: [iterator-helpers]
     10 ---*/
     11 function* g() {}
     12 
     13 assert.throws(TypeError, () => {
     14  new Iterator.from();
     15 });
     16 
     17 assert.throws(TypeError, () => {
     18  new Iterator.from(g());
     19 });
     20 
     21 assert.throws(TypeError, () => {
     22  new class extends Iterator {}.from(g());
     23 });
     24 
     25 reportCompare(0, 0);