summaryrefslogtreecommitdiff
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
commit8c7748c60d828ad9599a6f18657cdb3da805ad69 (patch)
tree3f26d96607aaa80bcafe946f994d332e8e7cb0c5 /js/src/tests
parent6a5cd960ac2b92a60e1a525f80de2f59f250395f (diff)
downloaduxp-8c7748c60d828ad9599a6f18657cdb3da805ad69.tar.gz
Bug 1331585 - Allow falsy "done" values for IteratorClose due to exception during array destructuring
Issue mcp-graveyard/UXP#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 f7805540d6..ed35135dba 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() {