From: jenkins-bot Date: Sat, 6 Jul 2019 01:00:54 +0000 (+0000) Subject: Merge "OutputPage: Load html5shiv without indirection of load.php" X-Git-Tag: 1.34.0-rc.0~1148 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_add%27%29%20%7D%7D?a=commitdiff_plain;h=a0307e8fa07f11f886bd1c4bc08a51ba031afa70;hp=f11a8b91d8c9af19b35e89da7d8bd8d7bd8a637c;p=lhc%2Fweb%2Fwiklou.git Merge "OutputPage: Load html5shiv without indirection of load.php" --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 58b025a655..e78cd7bd12 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -3012,6 +3012,7 @@ class OutputPage extends ContextSource { * @return string The doctype, opening "", and head element. */ public function headElement( Skin $sk, $includeStyle = true ) { + $config = $this->getConfig(); $userdir = $this->getLanguage()->getDir(); $sitedir = MediaWikiServices::getInstance()->getContentLanguage()->getDir(); @@ -3026,7 +3027,7 @@ class OutputPage extends ContextSource { $this->setHTMLTitle( $this->msg( 'pagetitle', $this->getPageTitle() )->inContentLanguage() ); } - if ( !Html::isXmlMimeType( $this->getConfig()->get( 'MimeType' ) ) ) { + if ( !Html::isXmlMimeType( $config->get( 'MimeType' ) ) ) { // Add // This should be before since it defines the charset used by // text including the text inside <title>. @@ -3044,18 +3045,15 @@ class OutputPage extends ContextSource { $pieces = array_merge( $pieces, array_values( $this->getHeadLinksArray() ) ); $pieces = array_merge( $pieces, array_values( $this->mHeadItems ) ); + // This library is intended to run on older browsers that MediaWiki no longer + // supports as Grade A. For these Grade C browsers, we provide an experience + // using only HTML and CSS. Where standards-compliant browsers are able to style + // unknown HTML elements without issue, old IE ignores these styles. + // The html5shiv library fixes that. // Use an IE conditional comment to serve the script only to old IE + $shivUrl = $config->get( 'ResourceBasePath' ) . '/resources/lib/html5shiv/html5shiv.js'; $pieces[] = '<!--[if lt IE 9]>' . - ResourceLoaderClientHtml::makeLoad( - new ResourceLoaderContext( - $this->getResourceLoader(), - new FauxRequest( [] ) - ), - [ 'html5shiv' ], - ResourceLoaderModule::TYPE_SCRIPTS, - [ 'raw' => '1', 'sync' => '1' ], - $this->getCSPNonce() - ) . + Html::linkedScript( $shivUrl, $this->getCSPNonce() ) . '<![endif]-->'; $pieces[] = Html::closeElement( 'head' ); diff --git a/resources/Resources.php b/resources/Resources.php index 39eb0e8184..c24e3eb29c 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -2820,14 +2820,7 @@ return [ ], ], - /** - * html5shiv - * - * This library is intended to run on older browsers - * that MediaWiki no longer supports as Grade A, and - * is not loaded through the normal module loading - * system. - */ + // @todo FIXME: Remove 7 days after Ib0020b6bd0156 is deployed to all wikis. 'html5shiv' => [ 'scripts' => [ 'resources/lib/html5shiv/html5shiv.js'