https://bugzilla.wikimedia.org/show_bug.cgi?id=24083
Summary: centralnotice breaks on IE6, causing error alerts on
all pages (IE6 has no Array.prototype.indexOf)
Product: MediaWiki
Version: unspecified
Platform: All
OS/Version: other
Status: NEW
Severity: major
Priority: Normal
Component: Javascript
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
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 ) ...
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l