Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/184708

Change subject: Don't rely on 'user' and 'site' modules working correctly
......................................................................

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

I think somebody somewhere pointed to this as the reason why VE
wouldn't load when user's common.js has syntax errors, but I actually
can't reproduce that. Not sure if this is needed, but looks like a
good idea anyway.

(One more, with feeling. Reverted broken attempt: I3abecacf.)

Change-Id: I252c5c20f75b3bbea51200560408dc4cfc7174f6
---
M modules/ve-mw/init/ve.init.mw.Target.js
1 file changed, 11 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/08/184708/1

diff --git a/modules/ve-mw/init/ve.init.mw.Target.js 
b/modules/ve-mw/init/ve.init.mw.Target.js
index 2c2b6f4..68c0cb0 100644
--- a/modules/ve-mw/init/ve.init.mw.Target.js
+++ b/modules/ve-mw/init/ve.init.mw.Target.js
@@ -991,7 +991,7 @@
  * @returns {boolean} Loading has been started
 */
 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
        if ( this.loading ) {
@@ -999,11 +999,16 @@
        }
        this.events.timings.activationStart = ve.now();
        // Start loading the module immediately
-       mw.loader.using(
-               // Wait for site and user JS before running plugins
-               this.modules.concat( additionalModules || [] ),
-               ve.init.mw.Target.onModulesReady.bind( this )
-       );
+       modulesPromise = mw.loader.using( this.modules );
+       additionalModulesPromise = mw.loader.using( additionalModules || [] );
+
+       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 = {
                action: 'visualeditor',

-- 
To view, visit https://gerrit.wikimedia.org/r/184708
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I252c5c20f75b3bbea51200560408dc4cfc7174f6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to