@@toStringTag spoofing for null and undefined

Gary Guo nbdd0121 at hotmail.com
Mon Feb 9 20:53:45 PST 2015

String.prototype is a String object (with string value ""), Function.prototype is a function, etc. If you try on ES5 browsers you will get the same result. See the spec for the reason.

Subject: Re: @@toStringTag spoofing for null and undefined
From: claude.pache at gmail.com
Date: Mon, 9 Feb 2015 16:43:23 +0100
CC: allen at wirfs-brock.com; es-discuss at mozilla.org
To: nbdd0121 at hotmail.com

Le 9 févr. 2015 à 16:15, Gary Guo <nbdd0121 at hotmail.com> a écrit :I propose addition of String.prototype[@@toStringTag] as well as abridgement of Object.prototype.toString. 
The issue with that approach, is that `O.p.toString.call(String.prototype)` will return "[object String]", but, for ES6, `String.prototype` is not a String object, leading to a false positive that could break legacy code. (Don't know whether it is a problem in practice.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150210/45002924/attachment.html>

More information about the es-discuss mailing list