Array.isArray(new Proxy([], {})) should be false (Bug 1096753)

Allen Wirfs-Brock allen at
Thu Nov 13 11:52:46 PST 2014

On Nov 12, 2014, at 11:58 AM, Jeremy Martin wrote:

> My opinion is that array testing is fundamental to core JS and is worth the exception.
> Knowing that Array.isArray() tests fail for proxies, I'd be afraid to ever create a Proxy for an array that I don't control the complete lifecycle of. That seems to critically inhibit the usefulness of Proxies, especially when transparency seems to have been an intended characteristic of them going all the way back to the strawman days.

Proxies are not transparent forwarders!  In particular their default handling of the `this` value on method invokes will break any built-in method that needs to access "internal slots" of an object.

var p = new Proxy(new Array, {});
will give you an object that will fail on serval of the Array.prototype methods.

It is even worse for other built-ins such as Map or the typed array constructors.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list