'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 ) {
'test.scripts.mixed.user.empty' => 'ready',
],
'general' => [
- 'top' => [ 'test.top' ],
- 'bottom' => [ 'test' ],
+ 'test',
+ 'test.top',
],
'styles' => [
'test.styles.mixed',
'test.styles.pure',
],
'scripts' => [
- 'top' => [ 'test.scripts.top' ],
- 'bottom' => [ 'test.scripts' ],
+ 'test.scripts',
+ 'test.scripts.top',
],
'embed' => [
'styles' => [ 'test.styles.private' ],
'general' => [
- 'top' => [ 'test.private.top' ],
- 'bottom' => [ 'test.private.bottom' ],
+ 'test.private.bottom',
+ 'test.private.top',
],
],
];
'test.scripts',
] );
- // @codingStandardsIgnoreStart Generic.Files.LineLength
- $expected = '<script>(window.RLQ=window.RLQ||[]).push(function(){'
- . 'mw.loader.implement("test.private.bottom@{blankVer}",function($,jQuery,require,module){},{"css":[]});'
- . 'mw.loader.load("/w/load.php?debug=false\u0026lang=nl\u0026modules=test.scripts\u0026only=scripts\u0026skin=fallback");'
- . 'mw.loader.load(["test"]);'
- . '});</script>';
- // @codingStandardsIgnoreEnd
+ $expected = '';
$expected = self::expandVariables( $expected );
$this->assertEquals( $expected, $client->getBodyHtml() );