Last modified: 2010-06-23 17:53:02 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T26083, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 24083 - centralnotice breaks on IE6, causing error alerts on all pages (IE6 has no Array.prototype.indexOf)
centralnotice breaks on IE6, causing error alerts on all pages (IE6 has no Ar...
Status: RESOLVED FIXED
Product: Wikimedia
Classification: Unclassified
Site requests (Other open bugs)
unspecified
All other
: Normal major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-22 22:41 UTC by Lupo
Modified: 2010-06-23 17:53 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Lupo 2010-06-22 22:41:20 UTC
http://upload.wikimedia.org/centralnotice/commons/en/centralnotice.js?283g
is broken on IE6 because it uses a call

DBsWithVector.indexOf()

where

var DBsWithVector = [ /* An array of strings */ ];

Array.prototype.indexOf doesn't exist on IE6 (and apparently also IE7, if I'm to believe web resources). The error message in IE6 says that "object does not support this method"--if only they had told me which object and which method, I wouldn't have had to search for some hours!

IE apparently does have an Array.indexOf "static" method, see
http://msdn.microsoft.com/en-us/library/bb383831.aspx
but that method is *not* on the prototype! I do not know whether this Array.indexOf static method is indeed available on IE6.

Note that the DBsWithVector thing is inside the string wgNotice!

Proposed fix:

There's two ways to fix this. Simple fix first: replace

DBsWithVector.indexOf( wgDBname )!= -1

by

(' ' + DBsWithVector.join (' ') + ' ').indexOf (' ' + wgDBname + ' ') != -1

IE6 does have Array.prototype.join, and it does have String.protype.indexOf, so this will work.

More proper fix: since DBsWithVector is used only for this test, change the array into an object:

var DBsWithVector =
  {'enwiki':1, 'commonswiki':1, /* and so on, no comma after the last one! */ };

Then test using simply

DBsWithVector[wgDBname]

No need for indexOf at all.

Both proposed fixes should work on all browsers.

Marked "major" since this affects all skins and makes visiting Wikipedia for logged-in users with IE6 next to impossible. Luckily anons are unaffected by the bug, because the full test is

if ( wgUserName == null || DBsWithVector.indexOf( wgDBname )!= -1 ) ...
Comment 1 Bawolff (Brian Wolff) 2010-06-23 03:45:37 UTC
If i recall, Array.indexOf() is non-standard, and also not in opera.
Comment 2 Liangent 2010-06-23 03:52:14 UTC
Array.indexOf() is in JavaScript 1.6 ([[JavaScript#Versions]]).
Comment 3 Nimish Gautam 2010-06-23 17:45:32 UTC
Fixed with a ridiculously long OR statement
Comment 4 Liangent 2010-06-23 17:53:02 UTC
Is this some Wikimedia stuff? Changing product and component.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links