From 3dc6b84a3148651e3bf5a2e44a2f7ddbf664f894 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 8 Mar 2019 20:37:12 +0000 Subject: [PATCH] resourceloader: Omit default 'debug=false' from load.php urls Change-Id: I2a2f92b0f0438420105e6a4e4d97eb5f8c480917 --- includes/resourceloader/ResourceLoader.php | 4 ++- tests/phpunit/includes/OutputPageTest.php | 24 +++++++-------- .../ResourceLoaderClientHtmlTest.php | 30 +++++++++---------- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index b36b8d0c76..5712692d6f 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -1695,8 +1695,10 @@ MESSAGE; 'modules' => self::makePackedModulesString( $modules ), 'lang' => $lang, 'skin' => $skin, - 'debug' => $debug ? 'true' : 'false', ]; + if ( $debug === true ) { + $query['debug'] = 'true'; + } if ( $user !== null ) { $query['user'] = $user; } diff --git a/tests/phpunit/includes/OutputPageTest.php b/tests/phpunit/includes/OutputPageTest.php index abc7c43542..aa14124a2c 100644 --- a/tests/phpunit/includes/OutputPageTest.php +++ b/tests/phpunit/includes/OutputPageTest.php @@ -2574,14 +2574,14 @@ class OutputPageTest extends MediaWikiTestCase { [ [ 'test.foo', ResourceLoaderModule::TYPE_SCRIPTS ], "" ], // Multiple only=styles load [ [ [ 'test.baz', 'test.foo', 'test.bar' ], ResourceLoaderModule::TYPE_STYLES ], - '' + '' ], // Private embed (only=scripts) [ @@ -2606,14 +2606,14 @@ class OutputPageTest extends MediaWikiTestCase { // noscript group [ [ 'test.noscript', ResourceLoaderModule::TYPE_STYLES ], - '' + '' ], // Load two modules in separate groups [ [ [ 'test.group.foo', 'test.group.bar' ], ResourceLoaderModule::TYPE_COMBINED ], "" ], ]; @@ -2677,13 +2677,13 @@ class OutputPageTest extends MediaWikiTestCase { 'default logged-out' => [ 'exemptStyleModules' => [ 'site' => [ 'site.styles' ] ], '' . "\n" . - '', + '', ], 'default logged-in' => [ 'exemptStyleModules' => [ 'site' => [ 'site.styles' ], 'user' => [ 'user.styles' ] ], '' . "\n" . - '' . "\n" . - '', + '' . "\n" . + '', ], 'custom modules' => [ 'exemptStyleModules' => [ @@ -2691,10 +2691,10 @@ class OutputPageTest extends MediaWikiTestCase { 'user' => [ 'user.styles', 'example.user' ], ], '' . "\n" . - '' . "\n" . - '' . "\n" . - '' . "\n" . - '', + '' . "\n" . + '' . "\n" . + '' . "\n" . + '', ], ]; // phpcs:enable diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php index d896e4ebbc..50b9421429 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php @@ -207,9 +207,9 @@ Deprecation message.' ] . 'mw.loader.implement("test.private@{blankVer}",null,{"css":[]});' . 'RLPAGEMODULES=["test"];mw.loader.load(RLPAGEMODULES);' . '});' . "\n" - . '' . "\n" + . '' . "\n" . '' . "\n" - . ''; + . ''; // phpcs:enable $expected = self::expandVariables( $expected ); @@ -229,7 +229,7 @@ Deprecation message.' ] // phpcs:disable Generic.Files.LineLength $expected = '' . "\n" - . ''; + . ''; // phpcs:enable $this->assertEquals( $expected, $client->getHeadHtml() ); @@ -248,7 +248,7 @@ Deprecation message.' ] // phpcs:disable Generic.Files.LineLength $expected = '' . "\n" - . ''; + . ''; // phpcs:enable $this->assertEquals( $expected, $client->getHeadHtml() ); @@ -267,7 +267,7 @@ Deprecation message.' ] // phpcs:disable Generic.Files.LineLength $expected = '' . "\n" - . ''; + . ''; // phpcs:enable $this->assertEquals( $expected, $client->getHeadHtml() ); @@ -329,28 +329,28 @@ Deprecation message.' ] 'modules' => [ 'test.scripts.raw' ], 'only' => ResourceLoaderModule::TYPE_SCRIPTS, 'extra' => [], - 'output' => '', + 'output' => '', ], [ 'context' => [], 'modules' => [ 'test.scripts.raw' ], 'only' => ResourceLoaderModule::TYPE_SCRIPTS, 'extra' => [ 'sync' => '1' ], - 'output' => '', + 'output' => '', ], [ 'context' => [], 'modules' => [ 'test.scripts.user' ], 'only' => ResourceLoaderModule::TYPE_SCRIPTS, 'extra' => [], - 'output' => '', + 'output' => '', ], [ 'context' => [], 'modules' => [ 'test.user' ], 'only' => ResourceLoaderModule::TYPE_COMBINED, 'extra' => [], - 'output' => '', + 'output' => '', ], [ 'context' => [ 'debug' => 'true' ], @@ -365,14 +365,14 @@ Deprecation message.' ] 'modules' => [ 'test.styles.pure', 'test.styles.mixed' ], 'only' => ResourceLoaderModule::TYPE_STYLES, 'extra' => [], - 'output' => '', + 'output' => '', ], [ 'context' => [], 'modules' => [ 'test.styles.noscript' ], 'only' => ResourceLoaderModule::TYPE_STYLES, 'extra' => [], - 'output' => '', + 'output' => '', ], [ 'context' => [], @@ -400,7 +400,7 @@ Deprecation message.' ] 'modules' => [ 'test', 'test.shouldembed' ], 'only' => ResourceLoaderModule::TYPE_COMBINED, 'extra' => [], - 'output' => '', + 'output' => '', ], [ 'context' => [], @@ -408,7 +408,7 @@ Deprecation message.' ] 'only' => ResourceLoaderModule::TYPE_STYLES, 'extra' => [], 'output' => - '' . "\n" + '' . "\n" . '' ], [ @@ -417,9 +417,9 @@ Deprecation message.' ] 'only' => ResourceLoaderModule::TYPE_STYLES, 'extra' => [], 'output' => - '' . "\n" + '' . "\n" . '' . "\n" - . '' + . '' ], ]; // phpcs:enable -- 2.20.1