Toggle logo preloading via the skin
authorGilles Dubuc <gilles@wikimedia.org>
Tue, 2 May 2017 12:58:06 +0000 (14:58 +0200)
committerGilles Dubuc <gdubuc@wikimedia.org>
Tue, 2 May 2017 13:05:11 +0000 (15:05 +0200)
Bug: T100999
Change-Id: I0e18dc7fdbf133f3e4002f48f3040604687571dc

includes/OutputPage.php
includes/skins/Skin.php

index 5c05ad7..85610b9 100644 (file)
@@ -2388,7 +2388,14 @@ class OutputPage extends ContextSource {
                // jQuery etc. can work correctly.
                $response->header( 'X-UA-Compatible: IE=Edge' );
 
-               $this->addLogoPreloadLinkHeaders();
+               if ( !$this->mArticleBodyOnly ) {
+                       $sk = $this->getSkin();
+
+                       if ( $sk->shouldPreloadLogo() ) {
+                               $this->addLogoPreloadLinkHeaders();
+                       }
+               }
+
                $linkHeader = $this->getLinkHeader();
                if ( $linkHeader ) {
                        $response->header( $linkHeader );
index 99658f2..7f00767 100644 (file)
@@ -444,6 +444,15 @@ abstract class Skin extends ContextSource {
                return $wgLogo;
        }
 
+       /**
+        * Whether the logo should be preloaded with an HTTP link header or not
+        * @since 1.29
+        * @return bool
+        */
+       public function shouldPreloadLogo() {
+               return false;
+       }
+
        /**
         * @return string HTML
         */