tor-browser

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

empty-iterable.js (808B)


      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-weakset-iterable
      5 description: >
      6  If the iterable argument is empty, return new Weakset object.
      7 info: |
      8  23.4.1.1 WeakSet ( [ iterable ] )
      9 
     10  ...
     11  9. Repeat
     12    a. Let next be IteratorStep(iter).
     13    b. ReturnIfAbrupt(next).
     14    c. If next is false, return set.
     15  ...
     16 ---*/
     17 
     18 var counter = 0;
     19 var add = WeakSet.prototype.add;
     20 WeakSet.prototype.add = function(value) {
     21  counter++;
     22  return add.call(this, value);
     23 };
     24 var set = new WeakSet([]);
     25 
     26 assert.sameValue(Object.getPrototypeOf(set), WeakSet.prototype);
     27 assert(set instanceof WeakSet);
     28 assert.sameValue(
     29  counter, 0,
     30  'empty iterable does not call WeakSet.prototype.add'
     31 );
     32 
     33 reportCompare(0, 0);