Merge "Don't rely on 'user' and 'site' modules working correctly"

This commit is contained in:
jenkins-bot 2015-01-26 22:31:28 +00:00 committed by Gerrit Code Review
commit 7dee4f18d7

View file

@ -992,7 +992,7 @@ ve.init.mw.Target.prototype.getHtml = function ( newDoc ) {
* @returns {boolean} Loading has been started * @returns {boolean} Loading has been started
*/ */
ve.init.mw.Target.prototype.load = function ( additionalModules ) { ve.init.mw.Target.prototype.load = function ( additionalModules ) {
var data, start, xhr, target = this; var data, start, xhr, modulesPromise, additionalModulesPromise, target = this;
// Prevent duplicate requests // Prevent duplicate requests
if ( this.loading ) { if ( this.loading ) {
@ -1000,11 +1000,16 @@ ve.init.mw.Target.prototype.load = function ( additionalModules ) {
} }
this.events.timings.activationStart = ve.now(); this.events.timings.activationStart = ve.now();
// Start loading the module immediately // Start loading the module immediately
mw.loader.using( modulesPromise = mw.loader.using( this.modules );
// Wait for site and user JS before running plugins additionalModulesPromise = mw.loader.using( additionalModules || [] );
this.modules.concat( additionalModules || [] ),
ve.init.mw.Target.onModulesReady.bind( this ) modulesPromise.done( function () {
); // Wait for site and user JS before running plugins.
// These modules could fail to load, proceed even if they do.
additionalModulesPromise.always( function () {
ve.init.mw.Target.onModulesReady.call( target );
} );
} );
data = { data = {
action: 'visualeditor', action: 'visualeditor',