resourceloader: Move batch fetch logic out of mw.loader.work()
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 9 Aug 2016 01:16:41 +0000 (18:16 -0700)
committerOri.livneh <ori@wikimedia.org>
Tue, 23 Aug 2016 03:22:40 +0000 (03:22 +0000)
commit488c5d9ef0bd8f345fc6b94a817545c1675f0ef4
tree19448207045cfe8f3261118bf1cdcc75dd93dfe8
parent48503ee7d9c0f8dde6a68dba5176f4138c59dd0b
resourceloader: Move batch fetch logic out of mw.loader.work()

Changes:

* Move batch fetch logic out of work() into a new private method
  called batchRequest().

* Avoid confusion between request as 'network fetch' and request as
  'need a module'. Renamed 'request()' to 'enqueue()' to avoid
  confusion with doRequest.
  Changed most other instances of 'request' to 'require', 'need', or
  more specific request details such as 'url' and  'query string'.

* Keep comment about important of clearing the queue in work()
  and move it to be about 'queue' instead of 'batch'.
  Variable 'batch' is now local to work() and no longer shared
  through scope. I don't know why this wasn't local before.

* Remove bad early return in work() when batch is empty. This was before
  the clearing of the queue. This could cause cached modules to remain in
  the queue for the next time work() is called.

This commit is in preparation for T142129, which will make the cache-eval
logic asynchronous in mw.loader.work().

Change-Id: I91e50232637e01822b03d77d1add3a2275e18027
resources/src/mediawiki/mediawiki.js