X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderClientHtml.php;h=e324d044233de05b8231d0cdcc57bb818655dbe4;hp=6061fb518eee5ab7202e9489472ecd0977af4939;hb=dfec83932fd38a9086eb5a2e212889ad00f35b0e;hpb=81c91fd493fd52926b454826d621c60b7818503f diff --git a/includes/resourceloader/ResourceLoaderClientHtml.php b/includes/resourceloader/ResourceLoaderClientHtml.php index 6061fb518e..e324d04423 100644 --- a/includes/resourceloader/ResourceLoaderClientHtml.php +++ b/includes/resourceloader/ResourceLoaderClientHtml.php @@ -303,7 +303,7 @@ JAVASCRIPT; // Async scripts. Once the startup is loaded, inline RLQ scripts will run. // Pass-through a custom 'target' from OutputPage (T143066). - $startupQuery = []; + $startupQuery = [ 'raw' => '1' ]; foreach ( [ 'target', 'safemode' ] as $param ) { if ( $this->options[$param] !== null ) { $startupQuery[$param] = (string)$this->options[$param]; @@ -348,7 +348,7 @@ JAVASCRIPT; private static function makeContext( ResourceLoaderContext $mainContext, $group, $type, array $extraQuery = [] ) { - // Create new ResourceLoaderContext so that $extraQuery may trigger isRaw(). + // Create new ResourceLoaderContext so that $extraQuery is supported (eg. for 'sync=1'). $req = new FauxRequest( array_merge( $mainContext->getRequest()->getValues(), $extraQuery ) ); // Set 'only' if not combined $req->setVal( 'only', $type === ResourceLoaderModule::TYPE_COMBINED ? null : $type ); @@ -434,12 +434,6 @@ JAVASCRIPT; ); } } else { - // See if we have one or more raw modules - $isRaw = false; - foreach ( $moduleSet as $key => $module ) { - $isRaw |= $module->isRaw(); - } - // Special handling for the user group; because users might change their stuff // on-wiki like user pages, or user preferences; we need to find the highest // timestamp of these user-changeable modules so we can ensure cache misses on change @@ -455,9 +449,15 @@ JAVASCRIPT; // Decide whether to use 'style' or 'script' element if ( $only === ResourceLoaderModule::TYPE_STYLES ) { $chunk = Html::linkedStyle( $url ); - } elseif ( $context->getRaw() || $isRaw ) { + } elseif ( $context->getRaw() ) { + // This request is asking for the module to be delivered standalone, + // (aka "raw") without communicating to any mw.loader client. + // Use cases: + // - startup (naturally because this is what will define mw.loader) + // - html5shiv (loads synchronously in old IE before the async startup module arrives) + // - QUnit (needed in SpecialJavaScriptTest before async startup) $chunk = Html::element( 'script', [ - // In SpecialJavaScriptTest, QUnit must load synchronous + // The 'sync' option is only supported in combination with 'raw'. 'async' => !isset( $extraQuery['sync'] ), 'src' => $url ] );