diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-03-16 08:36:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-16 08:36:30 +0100 |
commit | 11bdaa144d8a38ecd897dde278cb1db9b8313961 (patch) | |
tree | 1ca375db23843dcd4c593bcb28d7173856bddc10 /js/src/builtin/Utilities.js | |
parent | 0d3ee51ad2d61bffba14232b2df913d3a773d771 (diff) | |
parent | 114794557687aebca601c38ba0f0a52a43b44d4a (diff) | |
download | UXP-11bdaa144d8a38ecd897dde278cb1db9b8313961.tar UXP-11bdaa144d8a38ecd897dde278cb1db9b8313961.tar.gz UXP-11bdaa144d8a38ecd897dde278cb1db9b8313961.tar.lz UXP-11bdaa144d8a38ecd897dde278cb1db9b8313961.tar.xz UXP-11bdaa144d8a38ecd897dde278cb1db9b8313961.zip |
Merge pull request #66 from janekptacijarabaci/js_iterable_closures_1
Close iterator after error in: Map, Set, WeakMap, WeakSet, Array.from, Promise.{all,race}
Diffstat (limited to 'js/src/builtin/Utilities.js')
-rw-r--r-- | js/src/builtin/Utilities.js | 23 |
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) { |