map-expand-contract.js (651B)
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 not be 8 visited if they are removed prior to visitation. 9 es6id: 13.6.4 10 features: [Map] 11 ---*/ 12 13 var map = new Map(); 14 var iterationCount = 0; 15 16 map.set(0, 'a'); 17 18 for (var x of map) { 19 assert.sameValue(x[0], 0); 20 assert.sameValue(x[1], 'a'); 21 22 map.set(1, 'b'); 23 map.delete(1); 24 25 iterationCount += 1; 26 } 27 28 assert.sameValue(iterationCount, 1); 29 30 reportCompare(0, 0);