7 '{blankVer}' => self::BLANK_VERSION
14 'msg' =>
'Empty registry',
18 "local": "/w/load.php"
20mw.loader.register( [] );'
23 'msg' =>
'Basic registry',
29 "local": "/w/load.php"
39 'msg' =>
'Omit raw modules from registry',
46 "local": "/w/load.php"
56 'msg' =>
'Version falls back gracefully if getVersionHash throws',
59 ( $mock = $this->getMockBuilder( ResourceLoaderTestModule::class )
60 ->setMethods( [
'getVersionHash' ] )->getMock() )
61 && $mock->method(
'getVersionHash' )->will(
62 $this->throwException(
new Exception )
68 "local": "/w/load.php"
81 'msg' =>
'Use version from getVersionHash',
84 ( $mock = $this->getMockBuilder( ResourceLoaderTestModule::class )
85 ->setMethods( [
'getVersionHash' ] )->getMock() )
86 && $mock->method(
'getVersionHash' )->willReturn(
'1234567' )
91 "local": "/w/load.php"
101 'msg' =>
'Re-hash version from getVersionHash if too long',
104 ( $mock = $this->getMockBuilder( ResourceLoaderTestModule::class )
105 ->setMethods( [
'getVersionHash' ] )->getMock() )
106 && $mock->method(
'getVersionHash' )->willReturn(
'12345678' )
110mw.loader.addSource( {
111 "local": "/w/load.php"
121 'msg' =>
'Group signature',
128mw.loader.addSource( {
129 "local": "/w/load.php"
151 'msg' =>
'Different target (non-test should not be registered)',
157mw.loader.addSource( {
158 "local": "/w/load.php"
168 'msg' =>
'Foreign source',
171 'loadScript' =>
'http://example.org/w/load.php',
172 'apiScript' =>
'http://example.org/w/api.php',
179mw.loader.addSource( {
180 "local": "/w/load.php",
181 "example": "http://example.org/w/load.php"
194 'msg' =>
'Conditional dependency function',
198 'skipFunction' =>
'return true;'
217mw.loader.addSource( {
218 "local": "/w/load.php"
239 "return !!( window.JSON \u0026\u0026 JSON.parse \u0026\u0026 JSON.stringify);"
257 'msg' =>
'Advanced (everything combined)',
260 'loadScript' =>
'http://example.org/w/load.php',
261 'apiScript' =>
'http://example.org/w/api.php',
302 'source' =>
'example',
305 'targets' => [
'x-foo' ],
308 'source' =>
'example',
309 'targets' => [
'x-foo' ],
313mw.loader.addSource( {
314 "local": "/w/load.php",
315 "example": "http://example.org/w/load.php"
393 if ( isset( $case[
'sources'] ) ) {
394 $this->
setMwGlobals(
'wgResourceLoaderSources', $case[
'sources'] );
398 $rl =
$context->getResourceLoader();
399 $rl->register( $case[
'modules'] );
401 $out = ltrim( $case[
'out'],
"\n" );
405 $this->
setLogger(
'exception',
new Psr\Log\NullLogger() );
408 self::expandPlaceholders(
$out ),
409 $module->getModuleRegistrations(
$context ),
440 $rl =
$context->getResourceLoader();
443 $out =
'mw.loader.addSource({"local":"/w/load.php"});' .
"\n"
444 .
'mw.loader.register(['
445 .
'["test.blank","{blankVer}"],'
446 .
'["test.min","{blankVer}",[0],null,null,'
447 .
'"return!!(window.JSON\u0026\u0026JSON.parse\u0026\u0026JSON.stringify);"'
451 self::expandPlaceholders(
$out ),
452 $module->getModuleRegistrations(
$context ),
463 $rl =
$context->getResourceLoader();
467'mw.loader.addSource( {
468 "local": "/w/load.php"
483 "return !!( window.JSON \u0026\u0026 JSON.parse \u0026\u0026 JSON.stringify);"
488 self::expandPlaceholders(
$out ),
489 $module->getModuleRegistrations(
$context ),
static provideRegistrations()
provideGetModuleRegistrations()
testRegistrationsUnminified( $modules)
ResourceLoaderStartUpModule::getModuleRegistrations provideRegistrations.
testGetModuleRegistrations( $case)
provideGetModuleRegistrations ResourceLoaderStartUpModule::getModuleRegistrations ResourceLoaderStart...
static expandPlaceholders( $text)
testRegistrationsMinified( $modules)
ResourceLoaderStartUpModule::getModuleRegistrations provideRegistrations.
Module for ResourceLoader initialization.
getResourceLoaderContext( $options=[], ResourceLoader $rl=null)
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out