| 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); |
| 27 |
assert.sameValue(Array.isArray(arrayProxy), true, 'proxy for array'); |
| 28 |
assert.sameValue( |
| 29 |
Array.isArray(arrayProxyProxy), true, 'proxy for proxy for array' |
| 30 |
); |