> Le 2 mars 2016 à 15:36, Caitlin Potter <[email protected]> a écrit :
> 
> As far as I can tell, this is a bug in Firefox / SpiderMonkey. The [[CALL]] 
> internal method of Proxy objects does not impose any restriction on the type 
> of the Proxy target.
> 
> The following code behaves correctly in Chromium:
> 
> ```js
> var proxy =  new Proxy({}, { apply(target, thisArgument, arguments) { return 
> Reflect.apply(Array, thisArgument, arguments); } });
> 
> proxy(1, 2, 3); // [1, 2, 3]
> ```
> 
> But as you say, this throws in Firefox, and based on the specification, this 
> appears to be a bug. Implementations, amirite? ¯\_(ツ)_/¯

Rather, I'd say it is a bug in Chromium.

A Proxy should have a [[Call]] internal method if and only if its target has a 
[[Call]] internal method. See:

http://www.ecma-international.org/ecma-262/6.0/#sec-proxycreate 
<http://www.ecma-international.org/ecma-262/6.0/#sec-proxycreate> step 7.

That maintains the equivalence: `typeof x == "function"` iff `x` is callable.

—Claude

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to