r112533 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112532‎ | r112533 | r112534 >
Date:22:33, 27 February 2012
Author:catrope
Status:ok
Tags:
Comment:
(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) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki/mediawiki.js
@@ -1206,7 +1206,8 @@
12071207 * "text/javascript"; if no type is provided, text/javascript is assumed.
12081208 * @param async {Boolean} (optional) If true, load modules asynchronously
12091209 * even if document ready has not yet occurred. If false (default),
1210 - * block before document ready and load async after
 1210+ * block before document ready and load async after. If not set, true will
 1211+ * be assumed if loading a URL, and false will be assumed otherwise.
12111212 */
12121213 load: function ( modules, type, async ) {
12131214 var filtered, m;
@@ -1219,6 +1220,10 @@
12201221 if ( typeof modules === 'string' ) {
12211222 // Support adding arbitrary external scripts
12221223 if ( /^(https?:)?\/\//.test( modules ) ) {
 1224+ if ( async === undefined ) {
 1225+ // Assume async for bug 34542
 1226+ async = true;
 1227+ }
12231228 if ( type === 'text/css' ) {
12241229 $( 'head' ).append( $( '<link>', {
12251230 rel: 'stylesheet',

Follow-up revisions

RevisionCommit summaryAuthorDate
r112564MFT r112563, r112533, r112534aaron02:09, 28 February 2012
r112647MFT r112384, r112400, r112408, r112451, r112456, r112474, r112526, r112533, r...reedy21:21, 28 February 2012

Status & tagging log