continue;
}
- $context = $this->getContext( $module->getGroup(), ResourceLoaderModule::TYPE_COMBINED );
+ $group = $module->getGroup();
+ $context = $this->getContext( $group, ResourceLoaderModule::TYPE_COMBINED );
if ( $module->isKnownEmpty( $context ) ) {
// Avoid needless request or embed for empty module
$data['states'][$name] = 'ready';
continue;
}
- if ( $module->shouldEmbedModule( $this->context ) ) {
- // Embed via mw.loader.implement per T36907.
+ if ( $group === 'user' || $module->shouldEmbedModule( $this->context ) ) {
+ // Call makeLoad() to decide how to load these, instead of
+ // loading via mw.loader.load().
+ // - For group=user: We need to provide a pre-generated load.php
+ // url to the client that has the 'user' and 'version' parameters
+ // filled in. Without this, the client would wrongly use the static
+ // version hash, per T64602.
+ // - For shouldEmbed=true: Embed via mw.loader.implement, per T36907.
$data['embed']['general'][] = $name;
// Avoid duplicate request from mw.loader
$data['states'][$name] = 'loading';
'test.private' => [ 'group' => 'private' ],
'test.shouldembed.empty' => [ 'shouldEmbed' => true, 'isKnownEmpty' => true ],
'test.shouldembed' => [ 'shouldEmbed' => true ],
+ 'test.user' => [ 'group' => 'user' ],
'test.styles.pure' => [ 'type' => ResourceLoaderModule::LOAD_STYLES ],
'test.styles.mixed' => [],
'test.private',
'test.shouldembed.empty',
'test.shouldembed',
+ 'test.user',
'test.unregistered',
] );
$client->setModuleStyles( [
'test.private' => 'loading',
'test.shouldembed.empty' => 'ready',
'test.shouldembed' => 'loading',
+ 'test.user' => 'loading',
'test.styles.pure' => 'ready',
'test.styles.user.empty' => 'ready',
'test.styles.private' => 'ready',
'general' => [
'test.private',
'test.shouldembed',
+ 'test.user',
],
],
];
'only' => ResourceLoaderModule::TYPE_SCRIPTS,
'output' => '<script>(window.RLQ=window.RLQ||[]).push(function(){mw.loader.load("/w/load.php?debug=false\u0026lang=nl\u0026modules=test.scripts.user\u0026only=scripts\u0026skin=fallback\u0026user=Example\u0026version=0a56zyi");});</script>',
],
+ [
+ 'context' => [],
+ 'modules' => [ 'test.user' ],
+ 'only' => ResourceLoaderModule::TYPE_COMBINED,
+ 'output' => '<script>(window.RLQ=window.RLQ||[]).push(function(){mw.loader.load("/w/load.php?debug=false\u0026lang=nl\u0026modules=test.user\u0026skin=fallback\u0026user=Example\u0026version=0a56zyi");});</script>',
+ ],
[
'context' => [ 'debug' => true ],
'modules' => [ 'test.styles.pure', 'test.styles.mixed' ],