Index: test/mjsunit/es6/typedarray.js |
diff --git a/test/mjsunit/es6/typedarray.js b/test/mjsunit/es6/typedarray.js |
index b1bd8937bea07e0028759b33fa4334043db99bb8..ca68db96c92a486a369dfdea4e55364f69a04433 100644 |
--- a/test/mjsunit/es6/typedarray.js |
+++ b/test/mjsunit/es6/typedarray.js |
@@ -334,6 +334,31 @@ function TestTypedArray(constr, elementSize, typicalElement) { |
assertEquals(0, genArr[0]); |
assertEquals(9, genArr[9]); |
assertEquals(1, iteratorReadCount); |
+ |
+ // Modified %ArrayIteratorPrototype%.next() method is honoured (v8:5699) |
+ const ArrayIteratorPrototype = Object.getPrototypeOf([][Symbol.iterator]()); |
+ const ArrayIteratorPrototypeNext = ArrayIteratorPrototype.next; |
+ ArrayIteratorPrototype.next = function() { |
+ return { done: true }; |
+ }; |
+ genArr = new constr([1, 2, 3]); |
+ assertEquals(0, genArr.length); |
+ ArrayIteratorPrototype.next = ArrayIteratorPrototypeNext; |
+ |
+ // Modified %ArrayIteratorPrototype%.next() during iteration is honoured as |
+ // well. |
+ genArr = new constr(Object.defineProperty([1, , 3], 1, { |
+ get() { |
+ ArrayIteratorPrototype.next = function() { |
+ return { done: true }; |
+ } |
+ return 2; |
+ } |
+ })); |
+ assertEquals(2, genArr.length); |
+ assertEquals(1, genArr[0]); |
+ assertEquals(2, genArr[1]); |
+ ArrayIteratorPrototype.next = ArrayIteratorPrototypeNext; |
} |
TestTypedArray(Uint8Array, 1, 0xFF); |