@@toStringTag spoofing for null and undefined

John-David Dalton john.david.dalton at gmail.com
Wed Jan 28 17:03:07 PST 2015


Primary issue is in  isTypedArray(a):
Uin32Array.prototype.buffer.call(a);


Besides the typos, accessing .buffer throws in at least Chrome & Firefox.
Then .buffer is an object so if it doesn't throw there's no .call to
execute.

-JDD


On Wed, Jan 28, 2015 at 4:55 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>
wrote:

>
> On Jan 28, 2015, at 4:40 PM, John-David Dalton <
> john.david.dalton at gmail.com> wrote:
>
> Kind of a bummer. The isTypedArray example from
> https://esdiscuss.org/topic/tostringtag-spoofing-for-null-and-undefined#content-59 is
> incorrect. Is there an updated reference somewhere?
> The toStringTag result is handy because it allows checking against several
> tags at once without having to invoke multiple functions each with their
> own try-catch and all that perf baggage.
>
> How is it incorrect?  Are you referring to the fact that both typed arrays
> and DataView objects have a [[ViewedArrayBuffer]] internal slot.  If so,
> I think this is a specification but that I should fix.
>
> Allen
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150128/5452243c/attachment.html>


More information about the es-discuss mailing list