New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 595294 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Mar 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

Function.prototype.apply doesn't work on Proxys

Reported by q...@daurnimator.com, Mar 16 2016

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36

Steps to reproduce the problem:
1. Create a new proxy object:

a=new Proxy({}, {"apply":function(ob, self, args) { console.log(self, args); }});

2. Observe that it can be called normally:

a("foo", "arg2") // output: undefined ["foo", "arg2"]

3. Try to call it via Function.prototype.apply or Reflect.apply:

Reflect.apply(a, void 0, ["foo", "arg2"]) // TypeError: Function.prototype.apply was called on [object Object], which is a object and not a function(…)

What is the expected behavior?
Function is called; output of: undefined ["foo", "arg2"]

What went wrong?
A javascript TypeError was thrown

Did this work before? N/A 

Chrome version: 49.0.2623.87  Channel: stable
OS Version: ArchLinux
Flash Version: Shockwave Flash 20.0 r0

Proxy is new in Chrome 49.
 
Seems to work if you give a Proxy target that is a function:

a=new Proxy(function(){}, {"apply":function(ob, self, args) { console.log("APPLY", self, args); } });
Reflect.apply(a, "foo", [])

output: APPLY foo []
Components: -Blink Blink>JavaScript
Cc: littledan@chromium.org adamk@chromium.org
Status: WontFix (was: Unconfirmed)
This behavior is indicated by the spec. To make the proxy callable, back it by a function rather than an empty object. Chrome initially shipped Proxies with a bug which allowed this spec-violating behavior.

Sign in to add a comment