* (bug 31374) Pass relevant additional parameters for action=raw on Special:Mypage...
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 6 Oct 2011 01:10:39 +0000 (01:10 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 6 Oct 2011 01:10:39 +0000 (01:10 +0000)
Found that Special:MyPage was sometimes being used in importScript() calls to make references to the owner's other user subpages, such as loading a User:Blah/monobook.js from User:Blah/vector.js.
The importScript() correctly included action=raw and ctype=text/javascript parameters, but Special:MyPage was redirecting to the actual URL and dropped the ctype parameter.

IE 9 actually now validates content-type for scripts loaded into <script> -- if and only if you send X-Content-Type-Options: nosniff. Since we now do that (since bug 15461 / r87997) this created a break for IE9 users when upgrading from MW 1.17 (without the nosniff) to MW 1.18 (with it).

Can also work around by replacing the Special:MyPage reference with a direct one.

No other browsers I tested (Firefox 8, Chrome 14, Opera 11.5) rejected a <script> load for text/x-wiki but it's a legit thing to do (Firefox does check for CSS)

includes/SpecialPage.php

index 77fecd9..5ee1e1c 100644 (file)
@@ -1005,7 +1005,9 @@ class SpecialMypage extends RedirectSpecialPage {
        function __construct() {
                parent::__construct( 'Mypage' );
                $this->mAllowedRedirectParams = array( 'action' , 'preload' , 'editintro',
-                       'section', 'oldid', 'diff', 'dir' );
+                       'section', 'oldid', 'diff', 'dir',
+                       // Options for action=raw; missing ctype can break JS or CSS in some browsers
+                       'ctype', 'maxage', 'smaxage' );
        }
 
        function getRedirect( $subpage ) {