r101383 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101382‎ | r101383 | r101384 >
Date:18:56, 31 October 2011
Author:krinkle
Status:ok (Comments)
Tags:
Comment:
[JSTesting] Restore loading principle.
* Follows-up r101346, r101352, r101353
Modified paths:
  • /branches/JSTesting/includes/resourceloader/ResourceLoader.php (modified) (history)

Diff [purge]

Index: branches/JSTesting/includes/resourceloader/ResourceLoader.php
@@ -187,7 +187,7 @@
188188 * Registers core modules and runs registration hooks.
189189 */
190190 public function __construct() {
191 - global $IP, $wgResourceModules, $wgResourceLoaderSources, $wgLoadScript;
 191+ global $IP, $wgResourceModules, $wgResourceLoaderSources, $wgLoadScript, $wgEnableJavaScriptTest;
192192
193193 wfProfileIn( __METHOD__ );
194194
@@ -199,16 +199,13 @@
200200
201201 // Register core modules
202202 $this->register( include( "$IP/resources/Resources.php" ) );
203 -
204 - // Register test Modules
205 - // TODO: figures out how to register them conditionally and not
206 - // for every page requests.
207 - $this->registerTestModules();
208 -
209203 // Register extension modules
210204 wfRunHooks( 'ResourceLoaderRegisterModules', array( &$this ) );
211205 $this->register( $wgResourceModules );
212206
 207+ if ( $wgEnableJavaScriptTest === true ) {
 208+ $this->registerTestModules();
 209+ }
213210
214211
215212 wfProfileOut( __METHOD__ );
@@ -276,9 +273,10 @@
277274 /**
278275 */
279276 public function registerTestModules() {
280 - global $wgEnableJavaScriptTest, $IP;
 277+ global $IP, $wgEnableJavaScriptTest;
 278+
281279 if ( $wgEnableJavaScriptTest === false ) {
282 - return false;
 280+ throw new MWException( 'Attempt to register JavaScript test modules but <tt>$wgEnableJavaScriptTest</tt> is false. Edit your <tt>LocalSettings.php</tt> to enable it.' );
283281 }
284282
285283 wfProfileIn( __METHOD__ );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r101346now explicitly need to register test modules....hashar10:15, 31 October 2011
r101352unconditionally register the test modules...hashar11:51, 31 October 2011
r101353remove exception added by r101346...hashar11:56, 31 October 2011

Comments

#Comment by Hashar (talk | contribs)   20:09, 31 October 2011

that would work too :D

Status & tagging log