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',
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',
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' =>
'Safemode disabled (default; register all modules)',
183mw.loader.addSource( {
184 "local": "/w/load.php"
192 "test.core-generated",
206 'msg' =>
'Safemode enabled (filter modules with user/site origin)',
207 'extraQuery' => [
'safemode' =>
'1' ],
222mw.loader.addSource( {
223 "local": "/w/load.php"
231 "test.core-generated",
237 'msg' =>
'Foreign source',
240 'loadScript' =>
'http://example.org/w/load.php',
241 'apiScript' =>
'http://example.org/w/api.php',
248mw.loader.addSource( {
249 "local": "/w/load.php",
250 "example": "http://example.org/w/load.php"
263 'msg' =>
'Conditional dependency function',
267 'skipFunction' =>
'return true;'
286mw.loader.addSource( {
287 "local": "/w/load.php"
308 "return !!( window.JSON \u0026\u0026 JSON.parse \u0026\u0026 JSON.stringify);"
326 'msg' =>
'Advanced (everything combined)',
329 'loadScript' =>
'http://example.org/w/load.php',
330 'apiScript' =>
'http://example.org/w/api.php',
371 'source' =>
'example',
374 'targets' => [
'x-foo' ],
377 'source' =>
'example',
378 'targets' => [
'x-foo' ],
382mw.loader.addSource( {
383 "local": "/w/load.php",
384 "example": "http://example.org/w/load.php"
462 $extraQuery = $case[
'extraQuery'] ?? [];
464 $rl =
$context->getResourceLoader();
465 if (
isset( $case[
'sources'] ) ) {
466 $rl->addSource( $case[
'sources'] );
468 $rl->register( $case[
'modules'] );
474 $this->
setLogger(
'exception',
new Psr\Log\NullLogger() );
477 self::expandPlaceholders(
$out ),
478 $module->getModuleRegistrations(
$context ),
510 $rl =
$context->getResourceLoader();
513 $out =
'mw.loader.addSource({"local":"/w/load.php"});' .
"\n"
514 .
'mw.loader.register(['
515 .
'["test.blank","{blankVer}"],'
516 .
'["test.min","{blankVer}",[0],null,null,'
517 .
'"return!!(window.JSON\u0026\u0026JSON.parse\u0026\u0026JSON.stringify);"'
521 self::expandPlaceholders(
$out ),
522 $module->getModuleRegistrations(
$context ),
533 $rl =
$context->getResourceLoader();
537'mw.loader.addSource( {
538 "local": "/w/load.php"
553 "return !!( window.JSON \u0026\u0026 JSON.parse \u0026\u0026 JSON.stringify);"
558 self::expandPlaceholders(
$out ),
559 $module->getModuleRegistrations(
$context ),
572 $version1 = $module->getVersionHash(
$context );
574 $version2 = $module->getVersionHash(
$context );
578 $version3 = $module->getVersionHash(
$context );
583 'Deterministic version hash'
589 'Config change impacts version hash'
598 $rl1 = $context1->getResourceLoader();
604 $version1 = $module->getVersionHash( $context1 );
607 $rl2 = $context2->getResourceLoader();
613 $version2 = $module->getVersionHash( $context2 );
616 $rl3 = $context3->getResourceLoader();
622 $version3 = $module->getVersionHash( $context3 );
628 'Module name is significant'
634 'Hash change of any module impacts startup hash'
643 $rl =
$context->getResourceLoader();
648 $version1 = $module->getVersionHash(
$context );
651 $rl =
$context->getResourceLoader();
656 $version2 = $module->getVersionHash(
$context );
662 'Dependencies are significant'
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
const ORIGIN_USER_SITEWIDE
const ORIGIN_USER_INDIVIDUAL
const ORIGIN_CORE_INDIVIDUAL
testGetVersionHash_varyDeps()
ResourceLoaderStartupModule.
static provideRegistrations()
testGetVersionHash_varyConfig()
ResourceLoaderStartupModule::getDefinitionSummary.
provideGetModuleRegistrations()
testGetVersionHash_varyModule()
ResourceLoaderStartupModule.
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)
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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
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