summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/for-of/next-2.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/for-of/next-2.js')
-rw-r--r--js/src/jit-test/tests/for-of/next-2.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/for-of/next-2.js b/js/src/jit-test/tests/for-of/next-2.js
new file mode 100644
index 000000000..e557ab7a8
--- /dev/null
+++ b/js/src/jit-test/tests/for-of/next-2.js
@@ -0,0 +1,8 @@
+// Iterator.prototype.next throws if applied to a non-iterator that inherits from an iterator.
+
+load(libdir + "asserts.js");
+load(libdir + "iteration.js");
+
+var it = [1, 2][Symbol.iterator]();
+var v = Object.create(it);
+assertThrowsInstanceOf(function () { Iterator.prototype.next.call(v); }, TypeError);