resourceloader: Remove wgResourceLoaderValidateStaticJS setting
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 20 Aug 2018 19:19:24 +0000 (20:19 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Mon, 20 Aug 2018 19:25:01 +0000 (20:25 +0100)
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
includes/resourceloader/ResourceLoaderFileModule.php

index 736e319..26136fe 100644 (file)
@@ -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.
index 6ee030e..42bd66a 100644 (file)
@@ -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;