Merge "Document the 'sitewide' option for the Block class"
[lhc/web/wiklou.git] / includes / OutputPage.php
index 9b766bb..0695443 100644 (file)
@@ -953,6 +953,8 @@ class OutputPage extends ContextSource {
         * good tags like \<i\> will be dropped entirely.
         *
         * @param string|Message $name
+        * @param-taint $name tainted
+        * Phan-taint-check gets very confused by $name being either a string or a Message
         */
        public function setPageTitle( $name ) {
                if ( $name instanceof Message ) {
@@ -966,7 +968,7 @@ class OutputPage extends ContextSource {
 
                # change "<i>foo&amp;bar</i>" to "foo&bar"
                $this->setHTMLTitle(
-                       $this->msg( 'pagetitle' )->rawParams( Sanitizer::stripAllTags( $nameWithTags ) )
+                       $this->msg( 'pagetitle' )->plaintextParams( Sanitizer::stripAllTags( $nameWithTags ) )
                                ->inContentLanguage()
                );
        }
@@ -2522,6 +2524,18 @@ class OutputPage extends ContextSource {
                return false;
        }
 
+       /**
+        * Get the Origin-Trial header values. This is used to enable Chrome Origin
+        * Trials: https://github.com/GoogleChrome/OriginTrials
+        *
+        * @return array
+        */
+       private function getOriginTrials() {
+               $config = $this->getConfig();
+
+               return $config->get( 'OriginTrials' );
+       }
+
        /**
         * Send cache control HTTP headers
         */
@@ -2688,6 +2702,11 @@ class OutputPage extends ContextSource {
                        $response->header( "X-Frame-Options: $frameOptions" );
                }
 
+               $originTrials = $this->getOriginTrials();
+               foreach ( $originTrials as $originTrial ) {
+                       $response->header( "Origin-Trial: $originTrial", false );
+               }
+
                ContentSecurityPolicy::sendHeaders( $this );
 
                if ( $this->mArticleBodyOnly ) {