From 950cf2cb864c7c41618f4a769ba4da200f88f08c Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 9 May 2011 13:10:06 +0000 Subject: [PATCH] (bug 28840) Commit patch by bawolff that encodes dots in ResourceLoader module names as exclamation marks in the generated URLs, so as to avoid triggering the recently added IE security measure and causing a blank 403 response. This broke RL in various ways for IE users. This is by no means intended to be permanent, but it's the best way to unbreak RL for IE users while we work out how to fix this properly. --- includes/resourceloader/ResourceLoader.php | 6 ++++-- includes/resourceloader/ResourceLoaderContext.php | 3 ++- resources/mediawiki/mediawiki.js | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 3afe69cb68..7e8d09942f 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -708,7 +708,8 @@ class ResourceLoader { * Convert an array of module names to a packed query string. * * For example, array( 'foo.bar', 'foo.baz', 'bar.baz', 'bar.quux' ) - * becomes 'foo.bar,baz|bar.baz,quux' + * becomes 'foo!bar,baz|bar!baz,quux' + * The ! is for IE6 being stupid with extensions. * @param $modules array of module names (strings) * @return string Packed query string */ @@ -726,7 +727,8 @@ class ResourceLoader { $p = $prefix === '' ? '' : $prefix . '.'; $arr[] = $p . implode( ',', $suffixes ); } - return implode( '|', $arr ); + $str = implode( '|', $arr ); + return str_replace( ".", "!", $str ); # bug 28840 } /** diff --git a/includes/resourceloader/ResourceLoaderContext.php b/includes/resourceloader/ResourceLoaderContext.php index 5600304518..581f971a32 100644 --- a/includes/resourceloader/ResourceLoaderContext.php +++ b/includes/resourceloader/ResourceLoaderContext.php @@ -67,12 +67,13 @@ class ResourceLoaderContext { /** * Expand a string of the form jquery.foo,bar|jquery.ui.baz,quux to * an array of module names like array( 'jquery.foo', 'jquery.bar', - * 'jquery.ui.baz', 'jquery.ui.quux' ) + * 'jquery.ui.baz', 'jquery.ui.quux' ) Also translating ! to . * @param $modules String Packed module name list * @return array of module names */ public static function expandModuleNames( $modules ) { $retval = array(); + $modules = str_replace( "!", ".", $modules ); # bug 28840 - IE is stupid. $exploded = explode( '|', $modules ); foreach ( $exploded as $group ) { if ( strpos( $group, ',' ) === false ) { diff --git a/resources/mediawiki/mediawiki.js b/resources/mediawiki/mediawiki.js index aa202cc7cb..3ac2c24f6f 100644 --- a/resources/mediawiki/mediawiki.js +++ b/resources/mediawiki/mediawiki.js @@ -874,7 +874,7 @@ window.mediaWiki = new ( function( $ ) { var p = prefix === '' ? '' : prefix + '.'; arr.push( p + moduleMap[prefix].join( ',' ) ); } - return arr.join( '|' ); + return arr.join( '|' ).replace( /\./g, '!' ); } -- 2.20.1