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