Deprecate $wgJsMimeType
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 20 May 2013 22:43:49 +0000 (00:43 +0200)
committerTimo Tijhof <krinklemail@gmail.com>
Mon, 20 May 2013 23:17:44 +0000 (01:17 +0200)
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

RELEASE-NOTES-1.22
includes/DefaultSettings.php
includes/Setup.php
includes/actions/RawAction.php

index cd7971b..a0e962c 100644 (file)
@@ -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.
index 819e9a3..9221784 100644 (file)
@@ -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.
index acbc3b6..196f0ad 100644 (file)
@@ -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
index 3fa20b7..dd14311 100644 (file)
@@ -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';
                }