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

Side by Side Diff: test/mjsunit/es6/typedarray-reduce.js

Issue 2793233003: Revert of [typedarrays] Check detached buffer at start of typed array methods (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « test/mjsunit/es6/typedarray-iteration.js ('k') | test/mjsunit/es6/typedarray-reverse.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
6
7 var typedArrayConstructors = [ 5 var typedArrayConstructors = [
8 Uint8Array, 6 Uint8Array,
9 Int8Array, 7 Int8Array,
10 Uint16Array, 8 Uint16Array,
11 Int16Array, 9 Int16Array,
12 Uint32Array, 10 Uint32Array,
13 Int32Array, 11 Int32Array,
14 Uint8ClampedArray, 12 Uint8ClampedArray,
15 Float32Array, 13 Float32Array,
16 Float64Array 14 Float64Array
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // Shadowing length doesn't affect every, unlike Array.prototype.every 240 // Shadowing length doesn't affect every, unlike Array.prototype.every
243 var a = new constructor([1, 2]); 241 var a = new constructor([1, 2]);
244 Object.defineProperty(a, 'length', {value: 1}); 242 Object.defineProperty(a, 'length', {value: 1});
245 assertEquals(a.reduce(sum, 0), 3); 243 assertEquals(a.reduce(sum, 0), 3);
246 assertEquals(Array.prototype.reduce.call(a, sum, 0), 1); 244 assertEquals(Array.prototype.reduce.call(a, sum, 0), 1);
247 assertEquals(a.reduceRight(sum, 0), 3); 245 assertEquals(a.reduceRight(sum, 0), 3);
248 assertEquals(Array.prototype.reduceRight.call(a, sum, 0), 1); 246 assertEquals(Array.prototype.reduceRight.call(a, sum, 0), 1);
249 247
250 assertEquals(1, constructor.prototype.reduce.length); 248 assertEquals(1, constructor.prototype.reduce.length);
251 assertEquals(1, constructor.prototype.reduceRight.length); 249 assertEquals(1, constructor.prototype.reduceRight.length);
252
253 // Detached Operation
254 var tmp = {
255 [Symbol.toPrimitive]() {
256 assertUnreachable("Parameter should not be processed when " +
257 "array.[[ViewedArrayBuffer]] is neutered.");
258 return 0;
259 }
260 };
261
262 var array = new constructor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
263 %ArrayBufferNeuter(array.buffer);
264 assertThrows(() => array.reduce(sum, tmp), TypeError);
265 assertThrows(() => array.reduceRight(sum, tmp), TypeError);
266 } 250 }
OLDNEW
« no previous file with comments | « test/mjsunit/es6/typedarray-iteration.js ('k') | test/mjsunit/es6/typedarray-reverse.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698