summaryrefslogtreecommitdiffstats
path: root/js/src/builtin/Utilities.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/Utilities.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/Utilities.js')
-rw-r--r--js/src/builtin/Utilities.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/js/src/builtin/Utilities.js b/js/src/builtin/Utilities.js
index bfb1fe7f4..2dece3801 100644
--- a/js/src/builtin/Utilities.js
+++ b/js/src/builtin/Utilities.js
@@ -154,6 +154,29 @@ function GetIterator(obj, method) {
return iterator;
}
+// ES2017 draft rev 7.4.6.
+// When completion.[[Type]] is throw.
+function IteratorCloseThrow(iter) {
+ // Steps 1-2 (implicit)
+
+ // Step 3.
+ var returnMethod = GetMethod(iter, "return");
+
+ // Step 4 (done in caller).
+ if (returnMethod === undefined)
+ return;
+
+ try {
+ // Step 5.
+ callContentFunction(returnMethod, iter);
+ } catch (e) {
+ }
+
+ // Step 6 (done in caller).
+
+ // Steps 7-9 (skipped).
+}
+
var _builtinCtorsCache = {__proto__: null};
function GetBuiltinConstructor(builtinName) {