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

Side by Side Diff: test/mjsunit/regress/regress-4665.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/regress/regress-353004.js ('k') | test/test262/test262.status » ('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 // First test case 5 // First test case
6 6
7 function FirstBuffer () {} 7 function FirstBuffer () {}
8 FirstBuffer.prototype.__proto__ = Uint8Array.prototype 8 FirstBuffer.prototype.__proto__ = Uint8Array.prototype
9 FirstBuffer.__proto__ = Uint8Array 9 FirstBuffer.__proto__ = Uint8Array
10 10
11 var buf = new Uint8Array(10) 11 var buf = new Uint8Array(10)
12 buf.__proto__ = FirstBuffer.prototype 12 buf.__proto__ = FirstBuffer.prototype
13 13
14 assertThrows(() => buf.subarray(2), TypeError); 14 var buf2 = buf.subarray(2)
15 assertEquals(8, buf2.length);
15 16
16 // Second test case 17 // Second test case
17 18
18 let seen_args = [];
19
20 function SecondBuffer (arg) { 19 function SecondBuffer (arg) {
21 seen_args.push(arg);
22 var arr = new Uint8Array(arg) 20 var arr = new Uint8Array(arg)
23 arr.__proto__ = SecondBuffer.prototype 21 arr.__proto__ = SecondBuffer.prototype
24 return arr 22 return arr
25 } 23 }
26 SecondBuffer.prototype.__proto__ = Uint8Array.prototype 24 SecondBuffer.prototype.__proto__ = Uint8Array.prototype
27 SecondBuffer.__proto__ = Uint8Array 25 SecondBuffer.__proto__ = Uint8Array
28 26
29 var buf3 = new SecondBuffer(10) 27 var buf3 = new SecondBuffer(10)
30 assertEquals([10], seen_args);
31 28
32 var buf4 = buf3.subarray(2) 29 var buf4 = buf3.subarray(2)
33 30
34 assertEquals(10, buf4.length); 31 assertEquals(8, buf4.length);
35 assertEquals([10, buf3.buffer], seen_args);
OLDNEW
« no previous file with comments | « test/mjsunit/regress/regress-353004.js ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698