r66590 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66589‎ | r66590 | r66591 >
Date:21:51, 17 May 2010
Author:dale
Status:deferred
Tags:
Comment:
* check mw.currentClassMissingMessages as to not fire object ready before class Messages are loaded
Modified paths:
  • /trunk/extensions/JS2Support/mwEmbed/mwEmbed.js (modified) (history)

Diff [purge]

Index: trunk/extensions/JS2Support/mwEmbed/mwEmbed.js
@@ -839,9 +839,9 @@
840840
841841 // If ( debug mode ) and the script include is missing class messages
842842 // do a separate request to retrieve the msgs
843 - if( mw.currentClassMissingMessages ){
844 - mw.loadClassMessages( className, function(){
845 - //reset the currentClassMissingMessages flag
 843+ if( mw.currentClassMissingMessages ){
 844+ mw.loadClassMessages( className, function(){
 845+ // Reset the currentClassMissingMessages flag
846846 mw.currentClassMissingMessages = false;
847847 // Run the onDone callback
848848 mw.loadDone( className );
@@ -851,8 +851,7 @@
852852 // is not able to append the loadDone call
853853 mw.loadDone( className );
854854 }
855 - } );
856 - //mw.log( 'done with running getScript request ' );
 855+ } );
857856
858857 /*
859858 * ( If scriptLoader is not enabled )
@@ -860,14 +859,18 @@
861860 * Check if the class is ready:
862861 * ( not all browsers support onLoad script attribute )
863862 * In the case of a "class" we can pull the javascript state until its ready
 863+ *
 864+ * If we are waiting for msgs we can't support "class" defined check
864865 */
865866 if( !mw.getScriptLoaderPath() ) {
866867 setTimeout( function() {
867 - mw.waitForObject( className, function( className ) {
868 - // Once object is ready run loadDone
869 - mw.loadDone( className );
 868+ mw.waitForObject( className, function( className ) {
 869+ // Once object is ready and we don't need message keys, run loadDone
 870+ if( !mw.currentClassMissingMessages ){
 871+ mw.loadDone( className );
 872+ }
870873 } );
871 - }, 25 );
 874+ }, 25 );
872875 }
873876 },
874877

Status & tagging log