Index: test/mjsunit/es6/typedarray-indexing.js |
diff --git a/test/mjsunit/es6/typedarray-indexing.js b/test/mjsunit/es6/typedarray-indexing.js |
index 1c439f9ddac48ea7efd847e59be70cf97e981f5c..d12a1570c2215153f42cb6340530b4fe3e1eb969 100644 |
--- a/test/mjsunit/es6/typedarray-indexing.js |
+++ b/test/mjsunit/es6/typedarray-indexing.js |
@@ -2,6 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+// Flags: --allow-natives-syntax |
+ |
var typedArrayConstructors = [ |
Uint8Array, |
Int8Array, |
@@ -14,6 +16,14 @@ var typedArrayConstructors = [ |
Float64Array |
]; |
+var tmp = { |
+ [Symbol.toPrimitive]() { |
+ assertUnreachable("Parameter should not be processed when " + |
+ "array.[[ViewedArrayBuffer]] is neutered."); |
+ return 0; |
+ } |
+}; |
+ |
for (var constructor of typedArrayConstructors) { |
var array = new constructor([1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]); |
@@ -53,6 +63,11 @@ for (var constructor of typedArrayConstructors) { |
} |
assertEquals(-1, array.indexOf(NaN)); |
+ // Detached Operation |
+ var array = new constructor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); |
+ %ArrayBufferNeuter(array.buffer); |
+ assertThrows(() => array.indexOf(tmp), TypeError); |
+ |
// ---------------------------------------------------------------------- |
// %TypedArray%.prototype.lastIndexOf. |
// ---------------------------------------------------------------------- |
@@ -89,4 +104,9 @@ for (var constructor of typedArrayConstructors) { |
assertEquals(-1, array.lastIndexOf(-Infinity)); |
} |
assertEquals(-1, array.lastIndexOf(NaN)); |
+ |
+ // Detached Operation |
+ var array = new constructor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); |
+ %ArrayBufferNeuter(array.buffer); |
+ assertThrows(() => array.lastIndexOf(tmp), TypeError); |
} |