resourceloader: Jobs created in request() should wait for executing modules
Fix a regression from 6e903b94f2. It failed to update this code to account for
the new "executing" state.
This code was sometimes causing the job dependencies to be an empty array
when the module in question is currently being executed. As such the job
wasn't blocked by anything and happily run the next time a random module
invoked handlePending to run any jobs that have been satisfied.
- in-page RLQ: Page loads a module X that contains scripts and styles.
- Module X is found in storage and implemented.
- execute() adds styles to css buffer (which is asynchronous). It provides a callback from which it would run the module's script, set to "ready", and trigger handlePending().
- in-page RLQ: The edit page uses 'mw.loader.using' to require module X and has a callback that uses the module.
- using() sees X is not already "ready", so it calls request() for X.
- request() creates a job for "X". It then wrongly filters out X from the list of modules to wait for. The filter is intended to remove modules that are complete (e.g. "ready", "error", or "missing"). After 6e903b94f2, it also removed anything with state "executing". This resulted in a job with an empty dependency list (nothing to wait for).
- The callstack is finished. At some point the css buffer will call back. Some other module requested before X enters state "ready" and triggers handlePending(). It finds an left-over empty job with no dependencies and runs it. "It" being the callback of X – eventhough X isn't ready.
The added test fails without the change in mediawiki.js.