Krinkle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/64638


Change subject: Deprecate $wgJsMimeType
......................................................................

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
---
M RELEASE-NOTES-1.22
M includes/DefaultSettings.php
M includes/Setup.php
M includes/actions/RawAction.php
4 files changed, 15 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/38/64638/1

diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index cd7971b..a0e962c 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -24,6 +24,8 @@
 * $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 819e9a3..9221784 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -2518,11 +2518,13 @@
 $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 acbc3b6..c1d2efb 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -344,12 +344,11 @@
        $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 = true;
 
 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 3fa20b7..dd14311 100644
--- a/includes/actions/RawAction.php
+++ b/includes/actions/RawAction.php
@@ -48,7 +48,7 @@
        }
 
        function onView() {
-               global $wgSquidMaxage, $wgForcedRawSMaxage, $wgJsMimeType;
+               global $wgSquidMaxage, $wgForcedRawSMaxage;
 
                $this->getOutput()->disable();
                $request = $this->getRequest();
@@ -79,7 +79,7 @@
 
                # 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 @@
         * @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';
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/64638
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib04ff5b21eb0ae172b94e31bc0dc16c9649e1864
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to