Object.prototype.toString.call(Uint8Array.prototype) throws a TypeError

Jeff Walden jwalden+es at mit.edu
Thu Aug 28 14:56:00 PDT 2014

Per latest draft, %TypedArray%.prototype[@@toStringTag] is a getter that throws a TypeError if |this| doesn't have the internal slots of a typed array.  Neither %TypedArray%.prototype nor {{Ui,I}nt{8,16,32},Float{32,64}}.prototype have these internal slots.  So the builtin Object toString method, called on any of these objects, will throw a TypeError.  Is this wise?  I suspect there's debugging code out there that expects that toString doesn't throw on at least the typed array prototypes (seeing as it doesn't throw in any engine I'm aware of right now, tho the returned string is inconsistent).


More information about the es-discuss mailing list