Index: test/mjsunit/es6/typedarray-every.js |
diff --git a/test/mjsunit/es6/typedarray-every.js b/test/mjsunit/es6/typedarray-every.js |
index 22132f32b16b54fdc6959849c907c5d4c9f92925..4ceee5f3aa578eb42c779b0b5b54a49eefd5461b 100644 |
--- a/test/mjsunit/es6/typedarray-every.js |
+++ b/test/mjsunit/es6/typedarray-every.js |
@@ -98,6 +98,20 @@ function TestTypedArrayForEach(constructor) { |
CheckTypedArrayIsNeutered(a); |
assertEquals(undefined, a[0]); |
+ // Calling array.buffer midway can change the backing store. |
+ a = new constructor(5); |
+ a[0] = 42; |
+ result = a.every(function (n, index, array) { |
+ assertSame(a, array); |
+ if (index == 2) { |
+ (new constructor(array.buffer))[(index + 1) % 5] = 42; |
+ } else { |
+ a[(index+1)%5] = 42 |
+ } |
+ return n == 42; |
+ }); |
+ assertEquals(true, result); |
+ |
// The method must work for typed arrays created from ArrayBuffer. |
// The length of the ArrayBuffer is chosen so it is a multiple of |
// all lengths of the typed array items. |