Closed Bug 1140854 Opened 9 years ago Closed 9 years ago

Function.prototype.toString throws when called on Proxy

Categories

(Core :: JavaScript Engine, defect)

38 Branch
x86_64
Windows 8.1
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: vladsv88, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36

Steps to reproduce:

This code throws a exception on Firefox 38a2:

var f1 = function() { };
var f2 = new Proxy(f1, { });
f2.toString(); // throws exception


Actual results:

TypeError: Function.prototype.toString called on incompatible object


Expected results:

function() { }
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
regression range:
good=2015-01-31
bad=2015-02-01
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=d7e156a7a0a6&tochange=c2359a6a6958

Tom Schuster — Bug 1100936 - Handle various operations on revoked proxies. r=efaust

Not sure if it's a valid regression anyway. CC'ed Tom.
Blocks: 1100936
Flags: needinfo?(evilpies)
This was a conscious decision, the ES6 spec doesn't allow this kind of unwrapping behavior.
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.tostring: Proxies are neither a bound function nor do they have an [[ECMAScriptCode]] internal slot. They just have [[Call]].
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Flags: needinfo?(evilpies)
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.