Index: trunk/phase3/includes/resourceloader/ResourceLoaderFileModule.php |
— | — | @@ -485,6 +485,7 @@ |
486 | 486 | * @return String: Concatenated and remapped JavaScript data from $scripts |
487 | 487 | */ |
488 | 488 | protected function readScriptFiles( array $scripts ) { |
| 489 | + global $wgResourceLoaderValidateStaticJS; |
489 | 490 | if ( empty( $scripts ) ) { |
490 | 491 | return ''; |
491 | 492 | } |
— | — | @@ -495,7 +496,12 @@ |
496 | 497 | if ( $contents === false ) { |
497 | 498 | throw new MWException( __METHOD__.": script file not found: \"$localPath\"" ); |
498 | 499 | } |
499 | | - $contents = $this->validateScriptFile( $fileName, $contents ); |
| 500 | + if ( $wgResourceLoaderValidateStaticJS ) { |
| 501 | + // Static files don't really need to be checked as often; unlike |
| 502 | + // on-wiki module they shouldn't change unexpectedly without |
| 503 | + // admin interference. |
| 504 | + $contents = $this->validateScriptFile( $fileName, $contents ); |
| 505 | + } |
500 | 506 | $js .= $contents . "\n"; |
501 | 507 | } |
502 | 508 | return $js; |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -2520,11 +2520,24 @@ |
2521 | 2521 | $wgResourceLoaderMaxQueryLength = -1; |
2522 | 2522 | |
2523 | 2523 | /** |
2524 | | - * If set to true, JavaScript will be parsed prior to minification to validate it. |
2525 | | - * Parse errors will result in a JS exception being thrown during module load. |
| 2524 | + * If set to true, JavaScript modules loaded from wiki pages will be parsed prior |
| 2525 | + * to minification to validate it. |
| 2526 | + * |
| 2527 | + * Parse errors will result in a JS exception being thrown during module load, |
| 2528 | + * which avoids breaking other modules loaded in the same request. |
2526 | 2529 | */ |
2527 | 2530 | $wgResourceLoaderValidateJS = true; |
2528 | 2531 | |
| 2532 | +/** |
| 2533 | + * If set to true, statically-sourced (file-backed) JavaScript resources will |
| 2534 | + * be parsed for validity before being bundled up into ResourceLoader modules. |
| 2535 | + * |
| 2536 | + * This can be helpful for development by providing better error messages in |
| 2537 | + * default (non-debug) mode, but JavaScript parsing is slow and memory hungry |
| 2538 | + * and may fail on large pre-bundled frameworks. |
| 2539 | + */ |
| 2540 | +$wgResourceLoaderValidateStaticJS = false; |
| 2541 | + |
2529 | 2542 | /** @} */ # End of resource loader settings } |
2530 | 2543 | |
2531 | 2544 | |