blob: a75d68f105633322f9c9c8151dcf4a093e7bbff2 [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// 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
3// found in the LICENSE file.
4
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00005// First test case
6
7function FirstBuffer () {}
8FirstBuffer.prototype.__proto__ = Uint8Array.prototype
9FirstBuffer.__proto__ = Uint8Array
10
11var buf = new Uint8Array(10)
12buf.__proto__ = FirstBuffer.prototype
13
14var buf2 = buf.subarray(2)
15assertEquals(8, buf2.length);
16
17// Second test case
18
19function SecondBuffer (arg) {
20 var arr = new Uint8Array(arg)
21 arr.__proto__ = SecondBuffer.prototype
22 return arr
23}
24SecondBuffer.prototype.__proto__ = Uint8Array.prototype
25SecondBuffer.__proto__ = Uint8Array
26
27var buf3 = new SecondBuffer(10)
28
29var buf4 = buf3.subarray(2)
30
31assertEquals(8, buf4.length);