r74655 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74654‎ | r74655 | r74656 >
Date:13:36, 12 October 2010
Author:catrope
Status:deferred
Tags:
Comment:
1.16wmf4: UsabilityInitiative: (bug 25496) Fix JS error caused by context being null, occurred when using charinsert with WikiEditor disabled. Not fixing on trunk because the offending code was refactored out of existence.
Modified paths:
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js
@@ -386,7 +386,7 @@
387387 break;
388388 }
389389 var context = $(this).data( 'wikiEditor-context' );
390 - var hasIframe = context !== undefined && context.$iframe !== undefined;
 390+ var hasIframe = typeof context === 'object' && context && typeof context.$iframe !== 'undefined';
391391
392392 // IE selection restore voodoo
393393 var needSave = false;
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -1802,7 +1802,7 @@
18031803 break;
18041804 }
18051805 var context = $(this).data( 'wikiEditor-context' );
1806 - var hasIframe = context !== undefined && context.$iframe !== undefined;
 1806+ var hasIframe = typeof context === 'object' && context && typeof context.$iframe !== 'undefined';
18071807
18081808 // IE selection restore voodoo
18091809 var needSave = false;
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -116,7 +116,7 @@
117117 $(this).trigger('scrollToPosition');});}};switch(command){case'encapsulateSelection':options=$.extend({'pre':'','peri':'','post':'','ownline':false,'replace':false,'selectPeri':true},options);break;case'getCaretPosition':options=$.extend({'startAndEnd':false},options);break;case'setSelection':options=$.extend({'start':undefined,'end':undefined,'startContainer':undefined,'endContainer':undefined},options);if(options.end===undefined)
118118 options.end=options.start;if(options.endContainer==undefined)
119119 options.endContainer=options.startContainer;break;case'scrollToCaretPosition':options=$.extend({'force':false},options);break;}
120 -var context=$(this).data('wikiEditor-context');var hasIframe=context!==undefined&&context.$iframe!==undefined;var needSave=false;if(hasIframe&&context.savedSelection!==null){context.fn.restoreSelection();needSave=true;}
 120+var context=$(this).data('wikiEditor-context');var hasIframe=typeof context==='object'&&context&&typeof context.$iframe!=='undefined';var needSave=false;if(hasIframe&&context.savedSelection!==null){context.fn.restoreSelection();needSave=true;}
121121 retval=(hasIframe?context.fn:fn)[command].call(this,options);if(hasIframe&&needSave){context.fn.saveSelection();}
122122 return retval;};})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2]],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]],'netscape':[['>=',9]],'blackberry':false,'ipod':false,'iphone':false},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2]],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]],'netscape':[['>=',9]],'blackberry':false,'ipod':false,'iphone':false}},'imgPath':wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/','isSupported':function(module){if(module&&typeof module.name!='undefined'&&(module.name=='toc'||module.name=='highlight')&&typeof wgReallyGiveMeTOC=='undefined'){return module.supported=false;}
123123 var mod=module&&'browsers'in module?module:$.wikiEditor;if(typeof mod.supported!=='undefined'){return mod.supported;}

Status & tagging log