From 3bd1910f95bc64ea88afa40ead5f934ca3581e29 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Mon, 20 Aug 2018 20:19:24 +0100 Subject: [PATCH] resourceloader: Remove wgResourceLoaderValidateStaticJS setting 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 --- includes/DefaultSettings.php | 10 ---------- includes/resourceloader/ResourceLoaderFileModule.php | 9 --------- 2 files changed, 19 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 736e31911d..26136fe878 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3799,16 +3799,6 @@ $wgResourceLoaderMaxQueryLength = false; */ $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. diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index 6ee030e0e8..42bd66a0e8 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -460,9 +460,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { 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; } @@ -807,12 +804,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { 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; -- 2.20.1