r72359 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72358‎ | r72359 | r72360 >
Date:08:38, 4 September 2010
Author:tparscal
Status:ok
Tags:
Comment:
Fix a bug in the resource loader causing it to return no Content-Type header for 304s. Firefox doesn't care but Chrome seems to, so we always set the right Content-Type
Modified paths:
  • /trunk/phase3/includes/ResourceLoader.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ResourceLoader.php
@@ -254,6 +254,13 @@
255255 $maxage = min( $maxage, self::$modules[$name]->getClientMaxage() );
256256 $smaxage = min( $smaxage, self::$modules[$name]->getServerMaxage() );
257257 }
 258+
 259+ // Output headers
 260+ if ( $context->getOnly() === 'styles' ) {
 261+ header( 'Content-Type: text/css' );
 262+ } else {
 263+ header( 'Content-Type: text/javascript' );
 264+ }
258265 header( 'Last-Modified: ' . wfTimestamp( TS_RFC2822, $mtime ) );
259266 $expires = wfTimestamp( TS_RFC2822, min( $maxage, $smaxage ) + time() );
260267 header( "Cache-Control: public, maxage=$maxage, s-maxage=$smaxage" );
@@ -322,10 +329,7 @@
323330 }
324331 }
325332 // Output the appropriate header
326 - if ( $context->getOnly() === 'styles' ) {
327 - header( 'Content-Type: text/css' );
328 - } else {
329 - header( 'Content-Type: text/javascript' );
 333+ if ( $context->getOnly() !== 'styles' ) {
330334 if ( $context->getDebug() ) {
331335 ob_end_flush();
332336 } else {

Status & tagging log