blob: b94301eea89a35c4c2865e22fd616fc89490f0d5 [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001// 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
5// Flags: --harmony-species
6
7// First test case
8
9function FirstBuffer () {}
10FirstBuffer.prototype.__proto__ = Uint8Array.prototype
11FirstBuffer.__proto__ = Uint8Array
12
13var buf = new Uint8Array(10)
14buf.__proto__ = FirstBuffer.prototype
15
16var buf2 = buf.subarray(2)
17assertEquals(8, buf2.length);
18
19// Second test case
20
21function SecondBuffer (arg) {
22 var arr = new Uint8Array(arg)
23 arr.__proto__ = SecondBuffer.prototype
24 return arr
25}
26SecondBuffer.prototype.__proto__ = Uint8Array.prototype
27SecondBuffer.__proto__ = Uint8Array
28
29var buf3 = new SecondBuffer(10)
30
31var buf4 = buf3.subarray(2)
32
33assertEquals(8, buf4.length);