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 5function getLength(a) { 6 return a.length; 7} 8 9function getByteLength(a) { 10 return a.byteLength; 11} 12 13function getByteOffset(a) { 14 return a.byteOffset; 15} 16 17var a = new Uint8Array([1, 2, 3]); 18getLength(a); 19getLength(a); 20 21Object.defineProperty(a.__proto__, 'length', {value: 42}); 22 23assertEquals(42, getLength(a)); 24assertEquals(42, a.length); 25 26getByteLength(a); 27getByteLength(a); 28 29Object.defineProperty(a.__proto__, 'byteLength', {value: 42}); 30 31assertEquals(42, getByteLength(a)); 32assertEquals(42, a.byteLength); 33 34getByteOffset(a); 35getByteOffset(a); 36 37Object.defineProperty(a.__proto__, 'byteOffset', {value: 42}); 38 39assertEquals(42, getByteOffset(a)); 40assertEquals(42, a.byteOffset); 41