summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/Map-iterator-add-1.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/collections/Map-iterator-add-1.js')
-rw-r--r--js/src/jit-test/tests/collections/Map-iterator-add-1.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/collections/Map-iterator-add-1.js b/js/src/jit-test/tests/collections/Map-iterator-add-1.js
new file mode 100644
index 000000000..495ad6288
--- /dev/null
+++ b/js/src/jit-test/tests/collections/Map-iterator-add-1.js
@@ -0,0 +1,15 @@
+// map.iterator() is live: entries added during iteration are visited.
+
+var map = new Map();
+function force(k) {
+ if (!map.has(k) && k >= 0)
+ map.set(k, k - 1);
+}
+force(5);
+var log = '';
+for (let [k, v] of map) {
+ log += k + ';';
+ force(v);
+}
+assertEq(log, '5;4;3;2;1;0;');
+assertEq(map.size, 6);