Not used since 2011 (MediaWiki 1.18).
In an early version of ResourceLoader, we ran JSMinPlus syntax
validation on-demand on all served JavaScript content. This
was identified as cause of slowdown and high memory use, and
generally not considered as useful in production.
The reason it was there originally was not for the purpose of
validating static files, but for user-generated content.
So in MediaWiki 1.18, the behaviour of wgResourceLoaderValidateJS
was changed to only apply to user-generated content, and the
rest was disabled behind wgResourceLoaderValidateStaticJS, which
we then never use. Not even in development, given that we now
have superior experience through ESLint, even within IDEs where
supported.
Follows-up
49d3d18033738 (r91914).
Change-Id: Ie25109a4fb23ee93fed0db4af5db4b11fe9ffe7f
*/
$wgResourceLoaderValidateJS = true;
-/**
- * If set to true, statically-sourced (file-backed) JavaScript resources will
- * be parsed for validity before being bundled up into ResourceLoader modules.
- *
- * This can be helpful for development by providing better error messages in
- * default (non-debug) mode, but JavaScript parsing is slow and memory hungry
- * and may fail on large pre-bundled frameworks.
- */
-$wgResourceLoaderValidateStaticJS = false;
-
/**
* Whether ResourceLoader should attempt to persist modules in localStorage on
* browsers that support the Web Storage API.
throw new MWException( __METHOD__ . ": skip function file not found: \"$localPath\"" );
}
$contents = $this->stripBom( file_get_contents( $localPath ) );
- if ( $this->getConfig()->get( 'ResourceLoaderValidateStaticJS' ) ) {
- $contents = $this->validateScriptFile( $localPath, $contents );
- }
return $contents;
}
throw new MWException( __METHOD__ . ": script file not found: \"$localPath\"" );
}
$contents = $this->stripBom( file_get_contents( $localPath ) );
- if ( $this->getConfig()->get( 'ResourceLoaderValidateStaticJS' ) ) {
- // Static files don't really need to be checked as often; unlike
- // on-wiki module they shouldn't change unexpectedly without
- // admin interference.
- $contents = $this->validateScriptFile( $fileName, $contents );
- }
$js .= $contents . "\n";
}
return $js;