OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --allow-natives-syntax | 5 // Flags: --allow-natives-syntax |
6 | 6 |
7 var typedArrayConstructors = [ | 7 var typedArrayConstructors = [ |
8 Uint8Array, | 8 Uint8Array, |
9 Int8Array, | 9 Int8Array, |
10 Uint16Array, | 10 Uint16Array, |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 [Symbol.toPrimitive]() { | 233 [Symbol.toPrimitive]() { |
234 assertUnreachable("Parameter should not be processed when " + | 234 assertUnreachable("Parameter should not be processed when " + |
235 "array.[[ViewedArrayBuffer]] is neutered."); | 235 "array.[[ViewedArrayBuffer]] is neutered."); |
236 return 0; | 236 return 0; |
237 } | 237 } |
238 }; | 238 }; |
239 | 239 |
240 var array = new constructor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); | 240 var array = new constructor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); |
241 %ArrayBufferNeuter(array.buffer); | 241 %ArrayBufferNeuter(array.buffer); |
242 | 242 |
243 // TODO(caitp): this should throw due to being invoked on a TypedArray with a | 243 assertThrows(() => array.copyWithin(tmp, tmp, tmp), TypeError); |
244 // detached buffer (per v8:4648). | |
245 array.copyWithin(tmp, tmp, tmp); | |
246 assertEquals(0, array.length, "array.[[ViewedArrayBuffer]] is detached"); | 244 assertEquals(0, array.length, "array.[[ViewedArrayBuffer]] is detached"); |
247 }); | 245 }); |
OLD | NEW |