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

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

Issue 2778623003: [typedarrays] Check detached buffer at start of typed array methods (Closed)
Patch Set: pass test262 for subarray 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-reduce.js ('k') | test/mjsunit/es6/typedarray-slice.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
5 function ArrayMaker(x) { 7 function ArrayMaker(x) {
6 return x; 8 return x;
7 } 9 }
8 ArrayMaker.prototype = Array.prototype; 10 ArrayMaker.prototype = Array.prototype;
9 11
10 var arrayConstructors = [ 12 var arrayConstructors = [
11 Uint8Array, 13 Uint8Array,
12 Int8Array, 14 Int8Array,
13 Uint16Array, 15 Uint16Array,
14 Int16Array, 16 Int16Array,
(...skipping 29 matching lines...) Expand all
44 } else { 46 } else {
45 // Array.reverse works on array-like objects 47 // Array.reverse works on array-like objects
46 var x = { length: 2, 1: 5 }; 48 var x = { length: 2, 1: 5 };
47 a.reverse.call(x); 49 a.reverse.call(x);
48 assertEquals(2, x.length); 50 assertEquals(2, x.length);
49 assertFalse(Object.hasOwnProperty(x, '1')); 51 assertFalse(Object.hasOwnProperty(x, '1'));
50 assertEquals(5, x[0]); 52 assertEquals(5, x[0]);
51 } 53 }
52 54
53 assertEquals(0, a.reverse.length); 55 assertEquals(0, a.reverse.length);
56
57 // Detached Operation
58 if (constructor != ArrayMaker) {
59 var array = new constructor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
60 %ArrayBufferNeuter(array.buffer);
61 assertThrows(() => array.reverse(), TypeError);
62 }
54 } 63 }
OLDNEW
« no previous file with comments | « test/mjsunit/es6/typedarray-reduce.js ('k') | test/mjsunit/es6/typedarray-slice.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698