mw.loader: Prevent useless jobs from being added to queue
authorMatthew Flaschen <mflaschen@wikimedia.org>
Sat, 2 Mar 2013 05:03:19 +0000 (00:03 -0500)
committerKrinkle <ttijhof@wikimedia.org>
Sat, 2 Mar 2013 19:15:26 +0000 (19:15 +0000)
* load was calling request with ready and error being null.
* request was doing a strict check against undefined to prevent adding
  jobs with no callbacks to the queue.
* Since these were null rather than undefined, the empty jobs got added
  anyway.  Now using undefined instead.
* Mark ready and error as optional in the request JS documentation.

Change-Id: I6428e733899f7c484f842f6fe142c8d4d49ee443

resources/mediawiki/mediawiki.js

index b5b42e1..1212fd4 100644 (file)
@@ -970,8 +970,8 @@ var mw = ( function ( $, undefined ) {
                         *
                         * @private
                         * @param {string|string[]} dependencies Module name or array of string module names
-                        * @param {Function} ready Callback to execute when all dependencies are ready
-                        * @param {Function} error Callback to execute when any dependency fails
+                        * @param {Function} [ready] Callback to execute when all dependencies are ready
+                        * @param {Function} [error] Callback to execute when any dependency fails
                         * @param {boolean} [async] If true, load modules asynchronously even if
                         *  document ready has not yet occurred.
                         */
@@ -1447,7 +1447,7 @@ var mw = ( function ( $, undefined ) {
                                                return;
                                        }
                                        // Since some modules are not yet ready, queue up a request.
-                                       request( filtered, null, null, async );
+                                       request( filtered, undefined, undefined, async );
                                },
 
                                /**