resourceloader: Remove ResourceLoaderMaxQueryLength from mw.config

This is only used internally. It doesn't need to be exported
as part of mw.config.

Change-Id: If4206d797b5d426eb999c34ad5dde3ba141c6f05
This commit is contained in:
Timo Tijhof 2019-03-06 15:46:44 +00:00
parent 1476e9994b
commit 194bdc09a8
4 changed files with 21 additions and 8 deletions

View file

@ -114,7 +114,6 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
'wgCookieDomain' => $conf->get( 'CookieDomain' ),
'wgCookiePath' => $conf->get( 'CookiePath' ),
'wgCookieExpiration' => $conf->get( 'CookieExpiration' ),
'wgResourceLoaderMaxQueryLength' => $conf->get( 'ResourceLoaderMaxQueryLength' ),
'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces,
'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass( Title::legalChars() ),
'wgIllegalFileChars' => Title::convertByteClassToUnicodeClass( $illegalFileChars ),
@ -409,6 +408,9 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
// Perform replacements for mediawiki.js
$mwLoaderPairs = [
'$VARS.baseModules' => ResourceLoader::encodeJsonForScript( $this->getBaseModules() ),
'$VARS.maxQueryLength' => ResourceLoader::encodeJsonForScript(
$conf->get( 'ResourceLoaderMaxQueryLength' )
),
];
$profilerStubs = [
'$CODE.profileExecuteStart();' => 'mw.loader.profiler.onExecuteStart( module );',

View file

@ -34,10 +34,12 @@
};
</script>
<script>
// Mock startup.js
// Mock ResourceLoaderStartUpModule substitutions
window.$VARS = {
baseModules: []
baseModules: [],
maxQueryLength: 2000
};
// Mock startup.js
window.RLQ = [];
</script>
<script src="modules/src/startup/mediawiki.js"></script>

View file

@ -1579,7 +1579,7 @@
* @param {string[]} batch
*/
function batchRequest( batch ) {
var reqBase, splits, maxQueryLength, b, bSource, bGroup,
var reqBase, splits, b, bSource, bGroup,
source, group, i, modules, sourceLoadScript,
currReqBase, currReqBaseLength, moduleMap, currReqModules, l,
lastDotIndex, prefix, suffix, bytesAdded;
@ -1618,7 +1618,6 @@
lang: mw.config.get( 'wgUserLanguage' ),
debug: mw.config.get( 'debug' )
};
maxQueryLength = mw.config.get( 'wgResourceLoaderMaxQueryLength', 2000 );
// Split module list by source and by group.
splits = Object.create( null );
@ -1674,7 +1673,7 @@
modules[ i ].length + 3; // '%7C'.length == 3
// If the url would become too long, create a new one, but don't create empty requests
if ( maxQueryLength > 0 && currReqModules.length && l + bytesAdded > maxQueryLength ) {
if ( currReqModules.length && l + bytesAdded > mw.loader.maxQueryLength ) {
// Dispatch what we've got...
doRequest();
// .. and start again.
@ -1682,7 +1681,7 @@
moduleMap = Object.create( null );
currReqModules = [];
mw.track( 'resourceloader.splitRequest', { maxQueryLength: maxQueryLength } );
mw.track( 'resourceloader.splitRequest', { maxQueryLength: mw.loader.maxQueryLength } );
}
if ( !moduleMap[ prefix ] ) {
moduleMap[ prefix ] = [];
@ -1792,6 +1791,15 @@
*/
moduleRegistry: registry,
/**
* Exposed for testing and debugging only.
*
* @see #batchRequest
* @property
* @private
*/
maxQueryLength: $VARS.maxQueryLength,
/**
* @inheritdoc #newStyleTag
* @method

View file

@ -15,6 +15,7 @@
};
},
teardown: function () {
mw.loader.maxQueryLength = 2000;
// Teardown for StringSet shim test
if ( this.nativeSet ) {
window.Set = this.nativeSet;
@ -624,7 +625,7 @@
[ 'testUrlIncDump', 'dump', [], null, 'testloader' ]
] );
mw.config.set( 'wgResourceLoaderMaxQueryLength', 10 );
mw.loader.maxQueryLength = 10;
return mw.loader.using( [ 'testUrlIncDump', 'testUrlInc' ] ).then( function ( require ) {
assert.propEqual(