ResourceLoaderSkinModule: Deprecated feature keys should be mapped
`content` should be mapped to `content-thumbnails` when using list mode rather than throwing a fatal. Bug: T271441 Change-Id: Idb30a94803f1432e2c1f57d55eb8c8aef1368dfb
This commit is contained in:
parent
270f2bd672
commit
53c0fa5f59
2 changed files with 21 additions and 7 deletions
|
|
@ -236,23 +236,20 @@ class ResourceLoaderSkinModule extends ResourceLoaderLessVarFileModule {
|
|||
$remoteBasePath = null
|
||||
) {
|
||||
$features = $options['features'] ?? self::DEFAULT_FEATURES_ABSENT;
|
||||
$listMode = array_keys( $features ) === range( 0, count( $features ) - 1 );
|
||||
// NOTE: Compatibility is only applied when features are provided
|
||||
// in map-form. The list-form does not currently get these.
|
||||
$features = self::applyFeaturesCompatibility( $features );
|
||||
$features = $listMode ? self::applyFeaturesCompatibility( array_fill_keys( $features, true ) ) :
|
||||
self::applyFeaturesCompatibility( $features );
|
||||
|
||||
$listMode = false;
|
||||
foreach ( $features as $key => $enabled ) {
|
||||
if ( is_string( $enabled ) ) {
|
||||
$listMode = true;
|
||||
$key = $enabled;
|
||||
}
|
||||
if ( !isset( self::FEATURE_FILES[$key] ) ) {
|
||||
throw new InvalidArgumentException( "Feature '$key' is not recognised" );
|
||||
}
|
||||
}
|
||||
|
||||
$this->features = $listMode
|
||||
? array_values( $features )
|
||||
? array_keys( array_filter( $features ) )
|
||||
: array_keys( array_filter( $features + self::DEFAULT_FEATURES_SPECIFIED ) );
|
||||
|
||||
// Only the `toc` feature makes use of interface messages.
|
||||
|
|
|
|||
|
|
@ -513,6 +513,11 @@ CSS
|
|||
$IP,
|
||||
'/w'
|
||||
);
|
||||
$cbPath = new ResourceLoaderFilePath(
|
||||
$featureFiles['content-body']['screen'][0],
|
||||
$IP,
|
||||
'/w'
|
||||
);
|
||||
|
||||
return [
|
||||
[
|
||||
|
|
@ -543,6 +548,18 @@ CSS
|
|||
'opt-in by default policy results in correct order'
|
||||
],
|
||||
|
||||
[
|
||||
[ 'content-parser-output' ],
|
||||
[ 'test.styles/all.css' ],
|
||||
[
|
||||
$cbPath
|
||||
],
|
||||
[
|
||||
'test.styles/all.css'
|
||||
],
|
||||
'content-parser-output mapped to content-body styles'
|
||||
],
|
||||
|
||||
[
|
||||
[ 'normalize' ],
|
||||
[ 'test.styles/styles.css' => [ 'media' => 'screen' ] ],
|
||||
|
|
|
|||
Loading…
Reference in a new issue