tor-browser

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

result-proto.js (986B)


      1 // Copyright (C) 2023 Michael Ficarra. 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  The value of the [[Prototype]] internal slot of the return value of Iterator.from is the
      7  intrinsic object %WrapForValidIteratorPrototype%, whose [[Prototype]] is %IteratorHelperPrototype%.
      8 features: [iterator-helpers]
      9 ---*/
     10 let iter = {
     11  next() {
     12    return {
     13      done: true,
     14      value: undefined,
     15    };
     16  },
     17 };
     18 
     19 const WrapForValidIteratorPrototype = Object.getPrototypeOf(Iterator.from(iter));
     20 
     21 assert.sameValue(Object.getPrototypeOf(WrapForValidIteratorPrototype), Iterator.prototype);
     22 
     23 class SubIterator extends Iterator {}
     24 assert.sameValue(Object.getPrototypeOf(SubIterator.from(iter)), WrapForValidIteratorPrototype);
     25 
     26 function* g() {}
     27 const GeneratorPrototype = Object.getPrototypeOf(g());
     28 
     29 assert.sameValue(Object.getPrototypeOf(Iterator.from(g())), GeneratorPrototype);
     30 
     31 reportCompare(0, 0);