r72223 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72222‎ | r72223 | r72224 >
Date:20:17, 2 September 2010
Author:tparscal
Status:ok
Tags:
Comment:
Wrapped inline generated scripts (which are evil) in code that prevents them from being run if mediaWiki doesn't exist.
Modified paths:
  • /branches/resourceloader/phase3/includes/EditPage.php (modified) (history)
  • /branches/resourceloader/phase3/includes/ProtectionForm.php (modified) (history)

Diff [purge]

Index: branches/resourceloader/phase3/includes/ProtectionForm.php
@@ -592,7 +592,7 @@
593593 $encOptions = Xml::encodeJsVar( $options );
594594
595595 $script .= "ProtectionForm.init($encOptions)";
596 - return Html::inlineScript( "mediaWiki.loader.using( 'mediawiki.legacy.protect', function() { {$script} } );" );
 596+ return Html::inlineScript( "if ( mediaWiki !== undefined ) { mediaWiki.loader.using( 'mediawiki.legacy.protect', function() { {$script} } ); }" );
597597 }
598598
599599 /**
Index: branches/resourceloader/phase3/includes/EditPage.php
@@ -2246,9 +2246,9 @@
22472247 }
22482248
22492249 $wgOut->addScript( Html::inlineScript(
2250 - "\nmediaWiki.loader.using( 'mediawiki.legacy.edit', function() { $script } );\n"
 2250+ "if ( mediaWiki !== undefined ) { mediaWiki.loader.using( 'mediawiki.legacy.edit', function() { $script } ); }"
22512251 ) );
2252 -
 2252+
22532253 $toolbar .= "\n</div>";
22542254
22552255 wfRunHooks( 'EditPageBeforeEditToolbar', array( &$toolbar ) );

Status & tagging log