TM: Function.prototype.toString doesn't work with proxy functions

RESOLVED FIXED

Status

()

RESOLVED FIXED
9 years ago
8 years ago

People

(Reporter: gal, Unassigned)

Tracking

Other Branch
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

9 years ago
At least Function.prototype.toString doesn't work right on callable objects. ES5 says that callable objects are of type Function (typeof RegExp == "function"), so this should probably made work. We should check for isCallable instead of isFunction.
(Reporter)

Comment 1

9 years ago
"An implementation-dependent representation of the function is returned. This representation has the syntax of a FunctionDeclaration. Note in particular that the use and placement of white space, line terminators, and semicolons within the representation String is implementation-dependent.
The toString function is not generic; it throws a TypeError exception if its this value is not a Function object. Therefore, it cannot be transferred to other kinds of objects for use as a method."

Looks like ES5 doesn't want all callable objects to be allowed here, only explicitly functions. So I will fix this narrowly for proxies.
Please resummarize -- summary is wrong, ES1-5 are clear on this :-P.

/be
(Reporter)

Updated

9 years ago
Summary: TM: Function.prototype.* doesn't work on callable objects → TM: Function.prototype.* doesn't work with proxy functions
(Reporter)

Updated

9 years ago
Summary: TM: Function.prototype.* doesn't work with proxy functions → TM: Function.prototype.toString doesn't work with proxy functions
Works for Proxies and Functions, Ecma doesn't want anything more.
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.