Page MenuHomePhabricator

"Site" and "user" module (legacy only=scripts requests) stay pending indefinitely if script causes error
Closed, ResolvedPublic8 Story Points

Description

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).

Event Timeline

Catrope created this task.Jul 23 2015, 8:04 PM
Catrope raised the priority of this task from to Needs Triage.
Catrope updated the task description. (Show Details)
Catrope added a subscriber: Catrope.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 23 2015, 8:04 PM
Krinkle renamed this task from `mw.loader.using( [ 'user', 'site' ] )` returns promise that never resolves if user or site JS causes error to "Site" and "user" module (legacy only=scripts requests) stay pending indefinitely if script causes error.Jul 29 2015, 2:06 AM
Krinkle set Security to None.

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

Krinkle closed this task as Resolved.EditedJul 31 2015, 6:08 AM
Krinkle claimed this task.
Krinkle added a subscriber: Krinkle.

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"

Krinkle triaged this task as High priority.Jul 31 2015, 6:09 AM
Krinkle edited projects, added MW-1.26-release; removed Patch-For-Review.
Restricted Application added a project: VisualEditor. · View Herald TranscriptJul 31 2015, 6:09 AM