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