https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112533

Revision: 112533
Author:   catrope
Date:     2012-02-27 22:33:14 +0000 (Mon, 27 Feb 2012)
Log Message:
-----------
(bug 34542) Calling mw.loader.load('http://someurlhere') sometimes calls 
document.write() from inside an asynchronously loaded script. This is because 
we added the async parameter in 1.19, and made it default to false, which works 
for 1.18 HTML but doesn't work for user/site/Gadget JS written for 1.18 . So 
make the async parameter default to true when a URL is passed and to false 
otherwise. This is kind of evil but it's the only sane way of preserving b/c 
that I can think of

Modified Paths:
--------------
    trunk/phase3/resources/mediawiki/mediawiki.js

Modified: trunk/phase3/resources/mediawiki/mediawiki.js
===================================================================
--- trunk/phase3/resources/mediawiki/mediawiki.js       2012-02-27 22:31:25 UTC 
(rev 112532)
+++ trunk/phase3/resources/mediawiki/mediawiki.js       2012-02-27 22:33:14 UTC 
(rev 112533)
@@ -1206,7 +1206,8 @@
                                 *  "text/javascript"; if no type is provided, 
text/javascript is assumed.
                                 * @param async {Boolean} (optional) If true, 
load modules asynchronously
                                 *  even if document ready has not yet 
occurred. If false (default),
-                                *  block before document ready and load async 
after
+                                *  block before document ready and load async 
after. If not set, true will
+                                *  be assumed if loading a URL, and false will 
be assumed otherwise.
                                 */
                                load: function ( modules, type, async ) {
                                        var filtered, m;
@@ -1219,6 +1220,10 @@
                                        if ( typeof modules === 'string' ) {
                                                // Support adding arbitrary 
external scripts
                                                if ( /^(https?:)?\/\//.test( 
modules ) ) {
+                                                       if ( async === 
undefined ) {
+                                                               // Assume async 
for bug 34542
+                                                               async = true;
+                                                       }
                                                        if ( type === 
'text/css' ) {
                                                                $( 'head' 
).append( $( '<link>', {
                                                                        rel: 
'stylesheet',


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

Reply via email to