resourceloader: Remove internal 'wgResourceLoaderStorageEnabled' from mw.config
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 25 Jul 2019 16:41:06 +0000 (17:41 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 25 Jul 2019 16:41:06 +0000 (17:41 +0100)
Only needed internally by the startup module, which can export it
through private means instead.

Follows 0a8e37f042c2c and 30ddfc8a7721.

Change-Id: I5e54bd51d9b47146e1ef9a64b14c1a00697bd6a9

includes/resourceloader/ResourceLoaderStartUpModule.php
resources/src/startup/mediawiki.js

index 7880f6f..f0ef25a 100644 (file)
@@ -105,7 +105,6 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                        'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces,
                        'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass( Title::legalChars() ),
                        'wgIllegalFileChars' => Title::convertByteClassToUnicodeClass( $illegalFileChars ),
-                       'wgResourceLoaderStorageEnabled' => $conf->get( 'ResourceLoaderStorageEnabled' ),
                        'wgForeignUploadTargets' => $conf->get( 'ForeignUploadTargets' ),
                        'wgEnableUploads' => $conf->get( 'EnableUploads' ),
                        'wgCommentByteLimit' => null,
@@ -422,6 +421,11 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                        '$VARS.maxQueryLength' => ResourceLoader::encodeJsonForScript(
                                $conf->get( 'ResourceLoaderMaxQueryLength' )
                        ),
+                       // The client-side module cache can be disabled by site configuration.
+                       // It is also always disabled in debug mode.
+                       '$VARS.storeEnabled' => ResourceLoader::encodeJsonForScript(
+                               $conf->get( 'ResourceLoaderStorageEnabled' ) && !$context->getDebug()
+                       ),
                        '$VARS.storeKey' => ResourceLoader::encodeJsonForScript( $this->getStoreKey() ),
                        '$VARS.storeVary' => ResourceLoader::encodeJsonForScript( $this->getStoreVary( $context ) ),
                ];
index 2081bfe..b2a8f5b 100644 (file)
                                                }
 
                                                if (
+                                                       !$VARS.storeEnabled ||
+
                                                        // Disabled because localStorage quotas are tight and (in Firefox's case)
                                                        // shared by multiple origins.
                                                        // See T66721, and <https://bugzilla.mozilla.org/show_bug.cgi?id=1064466>.
-                                                       /Firefox/.test( navigator.userAgent ) ||
-
-                                                       // Disabled by configuration.
-                                                       !mw.config.get( 'wgResourceLoaderStorageEnabled' ) ||
-
-                                                       // Disable module store in debug mode context
-                                                       mw.config.get( 'debug' )
+                                                       /Firefox/.test( navigator.userAgent )
                                                ) {
                                                        // Clear any previous store to free up space. (T66721)
                                                        this.clear();