r56588 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56587‎ | r56588 | r56589 >
Date:09:12, 18 September 2009
Author:catrope
Status:ok
Tags:
Comment:
EditToolbar: (bug 20668) Fix infinite loop and OOM death on IE8
Modified paths:
  • /trunk/extensions/UsabilityInitiative/css/combined.min.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.dialogs.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/css/combined.min.css
@@ -446,4 +446,4 @@
447447 background-color:white;
448448 text-decoration:none;
449449 border-color:#a8d7f9;
450 -}
 450+}
\ No newline at end of file
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.dialogs.js
@@ -56,10 +56,10 @@
5757 // Transform messages in keys
5858 // Stupid JS won't let us do stuff like
5959 // foo = { gM ('bar'): baz }
60 - for ( msg in configuration.buttons ) {
61 - configuration.buttons[gM( msg )] = configuration.buttons[msg];
62 - delete configuration.buttons[msg];
63 - }
 60+ configuration.newButtons = {};
 61+ for ( msg in configuration.buttons )
 62+ configuration.newButtons[gM( msg )] = configuration.buttons[msg];
 63+ configuration.buttons = configuration.newButtons;
6464 // Create the dialog <div>
6565 $( '<div /> ' )
6666 .attr( 'id', module.id )
@@ -132,4 +132,4 @@
133133 },
134134 'modules': {}
135135
136 -}; } ) ( jQuery );
\ No newline at end of file
 136+}; } ) ( jQuery );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -1229,10 +1229,10 @@
12301230 // Transform messages in keys
12311231 // Stupid JS won't let us do stuff like
12321232 // foo = { gM ('bar'): baz }
1233 - for ( msg in configuration.buttons ) {
1234 - configuration.buttons[gM( msg )] = configuration.buttons[msg];
1235 - delete configuration.buttons[msg];
1236 - }
 1233+ configuration.newButtons = {};
 1234+ for ( msg in configuration.buttons )
 1235+ configuration.newButtons[gM( msg )] = configuration.buttons[msg];
 1236+ configuration.buttons = configuration.newButtons;
12371237 // Create the dialog <div>
12381238 $( '<div /> ' )
12391239 .attr( 'id', module.id )
@@ -1305,7 +1305,8 @@
13061306 },
13071307 'modules': {}
13081308
1309 -}; } ) ( jQuery );/**
 1309+}; } ) ( jQuery );
 1310+/**
13101311 * Toolbar module for wikiEditor
13111312 */
13121313 ( function( $ ) { $.wikiEditor.modules.toolbar = {
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -75,8 +75,8 @@
7676 context.$textarea.scrollToCaretPosition(0);}
7777 if(arguments.length>0&&typeof arguments[0]=='object'){context.api.addModule(context,arguments[0]);}else{arguments=$.makeArray(arguments);if(arguments.length>0){var call=arguments.shift();if(call in context.api){context.api[call](context,arguments[0]==undefined?{}:arguments[0]);}}}
7878 return $(this).data('wikiEditor-context',context);};})(jQuery);RegExp.escape=function(s){return s.replace(/([.*+?^${}()|\/\\[\]])/g,'\\$1');};(function($){$.wikiEditor.modules.dialogs={api:{addDialog:function(context,data){$.wikiEditor.modules.dialogs.fn.create(context,{'modules':data})},openDialog:function(context,data){if(data.dialog in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[data.dialog].id).dialog('open');}},closeDialog:function(context,data){if(data.dialog in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[data.dialog].id).dialog('close');}}},fn:{create:function(context,config){for(module in config){$.wikiEditor.modules.dialogs.modules[module]=config[module];}
79 -for(module in $.wikiEditor.modules.dialogs.modules){var module=$.wikiEditor.modules.dialogs.modules[module];if($('#'+module.id).size()==0){var configuration=module.dialog;configuration.bgiframe=true;configuration.autoOpen=false;configuration.modal=true;configuration.title=$.wikiEditor.autoMsg(module,'title');for(msg in configuration.buttons){configuration.buttons[gM(msg)]=configuration.buttons[msg];delete configuration.buttons[msg];}
80 -$('<div /> ').attr('id',module.id).html(module.html).data('context',context).appendTo($('body')).each(module.init).dialog(configuration).bind('dialogopen',$.wikiEditor.modules.dialogs.fn.resize).find('.ui-tabs').bind('tabsshow',function(){$(this).closest('.ui-dialog-content').each($.wikiEditor.modules.dialogs.fn.resize);});var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI)
 79+for(module in $.wikiEditor.modules.dialogs.modules){var module=$.wikiEditor.modules.dialogs.modules[module];if($('#'+module.id).size()==0){var configuration=module.dialog;configuration.bgiframe=true;configuration.autoOpen=false;configuration.modal=true;configuration.title=$.wikiEditor.autoMsg(module,'title');configuration.newButtons={};for(msg in configuration.buttons)
 80+configuration.newButtons[gM(msg)]=configuration.buttons[msg];configuration.buttons=configuration.newButtons;$('<div /> ').attr('id',module.id).html(module.html).data('context',context).appendTo($('body')).each(module.init).dialog(configuration).bind('dialogopen',$.wikiEditor.modules.dialogs.fn.resize).find('.ui-tabs').bind('tabsshow',function(){$(this).closest('.ui-dialog-content').each($.wikiEditor.modules.dialogs.fn.resize);});var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI)
8181 maxTI=ti;});var tabIndex=maxTI+1;$j('.ui-dialog input, .ui-dialog button').not('[tabindex]').each(function(){$j(this).attr('tabindex',tabIndex++);});}}},resize:function(){var wrapper=$(this).closest('.ui-dialog');var oldHidden=$(this).find('*').not(':visible');oldHidden.each(function(){$(this).data('oldstyle',$(this).attr('style'));});oldHidden.show();var oldWS=$(this).css('white-space');$(this).css('white-space','nowrap');if(wrapper.width()<=$(this).get(0).scrollWidth){$(this).width($(this).get(0).scrollWidth);wrapper.width(wrapper.get(0).scrollWidth);$(this).dialog({'width':wrapper.width()});}
8282 $(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},'modules':{}};})(jQuery);(function($){$.wikiEditor.modules.toolbar={api:{addToToolbar:function(context,data){for(type in data){switch(type){case'sections':var $sections=context.modules.$toolbar.find('div.sections');var $tabs=context.modules.$toolbar.find('div.tabs');for(section in data[type]){if(section=='main'){context.modules.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));continue;}
8383 $sections.append($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,data[type][section]));}

Follow-up revisions

RevisionCommit summaryAuthorDate
r56590UsabilityInitiative: Increment style versions for r56588catrope10:04, 18 September 2009
r56592wmf-deployment: Merge r56588 and r56590 (fix IE8 crash in EditToolbar)catrope10:07, 18 September 2009
r68447resourceloader: Some fixes. Calling importScriptURI('/path/to/load.php?module...catrope10:59, 23 June 2010

Status & tagging log