The ResourceLoaderModule::isRaw() feature and the ability to magically
switch a regular load.php request into raw mode is being removed soon.
Instead, specify raw=1 in the request url where that behaviour is needed.
Bug: T201483
Change-Id: Ie4564ec8e26ad53f2de1a43330d18a35b0498a63
),
[ 'html5shiv' ],
ResourceLoaderModule::TYPE_SCRIPTS,
),
[ 'html5shiv' ],
ResourceLoaderModule::TYPE_SCRIPTS,
+ [ 'raw' => '1', 'sync' => '1' ],
$this->getCSPNonce()
) .
'<![endif]-->';
$this->getCSPNonce()
) .
'<![endif]-->';
// Async scripts. Once the startup is loaded, inline RLQ scripts will run.
// Pass-through a custom 'target' from OutputPage (T143066).
// Async scripts. Once the startup is loaded, inline RLQ scripts will run.
// Pass-through a custom 'target' from OutputPage (T143066).
+ $startupQuery = [ 'raw' => '1' ];
foreach ( [ 'target', 'safemode' ] as $param ) {
if ( $this->options[$param] !== null ) {
$startupQuery[$param] = (string)$this->options[$param];
foreach ( [ 'target', 'safemode' ] as $param ) {
if ( $this->options[$param] !== null ) {
$startupQuery[$param] = (string)$this->options[$param];
// load before qunit/export.
$scripts = $out->makeResourceLoaderLink( 'jquery.qunit',
ResourceLoaderModule::TYPE_SCRIPTS,
// load before qunit/export.
$scripts = $out->makeResourceLoaderLink( 'jquery.qunit',
ResourceLoaderModule::TYPE_SCRIPTS,
- [ 'raw' => true, 'sync' => true ]
+ [ 'raw' => '1', 'sync' => '1' ]
);
$head = implode( "\n", [ $styles, $scripts ] );
);
$head = implode( "\n", [ $styles, $scripts ] );
. '});</script>' . "\n"
. '<link rel="stylesheet" href="/w/load.php?lang=nl&modules=test.styles.deprecated%2Cpure&only=styles"/>' . "\n"
. '<style>.private{}</style>' . "\n"
. '});</script>' . "\n"
. '<link rel="stylesheet" href="/w/load.php?lang=nl&modules=test.styles.deprecated%2Cpure&only=styles"/>' . "\n"
. '<style>.private{}</style>' . "\n"
- . '<script async="" src="/w/load.php?lang=nl&modules=startup&only=scripts"></script>';
+ . '<script async="" src="/w/load.php?lang=nl&modules=startup&only=scripts&raw=1"></script>';
// phpcs:enable
$expected = self::expandVariables( $expected );
// phpcs:enable
$expected = self::expandVariables( $expected );
// phpcs:disable Generic.Files.LineLength
$expected = '<script>document.documentElement.className=document.documentElement.className.replace(/(^|\s)client-nojs(\s|$)/,"$1client-js$2");</script>' . "\n"
// phpcs:disable Generic.Files.LineLength
$expected = '<script>document.documentElement.className=document.documentElement.className.replace(/(^|\s)client-nojs(\s|$)/,"$1client-js$2");</script>' . "\n"
- . '<script async="" src="/w/load.php?lang=nl&modules=startup&only=scripts&target=example"></script>';
+ . '<script async="" src="/w/load.php?lang=nl&modules=startup&only=scripts&raw=1&target=example"></script>';
// phpcs:enable
$this->assertSame( $expected, (string)$client->getHeadHtml() );
// phpcs:enable
$this->assertSame( $expected, (string)$client->getHeadHtml() );
// phpcs:disable Generic.Files.LineLength
$expected = '<script>document.documentElement.className=document.documentElement.className.replace(/(^|\s)client-nojs(\s|$)/,"$1client-js$2");</script>' . "\n"
// phpcs:disable Generic.Files.LineLength
$expected = '<script>document.documentElement.className=document.documentElement.className.replace(/(^|\s)client-nojs(\s|$)/,"$1client-js$2");</script>' . "\n"
- . '<script async="" src="/w/load.php?lang=nl&modules=startup&only=scripts&safemode=1"></script>';
+ . '<script async="" src="/w/load.php?lang=nl&modules=startup&only=scripts&raw=1&safemode=1"></script>';
// phpcs:enable
$this->assertSame( $expected, (string)$client->getHeadHtml() );
// phpcs:enable
$this->assertSame( $expected, (string)$client->getHeadHtml() );
// phpcs:disable Generic.Files.LineLength
$expected = '<script>document.documentElement.className=document.documentElement.className.replace(/(^|\s)client-nojs(\s|$)/,"$1client-js$2");</script>' . "\n"
// phpcs:disable Generic.Files.LineLength
$expected = '<script>document.documentElement.className=document.documentElement.className.replace(/(^|\s)client-nojs(\s|$)/,"$1client-js$2");</script>' . "\n"
- . '<script async="" src="/w/load.php?lang=nl&modules=startup&only=scripts"></script>';
+ . '<script async="" src="/w/load.php?lang=nl&modules=startup&only=scripts&raw=1"></script>';
// phpcs:enable
$this->assertSame( $expected, (string)$client->getHeadHtml() );
// phpcs:enable
$this->assertSame( $expected, (string)$client->getHeadHtml() );
- // Eg. startup module
- 'modules' => [ 'test.scripts.raw' ],
+ 'modules' => [ 'test.scripts' ],
'only' => ResourceLoaderModule::TYPE_SCRIPTS,
'only' => ResourceLoaderModule::TYPE_SCRIPTS,
- 'extra' => [],
- 'output' => '<script async="" src="/w/load.php?lang=nl&modules=test.scripts.raw&only=scripts"></script>',
+ // Eg. startup module
+ 'extra' => [ 'raw' => '1' ],
+ 'output' => '<script async="" src="/w/load.php?lang=nl&modules=test.scripts&only=scripts&raw=1"></script>',
- 'modules' => [ 'test.scripts.raw' ],
+ 'modules' => [ 'test.scripts' ],
'only' => ResourceLoaderModule::TYPE_SCRIPTS,
'only' => ResourceLoaderModule::TYPE_SCRIPTS,
- 'extra' => [ 'sync' => '1' ],
- 'output' => '<script src="/w/load.php?lang=nl&modules=test.scripts.raw&only=scripts&sync=1"></script>',
+ 'extra' => [ 'raw' => '1', 'sync' => '1' ],
+ 'output' => '<script src="/w/load.php?lang=nl&modules=test.scripts&only=scripts&raw=1&sync=1"></script>',
'test.scripts' => [],
'test.scripts.user' => [ 'group' => 'user' ],
'test.scripts.user.empty' => [ 'group' => 'user', 'isKnownEmpty' => true ],
'test.scripts' => [],
'test.scripts.user' => [ 'group' => 'user' ],
'test.scripts.user.empty' => [ 'group' => 'user', 'isKnownEmpty' => true ],
- 'test.scripts.raw' => [ 'isRaw' => true ],
'test.scripts.shouldembed' => [ 'shouldEmbed' => true ],
'test.ordering.a' => [ 'shouldEmbed' => false ],
'test.scripts.shouldembed' => [ 'shouldEmbed' => true ],
'test.ordering.a' => [ 'shouldEmbed' => false ],