summaryrefslogtreecommitdiffstats
path: root/js/src/builtin/Map.js
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-15 21:11:35 +0100
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-15 21:11:35 +0100
commit75c9377766326589faa844a95d5997a156f6aed0 (patch)
treea2605876ee1a97a3a727d21a72b69c5a10a89664 /js/src/builtin/Map.js
parent0d3ee51ad2d61bffba14232b2df913d3a773d771 (diff)
downloadUXP-75c9377766326589faa844a95d5997a156f6aed0.tar
UXP-75c9377766326589faa844a95d5997a156f6aed0.tar.gz
UXP-75c9377766326589faa844a95d5997a156f6aed0.tar.lz
UXP-75c9377766326589faa844a95d5997a156f6aed0.tar.xz
UXP-75c9377766326589faa844a95d5997a156f6aed0.zip
Close iterator after error in {Map,Set,WeakMap,WeakSet} constructors
Issue #17
Diffstat (limited to 'js/src/builtin/Map.js')
-rw-r--r--js/src/builtin/Map.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/js/src/builtin/Map.js b/js/src/builtin/Map.js
index 432364614..27a12bfff 100644
--- a/js/src/builtin/Map.js
+++ b/js/src/builtin/Map.js
@@ -40,11 +40,18 @@ function MapConstructorInit(iterable) {
var nextItem = next.value;
// Step 8.d.
- if (!IsObject(nextItem))
+ if (!IsObject(nextItem)) {
+ IteratorCloseThrow(iter);
ThrowTypeError(JSMSG_INVALID_MAP_ITERABLE, "Map");
+ }
// Steps 8.e-j.
- callContentFunction(adder, map, nextItem[0], nextItem[1]);
+ try {
+ callContentFunction(adder, map, nextItem[0], nextItem[1]);
+ } catch (e) {
+ IteratorCloseThrow(iter);
+ throw e;
+ }
}
}