proxy.js (1089B)
1 // Copyright (C) 2016 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-array.isarray 5 es6id: 22.1.2.2 6 description: Proxy of an array is treated as an array 7 info: | 8 1. Return IsArray(arg). 9 10 7.2.2 IsArray 11 12 [...] 13 3. If argument is a Proxy exotic object, then 14 a. If the value of the [[ProxyHandler]] internal slot of argument is null, 15 throw a TypeError exception. 16 b. Let target be the value of the [[ProxyTarget]] internal slot of 17 argument. 18 c. Return ? IsArray(target). 19 features: [Proxy] 20 ---*/ 21 22 var objectProxy = new Proxy({}, {}); 23 var arrayProxy = new Proxy([], {}); 24 var arrayProxyProxy = new Proxy(arrayProxy, {}); 25 26 assert.sameValue(Array.isArray(objectProxy), false, 'Array.isArray(new Proxy({}, {})) must return false'); 27 assert.sameValue(Array.isArray(arrayProxy), true, 'Array.isArray(new Proxy([], {})) must return true'); 28 assert.sameValue( 29 Array.isArray(arrayProxyProxy), true, 'Array.isArray(new Proxy(arrayProxy, {})) must return true' 30 ); 31 32 reportCompare(0, 0);