Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: redefining toString() - don't know what to expect

0
0
Hi Julien,

In the test code above, the initial toString() call does not involve ClearScript at all. The "[object Undefined]" result makes sense; the script engine finds the built-in function on the global object's prototype chain, and invokes it with an undefined this binding. Note that the result is different if you bind this to the global object via this.toString().

The result of the second call is also expected; V8 invokes the user-defined function that now hangs off the global object.

The result of the third call is due to a ClearScript bug. The GlobalMembers feature incorrectly exposes the proxy's built-in toString() method as a global member that overrides the user-defined function. We're testing a fix and will post it very soon.

Thanks bringing another ClearScript issue to our attention!

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images