Index: branches/JSTesting/includes/resourceloader/ResourceLoader.php |
— | — | @@ -187,7 +187,7 @@ |
188 | 188 | * Registers core modules and runs registration hooks. |
189 | 189 | */ |
190 | 190 | public function __construct() { |
191 | | - global $IP, $wgResourceModules, $wgResourceLoaderSources, $wgLoadScript; |
| 191 | + global $IP, $wgResourceModules, $wgResourceLoaderSources, $wgLoadScript, $wgEnableJavaScriptTest; |
192 | 192 | |
193 | 193 | wfProfileIn( __METHOD__ ); |
194 | 194 | |
— | — | @@ -199,16 +199,13 @@ |
200 | 200 | |
201 | 201 | // Register core modules |
202 | 202 | $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 | | - |
209 | 203 | // Register extension modules |
210 | 204 | wfRunHooks( 'ResourceLoaderRegisterModules', array( &$this ) ); |
211 | 205 | $this->register( $wgResourceModules ); |
212 | 206 | |
| 207 | + if ( $wgEnableJavaScriptTest === true ) { |
| 208 | + $this->registerTestModules(); |
| 209 | + } |
213 | 210 | |
214 | 211 | |
215 | 212 | wfProfileOut( __METHOD__ ); |
— | — | @@ -276,9 +273,10 @@ |
277 | 274 | /** |
278 | 275 | */ |
279 | 276 | public function registerTestModules() { |
280 | | - global $wgEnableJavaScriptTest, $IP; |
| 277 | + global $IP, $wgEnableJavaScriptTest; |
| 278 | + |
281 | 279 | 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.' ); |
283 | 281 | } |
284 | 282 | |
285 | 283 | wfProfileIn( __METHOD__ ); |