https://www.mediawiki.org/wiki/Special:Code/MediaWiki/103046
Revision: 103046 Author: hartman Date: 2011-11-14 21:55:46 +0000 (Mon, 14 Nov 2011) Log Message: ----------- Harden the toolbar builder for character insertion a bit against incorrect configurations. Will now check if character is defined and will return empty string as result instead. Added a mw.log to catch this situation for developers. Based on patch by User:Lupo. Bug 31673 Modified Paths: -------------- trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js Modified: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js =================================================================== --- trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js 2011-11-14 21:54:53 UTC (rev 103045) +++ trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js 2011-11-14 21:55:46 UTC (rev 103046) @@ -556,7 +556,7 @@ } } }; - } else if ( 0 in character && 1 in character ) { + } else if ( character && 0 in character && 1 in character ) { character = { 'label' : character[0], 'action' : { @@ -568,10 +568,12 @@ } }; } - if ( 'action' in character && 'label' in character ) { + if ( character && 'action' in character && 'label' in character ) { actions[character.label] = character.action; return '<span rel="' + character.label + '">' + character.label + '</span>'; } + mw.log( "A character for the toolbar was undefined. This is not supposed to happen. Double check the config." ); + return ""; // bug 31673; also an additional fix for bug 24208... }, buildTab : function( context, id, section ) { var selected = $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs