Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: test/mjsunit/es6/typedarray-slice.js

Issue 2827443002: Reland [typedarrays] Check detached buffer at start of typed array methods (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/es6/typedarray-reverse.js ('k') | test/mjsunit/es6/typedarray-sort.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/typedarray-slice.js
diff --git a/test/mjsunit/es6/typedarray-slice.js b/test/mjsunit/es6/typedarray-slice.js
index 046908b76d85a882959164379bb53bbf5a8df6ab..2ec7152d50a8f0ca0b801bf09466035c3becaf82 100644
--- a/test/mjsunit/es6/typedarray-slice.js
+++ b/test/mjsunit/es6/typedarray-slice.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,
@@ -67,6 +69,18 @@ for (var constructor of typedArrayConstructors) {
assertEquals(3, slice[1]);
assertTrue(slice instanceof constructor);
+ // Detached Operation
+ var tmp = {
+ [Symbol.toPrimitive]() {
+ assertUnreachable("Parameter should not be processed when " +
+ "array.[[ViewedArrayBuffer]] is neutered.");
+ return 0;
+ }
+ };
+ var array = new constructor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
+ %ArrayBufferNeuter(array.buffer);
+ assertThrows(() => array.slice(tmp, tmp), TypeError);
+
// Check that the species array must be a typed array
class MyTypedArray extends constructor {
static get[Symbol.species]() {
« no previous file with comments | « test/mjsunit/es6/typedarray-reverse.js ('k') | test/mjsunit/es6/typedarray-sort.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698