'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 ),
// 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 );',
* @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;
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 );
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.
moduleMap = Object.create( null );
currReqModules = [];
- mw.track( 'resourceloader.splitRequest', { maxQueryLength: maxQueryLength } );
+ mw.track( 'resourceloader.splitRequest', { maxQueryLength: mw.loader.maxQueryLength } );
}
if ( !moduleMap[ prefix ] ) {
moduleMap[ prefix ] = [];
*/
moduleRegistry: registry,
+ /**
+ * Exposed for testing and debugging only.
+ *
+ * @see #batchRequest
+ * @property
+ * @private
+ */
+ maxQueryLength: $VARS.maxQueryLength,
+
/**
* @inheritdoc #newStyleTag
* @method
};
},
teardown: function () {
+ mw.loader.maxQueryLength = 2000;
// Teardown for StringSet shim test
if ( this.nativeSet ) {
window.Set = this.nativeSet;
[ 'testUrlIncDump', 'dump', [], null, 'testloader' ]
] );
- mw.config.set( 'wgResourceLoaderMaxQueryLength', 10 );
+ mw.loader.maxQueryLength = 10;
return mw.loader.using( [ 'testUrlIncDump', 'testUrlInc' ] ).then( function ( require ) {
assert.propEqual(