'states' => [
// moduleName => state
],
- 'general' => [
- // position => [ moduleName ]
- 'top' => [],
- 'bottom' => [],
- ],
+ 'general' => [],
'styles' => [
// moduleName
],
- 'scripts' => [
- // position => [ moduleName ]
- 'top' => [],
- 'bottom' => [],
- ],
+ 'scripts' => [],
// Embedding for private modules
'embed' => [
'styles' => [],
- 'general' => [
- 'top' => [],
- 'bottom' => [],
- ],
+ 'general' => [],
],
];
}
$group = $module->getGroup();
- $position = $module->getPosition();
if ( $group === 'private' ) {
// Embed via mw.loader.implement per T36907.
- $data['embed']['general'][$position][] = $name;
+ $data['embed']['general'][] = $name;
// Avoid duplicate request from mw.loader
$data['states'][$name] = 'loading';
} else {
// Load via mw.loader.load()
- $data['general'][$position][] = $name;
+ $data['general'][] = $name;
}
}
}
$group = $module->getGroup();
- $position = $module->getPosition();
$context = $this->getContext( $group, ResourceLoaderModule::TYPE_SCRIPTS );
if ( $module->isKnownEmpty( $context ) ) {
// Avoid needless request for empty module
$data['states'][$name] = 'ready';
} else {
// Load from load.php?only=scripts via <script src></script>
- $data['scripts'][$position][] = $name;
+ $data['scripts'][] = $name;
// Avoid duplicate request from mw.loader
$data['states'][$name] = 'loading';
}
// Inline RLQ: Embedded modules
- if ( $data['embed']['general']['top'] ) {
+ if ( $data['embed']['general'] ) {
$chunks[] = $this->getLoad(
- $data['embed']['general']['top'],
+ $data['embed']['general'],
ResourceLoaderModule::TYPE_COMBINED
);
}
// Inline RLQ: Load general modules
- if ( $data['general']['top'] ) {
+ if ( $data['general'] ) {
$chunks[] = ResourceLoader::makeInlineScript(
- Xml::encodeJsCall( 'mw.loader.load', [ $data['general']['top'] ] )
+ Xml::encodeJsCall( 'mw.loader.load', [ $data['general'] ] )
);
}
// Inline RLQ: Load only=scripts
- if ( $data['scripts']['top'] ) {
+ if ( $data['scripts'] ) {
$chunks[] = $this->getLoad(
- $data['scripts']['top'],
+ $data['scripts'],
ResourceLoaderModule::TYPE_SCRIPTS
);
}
* @return string|WrappedStringList HTML
*/
public function getBodyHtml() {
- $data = $this->getData();
- $chunks = [];
-
- // Inline RLQ: Embedded modules
- if ( $data['embed']['general']['bottom'] ) {
- $chunks[] = $this->getLoad(
- $data['embed']['general']['bottom'],
- ResourceLoaderModule::TYPE_COMBINED
- );
- }
-
- // Inline RLQ: Load only=scripts
- if ( $data['scripts']['bottom'] ) {
- $chunks[] = $this->getLoad(
- $data['scripts']['bottom'],
- ResourceLoaderModule::TYPE_SCRIPTS
- );
- }
-
- // Inline RLQ: Load general modules
- if ( $data['general']['bottom'] ) {
- $chunks[] = ResourceLoader::makeInlineScript(
- Xml::encodeJsCall( 'mw.loader.load', [ $data['general']['bottom'] ] )
- );
- }
-
- return WrappedStringList::join( "\n", $chunks );
+ return '';
}
private function getContext( $group, $type ) {
foreach ( $sortedModules as $source => $groups ) {
foreach ( $groups as $group => $grpModules ) {
$context = self::makeContext( $mainContext, $group, $only, $extraQuery );
+ $context->setModules( array_keys( $grpModules ) );
if ( $group === 'private' ) {
// Decide whether to use style or script element
// This should NOT be done for the site group (bug 27564) because anons get that too
// and we shouldn't be putting timestamps in CDN-cached HTML
if ( $group === 'user' ) {
- $version = $rl->getCombinedVersion( $context, array_keys( $grpModules ) );
- $context->setVersion( $version );
+ // Must setModules() before makeVersionQuery()
+ $context->setVersion( $rl->makeVersionQuery( $context ) );
}
- $context->setModules( array_keys( $grpModules ) );
$url = $rl->createLoaderURL( $source, $context, $extraQuery );
// Decide whether to use 'style' or 'script' element