Closed Bug 1508968 Opened 6 years ago Closed 6 years ago

Calling toString on a Proxy object raises TypeError: Function.prototype.toString called on incompatible object

Categories

(Core :: JavaScript Engine, defect)

63 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1440468

People

(Reporter: ali.baharev, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0

Steps to reproduce:

I ran the following code in the Console:

const f = () => {}
const p = new Proxy(f, {})
console.log(f.toString())
console.log(p.toString())


Actual results:

Running the above code prints:

() => {}
TypeError: Function.prototype.toString called on incompatible object[Learn More]


Expected results:

It should have printed:

() => {}
() => {}
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Btw, per https://tc39.github.io/Function-prototype-toString-revision/#proposal-sec-function.prototype.tostring the second must return something like "function() { [native code] }"
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Interesting, thanks for the info.
You need to log in before you can comment on or make changes to this bug.