X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderClientHtml.php;h=6529a9a306b1bcdfbaad08b75fe2c2a2d76f9dbd;hp=8303896ef791c023d95077e0ba7ac90538d503f0;hb=5155abe0e6ab6589d4104a221df0a0b2c5142c16;hpb=d4e0dbcf96d2a9cdff4a73f56d33beb5c25aa442
diff --git a/includes/resourceloader/ResourceLoaderClientHtml.php b/includes/resourceloader/ResourceLoaderClientHtml.php
index 8303896ef7..6529a9a306 100644
--- a/includes/resourceloader/ResourceLoaderClientHtml.php
+++ b/includes/resourceloader/ResourceLoaderClientHtml.php
@@ -24,6 +24,7 @@ use Wikimedia\WrappedStringList;
/**
* Load and configure a ResourceLoader client on an HTML page.
*
+ * @ingroup ResourceLoader
* @since 1.28
*/
class ResourceLoaderClientHtml {
@@ -212,7 +213,7 @@ class ResourceLoaderClientHtml {
// Load from load.php?only=styles via
$data['styles'][] = $name;
}
- $deprecation = $module->getDeprecationInformation();
+ $deprecation = $module->getDeprecationInformation( $context );
if ( $deprecation ) {
$data['styleDeprecations'][] = $deprecation;
}
@@ -253,14 +254,14 @@ class ResourceLoaderClientHtml {
// See also startup/startup.js.
$nojsClass = $nojsClass ?? $this->getDocumentAttributes()['class'];
$jsClass = preg_replace( '/(^|\s)client-nojs(\s|$)/', '$1client-js$2', $nojsClass );
- $jsClassJson = ResourceLoader::encodeJsonForScript( $jsClass );
+ $jsClassJson = $this->context->encodeJson( $jsClass );
$script = <<config ) {
- $confJson = ResourceLoader::encodeJsonForScript( $this->config );
+ $confJson = $this->context->encodeJson( $this->config );
$script .= <<exemptStates, $data['states'] );
if ( $states ) {
- $stateJson = ResourceLoader::encodeJsonForScript( $states );
+ $stateJson = $this->context->encodeJson( $states );
$script .= <<context->encodeJson( $data['general'] );
$script .= << $module ) {
$shouldEmbed = $module->shouldEmbedModule( $context );
- // @phan-suppress-next-line PhanTypeInvalidDimOffset
if ( !$moduleSets || $moduleSets[$idx][0] !== $shouldEmbed ) {
$moduleSets[++$idx] = [ $shouldEmbed, [] ];
}
@@ -479,7 +479,7 @@ JAVASCRIPT;
] );
} else {
$chunk = ResourceLoader::makeInlineScript(
- Xml::encodeJsCall( 'mw.loader.load', [ $url ] ),
+ 'mw.loader.load(' . $mainContext->encodeJson( $url ) . ');',
$nonce
);
}