Page MenuHomePhabricator

wikibits's function updateTooltipAccessKeys should not throw errors
Closed, DeclinedPublic

Description

See the url above for the usecase.

In that case the nodeList is an array having only one element which is undefined.

The error can be avoided by changing the line[1]

element = nodeList[i];

to something like:

element = nodeList[i];
if (!element) {
   continue;
}

[1] On this loop:
http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/skins/common/wikibits.js?annotate=91660#l230


Version: 1.17.x
Severity: normal
URL: https://secure.wikimedia.org/wikibooks/en/w/index.php?title=MediaWiki_talk:Common.js&oldid=2155725&diff=prev

Details

Reference
bz30291

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:57 PM
bzimport set Reference to bz30291.

That function has been deprecated, it worked for most cases and scripts still referring to it can continue to do so. The new version is mw.util.updateTooltipAccessKeys, which is part of the new mediaWiki.js library.

The new version doesn't have this problem (as it's covered by jQuery), the old version is not automatically redirected to the new one as it's not guaranteed to be 100% compatible.

I would recommend updating the script [1] to use mw.util.updateTooltipAccessKeys instead.

Krinkle

[1] https://secure.wikimedia.org/wikibooks/en/wiki/MediaWiki:Common.js/RandomBook.js