blob: 22025dc2d8c76b36afd31848965f68d708ad9714 [file] [log] [blame]
Ben Murdoch61f157c2016-09-16 13:49:30 +01001// Copyright 2016 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
5var dv = new DataView(new ArrayBuffer(4), 2);
6
7function getByteLength(a) {
8 return a.byteLength;
9}
10
11assertEquals(2, getByteLength(dv));
12assertEquals(2, getByteLength(dv));
13
14Object.defineProperty(dv.__proto__, 'byteLength', {value: 42});
15
16assertEquals(42, dv.byteLength);
17assertEquals(42, getByteLength(dv));
18
19function getByteOffset(a) {
20 return a.byteOffset;
21}
22
23assertEquals(2, getByteOffset(dv));
24assertEquals(2, getByteOffset(dv));
25
26Object.defineProperty(dv.__proto__, 'byteOffset', {value: 42});
27
28assertEquals(42, dv.byteOffset);
29assertEquals(42, getByteOffset(dv));