Because the user and site modules simply have mw.loader.state( 'modulename', 'ready' ); injected at the end, a JS error in user-authored code causes that statement to never be reached, and the module state to remain set to 'loading' indefinitely. There is no code setting it to 'error' anywhere. Consequently, the promise returned by mw.loader.using( 'user' ) is never rejected, it can only be resolved (in the no-error case) or remain pending forever (in the error case).
Description
Details
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | Krinkle | T106736 "Site" and "user" module (legacy only=scripts requests) stay pending indefinitely if script causes error | |||
Resolved | Krinkle | T32358 Support loading legacy "site" and "user" modules with mw.loader |
Event Timeline
Change 221739 had a related patch set uploaded (by Krinkle):
resourceloader: Implement support for 'site' into mw.loader
https://gerrit.wikimedia.org/r/221739
Change 221739 merged by jenkins-bot:
resourceloader: Implement support for 'site' into mw.loader
https://gerrit.wikimedia.org/r/221739
Change 227912 had a related patch set uploaded (by Krinkle):
[WIP] resourceloader: Ensure 'user' loads after 'site' (asynchronously)
https://gerrit.wikimedia.org/r/227912
Change 227912 merged by jenkins-bot:
resourceloader: Ensure 'user' loads after 'site' (asynchronously)
https://gerrit.wikimedia.org/r/227912
This now works as expected (per T107399). When site or user module throws an exception at run-time, these are caught (without affecting the call stack) and state becomes "error". VE loads correctly thanks to its use of .always() and ResourceLoader's promise now actually being fulfilled.
Exception in module-execute in module user:
(X) My error
mw.loader.getState('user')
"error"