Fixes bug 34036 - [regression] mw.loader.load doesn't works as importScriptURI for...
authorMark A. Hershberger <mah@users.mediawiki.org>
Mon, 30 Jan 2012 23:07:08 +0000 (23:07 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Mon, 30 Jan 2012 23:07:08 +0000 (23:07 +0000)
Patch from Helder.wiki

resources/mediawiki/mediawiki.js

index 585483b..0dce50e 100644 (file)
@@ -1137,7 +1137,7 @@ var mw = ( function ( $, undefined ) {
                                 *  "text/javascript"; if no type is provided, text/javascript is assumed.
                                 */
                                load: function ( modules, type ) {
-                                       var filtered, m;
+                                       var filtered, m, reValidURL;
 
                                        // Validate input
                                        if ( typeof modules !== 'object' && typeof modules !== 'string' ) {
@@ -1146,7 +1146,8 @@ var mw = ( function ( $, undefined ) {
                                        // Allow calling with an external url or single dependency as a string
                                        if ( typeof modules === 'string' ) {
                                                // Support adding arbitrary external scripts
-                                               if ( /^(https?:)?\/\//.test( modules ) ) {
+                                               reValidURL = new RegExp( '^((https?:)?\\/\\/|' + $.escapeRE( mw.config.get( 'wgScript' ) ) + ')' );
+                                               if ( reValidURL.test( modules ) ) {
                                                        if ( type === 'text/css' ) {
                                                                $( 'head' ).append( $( '<link>', {
                                                                        rel: 'stylesheet',