I just spent 20 minutes in IRC with Wolfram staring down one of those situations where you keep swearing under your breath “println isn’t broken….println isn’t broken….println is NOT broken”.
Catch this fun gem from FF3b2:
>>> typeof []
"object"
>>> var a = [];
>>> var b = new Array();
>>> a.constructor == b.constructor
false
>>> c = [];
[]
>>> c.constructor == a.constructor
true
>>> d = new Array();
[]
>>> b.constructor == d.constructor;
true
>>> b.constructor == a.constructor;
false
WTF?
5 Comments
Confirmed on Firefox 3 Beta 3. Both print out Array() as their constructor, but apparently they’re not considered equal. WTF?
In short: ([] instanceof Array) gives ‘false’
I wonder if this has anything to do with the protection against JavaScript Hijacking that they put in to prevent people from stealing data by redefining the Array constructor?
I guess working with Spidermonkey has corrupted me. This is wrong, but I doesn’t seem like a particularly weird way to fail, to me.
According to Wolfram’s comment on Ajaxian, this time println *is* broken. And I’ve confirmed this too. [].constructor == new Array().constructor will evaluate to true if you try this in Error Console instead of Firebug.
Wolfram also let me know today that it’s only firebug…I was wondering why all of Dojo hadn’t broken = )
One Trackback
[...] Alex’s blog entry he posted the problem with Firefox3 beta3! In [...]