tor-browser

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

map-expand.js (684B)


      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 /*---
      5 description: Map entry insertion during traversal using for..of
      6 info: |
      7    New entries inserted into a Map instance during traversal should be
      8    visited.
      9 es6id: 13.6.4
     10 features: [Map]
     11 ---*/
     12 
     13 var map = new Map();
     14 var iterationCount = 0;
     15 
     16 var first = [0, 'a'];
     17 var second = [1, 'b'];
     18 
     19 map.set(0, 'a');
     20 
     21 for (var x of map) {
     22  assert.sameValue(x[0], first[0]);
     23  assert.sameValue(x[1], first[1]);
     24 
     25  first = second;
     26  second = null;
     27 
     28  map.set(1, 'b');
     29 
     30  iterationCount += 1;
     31 }
     32 
     33 assert.sameValue(iterationCount, 2);
     34 
     35 reportCompare(0, 0);