Not sure if this is intentional, but ResourceLoaderWikiModule seems to be behaving weirdly with group=user when dependencies are present.
Minimal steps for reproduction: add to LocalSettings.php:
class TestUserResourceLoaderModule extends ResourceLoaderWikiModule {
public function getDependencies( ResourceLoaderContext $context = null ) {
return ["jquery.i18n"];
}
}
$wgHooks['ResourceLoaderRegisterModules'][] = static function ( ResourceLoader $rl ) {
$rl->register( 'testuser', [
'class' => TestUserResourceLoaderModule::class,
'scripts' => [ 'MediaWiki:Testuser.js' ],
'group' => 'user'
] );
};
$wgHooks['BeforePageDisplay'][] = static function ( OutputPage $out ) {
$out->addModules( "testuser" );
};Expected behaviour:
RL module is registered and run on all pages. Code in MediaWiki:Testuser.js is executed. Module state should become ready after page load.
Actual behaviour:
RL module is registered but not run. mw.loader.moduleRegistry says the state is loaded. MediaWiki:Testuser.js gets executed only when mw.loader.load("testuser") is run.
If we remove the dependency in TestUserResourceLoaderModule, then the behaviour is as expected.
I came across this issue while working on T36958 – though the issue in that patch is different (user gadgets load, but the dependencies specified don't).