summaryrefslogtreecommitdiffstats
path: root/js/src/tests
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-25 14:48:34 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-25 14:48:34 +0200
commite7a220aae2dd6f92c57b92fdd08ff94e5826c035 (patch)
tree3f26d96607aaa80bcafe946f994d332e8e7cb0c5 /js/src/tests
parent6056525ced07af6c6c4f48ea605a2f4589821fdf (diff)
downloadUXP-e7a220aae2dd6f92c57b92fdd08ff94e5826c035.tar
UXP-e7a220aae2dd6f92c57b92fdd08ff94e5826c035.tar.gz
UXP-e7a220aae2dd6f92c57b92fdd08ff94e5826c035.tar.lz
UXP-e7a220aae2dd6f92c57b92fdd08ff94e5826c035.tar.xz
UXP-e7a220aae2dd6f92c57b92fdd08ff94e5826c035.zip
Bug 1331585 - Allow falsy "done" values for IteratorClose due to exception during array destructuring
Issue #74
Diffstat (limited to 'js/src/tests')
-rw-r--r--js/src/tests/ecma_6/Destructuring/array-iterator-close.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/js/src/tests/ecma_6/Destructuring/array-iterator-close.js b/js/src/tests/ecma_6/Destructuring/array-iterator-close.js
index f7805540d..ed35135db 100644
--- a/js/src/tests/ecma_6/Destructuring/array-iterator-close.js
+++ b/js/src/tests/ecma_6/Destructuring/array-iterator-close.js
@@ -43,6 +43,22 @@ function test() {
}, "in lhs");
assertEq(returnCalled, ++returnCalledExpected);
+ // throw in lhs ref calls IteratorClose with falsy "done".
+ iterable[Symbol.iterator] = makeIterator({
+ next: function() {
+ // "done" is undefined.
+ return {};
+ },
+ ret: function() {
+ returnCalled++;
+ return {};
+ }
+ });
+ assertThrowsValue(function() {
+ 0, [...{}[throwlhs()]] = iterable;
+ }, "in lhs");
+ assertEq(returnCalled, ++returnCalledExpected);
+
// throw in iter.next doesn't call IteratorClose
iterable[Symbol.iterator] = makeIterator({
next: function() {