r103046 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103045‎ | r103046 | r103047 >
Date:21:55, 14 November 2011
Author:hartman
Status:ok
Tags:
Comment:
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) (history)

Diff [purge]

Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js
@@ -556,7 +556,7 @@
557557 }
558558 }
559559 };
560 - } else if ( 0 in character && 1 in character ) {
 560+ } else if ( character && 0 in character && 1 in character ) {
561561 character = {
562562 'label' : character[0],
563563 'action' : {
@@ -568,10 +568,12 @@
569569 }
570570 };
571571 }
572 - if ( 'action' in character && 'label' in character ) {
 572+ if ( character && 'action' in character && 'label' in character ) {
573573 actions[character.label] = character.action;
574574 return '<span rel="' + character.label + '">' + character.label + '</span>';
575575 }
 576+ mw.log( "A character for the toolbar was undefined. This is not supposed to happen. Double check the config." );
 577+ return ""; // bug 31673; also an additional fix for bug 24208...
576578 },
577579 buildTab : function( context, id, section ) {
578580 var selected = $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section' );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102980Remove stray comma per bug 31673 comment 4catrope13:51, 14 November 2011
r103034Make sure a row is closed in the toolbar....hartman21:21, 14 November 2011

Status & tagging log