From: Timo Tijhof Date: Mon, 20 May 2013 22:43:49 +0000 (+0200) Subject: Deprecate $wgJsMimeType X-Git-Tag: 1.31.0-rc.0~19619 X-Git-Url: http://git.cyclocoop.org/%22%20.%20%20%20%24self2%20.%20%20%20%22&var_mode_affiche=boucle?a=commitdiff_plain;h=1f956360b804980b3195b526a340ba69ee26c941;p=lhc%2Fweb%2Fwiklou.git Deprecate $wgJsMimeType It hasn't been used for its documented purpose for a while. In fact the one significant thing it can cause wasn't even documented. If set to anything other than "text/javascript" it will cause action=raw to no longer respond to ctype=text/javascript requests (such as done by wikibits' importScript function). Follows-up 97caae596d5493. Change-Id: Ib04ff5b21eb0ae172b94e31bc0dc16c9649e1864 --- diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index cd7971b0d2..a0e962ca1a 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -24,6 +24,8 @@ production. * $wgXhtmlDefaultNamespace is no longer used by core. Setting it will no longer change the xmlns used by MediaWiki. Reliance on this variable by extensions is deprecated. * $wgHandheldStyle was removed. +* $wgJsMimeType is no longer used by core. Most usage has been removed since + HTML output is now exclusively HTML5. === New features in 1.22 === * (bug 44525) mediawiki.jqueryMsg can now parse (whitelisted) HTML elements and attributes. diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 819e9a3e52..9221784939 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2518,11 +2518,13 @@ $wgLocalTZoffset = null; $wgMimeType = 'text/html'; /** - * The content type used in script tags. This is mostly going to be ignored at - * least for actual HTML output, since HTML5 doesn't require a MIME type for - * JavaScript or CSS (those are the default script and style languages). + * Previously used as content type in HTML script tags. This is now ignored since + * HTML5 doesn't require a MIME type for script tags (javascript is the default). + * It was also previously used by RawAction to determine the ctype query parameter + * value that will result in a javascript response. + * @deprecated since 1.22 */ -$wgJsMimeType = 'text/javascript'; +$wgJsMimeType = null; /** * The default xmlns attribute. The option to define this has been removed. diff --git a/includes/Setup.php b/includes/Setup.php index acbc3b61f7..196f0ad31c 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -344,12 +344,11 @@ foreach ( $wgDisabledActions as $action ) { $wgActions[$action] = false; } -# We always output html5 since 1.22, override any change made by local settings +# We always output HTML5 since 1.22, overriding these is no longer supported +# we set them here for extensions that depend on its value. $wgHtml5 = true; - -# Setting wgXhtmlDefaultNamespace is not supported since 1.22. -# However we define it here for extensions that depend on its value. $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml'; +$wgJsMimeType = 'text/javascript'; if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) { # see http://www.w3.org/TR/rdfa-in-html/#document-conformance diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php index 3fa20b70e5..dd14311974 100644 --- a/includes/actions/RawAction.php +++ b/includes/actions/RawAction.php @@ -48,7 +48,7 @@ class RawAction extends FormlessAction { } function onView() { - global $wgSquidMaxage, $wgForcedRawSMaxage, $wgJsMimeType; + global $wgSquidMaxage, $wgForcedRawSMaxage; $this->getOutput()->disable(); $request = $this->getRequest(); @@ -79,7 +79,7 @@ class RawAction extends FormlessAction { # Force caching for CSS and JS raw content, default: 5 minutes if ( $smaxage === null ) { - if ( $contentType == 'text/css' || $contentType == $wgJsMimeType ) { + if ( $contentType == 'text/css' || $contentType == 'text/javascript' ) { $smaxage = intval( $wgForcedRawSMaxage ); } else { $smaxage = 0; @@ -221,20 +221,18 @@ class RawAction extends FormlessAction { * @return String */ public function getContentType() { - global $wgJsMimeType; - $ctype = $this->getRequest()->getVal( 'ctype' ); if ( $ctype == '' ) { $gen = $this->getRequest()->getVal( 'gen' ); if ( $gen == 'js' ) { - $ctype = $wgJsMimeType; + $ctype = 'text/javascript'; } elseif ( $gen == 'css' ) { $ctype = 'text/css'; } } - $allowedCTypes = array( 'text/x-wiki', $wgJsMimeType, 'text/css', 'application/x-zope-edit' ); + $allowedCTypes = array( 'text/x-wiki', 'text/javascript', 'text/css', 'application/x-zope-edit' ); if ( $ctype == '' || !in_array( $ctype, $allowedCTypes ) ) { $ctype = 'text/x-wiki'; }