- implicitDependencies = [];
-
- if ( module === 'user' ) {
- // Implicit dependency on the site module. Not real dependency because
- // it should run after 'site' regardless of whether it succeeds or fails.
- implicitDependencies.push( 'site' );
- }
-
- implicitWait = implicitDependencies.length ?
- mw.loader.using( implicitDependencies ) :
- $.Deferred().resolve();
-
- implicitWait.always( function () {
- try {
- if ( Array.isArray( script ) ) {
- nestedAddScript( script, markModuleReady, 0 );
- } else if ( typeof script === 'function' ) {
- // Pass jQuery twice so that the signature of the closure which wraps
- // the script can bind both '$' and 'jQuery'.
- script( $, $, mw.loader.require, registry[ module ].module );
- markModuleReady();
-
- } else if ( typeof script === 'string' ) {
- // Site and user modules are legacy scripts that run in the global scope.
- // This is transported as a string instead of a function to avoid needing
- // to use string manipulation to undo the function wrapper.
- $.globalEval( script );
- markModuleReady();
+ try {
+ if ( Array.isArray( script ) ) {
+ nestedAddScript( script, markModuleReady, 0 );
+ } else if ( typeof script === 'function' ) {
+ // Pass jQuery twice so that the signature of the closure which wraps
+ // the script can bind both '$' and 'jQuery'.
+ script( $, $, mw.loader.require, registry[ module ].module );
+ markModuleReady();
+
+ } else if ( typeof script === 'string' ) {
+ // Site and user modules are legacy scripts that run in the global scope.
+ // This is transported as a string instead of a function to avoid needing
+ // to use string manipulation to undo the function wrapper.
+ $.globalEval( script );
+ markModuleReady();