OutputPage::addScriptFile: Drop silencing invalid paths, deprecated in 1.24
authorJames D. Forrester <jforrester@wikimedia.org>
Mon, 24 Jun 2019 23:16:58 +0000 (16:16 -0700)
committerKrinkle <krinklemail@gmail.com>
Thu, 27 Jun 2019 17:22:52 +0000 (17:22 +0000)
Change-Id: Ia65c70366ab67324ef2a02f9b0e81a6fb7a081cb

RELEASE-NOTES-1.34
includes/OutputPage.php
tests/phpunit/includes/OutputPageTest.php

index bba7df1..d34b459 100644 (file)
@@ -247,6 +247,10 @@ because of Phabricator reports.
   Use MediaWiki\Session\SessionManager instead.
 * The wfGetLBFactory global function, deprecated in 1.27, has been removed.
   Use MediaWikiServices::getInstance()->getDBLoadBalancerFactory().
+* The internal method OutputPage->addScriptFile() will no longer silently drop
+  calls that use an invalid path (i.e., something other than an absolute path,
+  protocol-relative URL, or full scheme URL), and will instead pass them to the
+  client where they will likely 404. This usage was deprecated in 1.24.
 * …
 
 === Deprecations in 1.34 ===
index 4ccb0d4..e0ca258 100644 (file)
@@ -459,13 +459,6 @@ class OutputPage extends ContextSource {
         * @param string|null $unused Previously used to change the cache-busting query parameter
         */
        public function addScriptFile( $file, $unused = null ) {
-               if ( substr( $file, 0, 1 ) !== '/' && !preg_match( '#^[a-z]*://#i', $file ) ) {
-                       // This is not an absolute path, protocol-relative url, or full scheme url,
-                       // presumed to be an old call intended to include a file from /w/skins/common,
-                       // which doesn't exist anymore as of MediaWiki 1.24 per T71277. Ignore.
-                       wfDeprecated( __METHOD__, '1.24' );
-                       return;
-               }
                $this->addScript( Html::linkedScript( $file, $this->getCSPNonce() ) );
        }
 
index 25de1a3..243a90d 100644 (file)
@@ -298,33 +298,6 @@ class OutputPageTest extends MediaWikiTestCase {
                );
        }
 
-       /**
-        * Test that addScriptFile() throws due to deprecation.
-        *
-        * @covers OutputPage::addScriptFile
-        */
-       public function testAddDeprecatedScriptFileWarning() {
-               $this->setExpectedException( PHPUnit_Framework_Error_Deprecated::class,
-                       'Use of OutputPage::addScriptFile was deprecated in MediaWiki 1.24.' );
-
-               $op = $this->newInstance();
-               $op->addScriptFile( 'ignored-script.js' );
-       }
-
-       /**
-        * Test the actual behavior of the method (in the case where it doesn't throw, e.g., in
-        * production).
-        *
-        * @covers OutputPage::addScriptFile
-        */
-       public function testAddDeprecatedScriptFileNoOp() {
-               $this->hideDeprecated( 'OutputPage::addScriptFile' );
-               $op = $this->newInstance();
-               $op->addScriptFile( 'ignored-script.js' );
-
-               $this->assertNotContains( 'ignored-script.js', '' . $op->getBottomScripts() );
-       }
-
        /**
         * @covers OutputPage::addInlineScript
         */