Closed Bug 1477090 Opened 6 years ago Closed 6 years ago

ES6 modules making synchronous XHRs prevents other modules from loading

Categories

(Core :: JavaScript Engine, defect)

62 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: johnplaisted, Assigned: jonco)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Attached file example.zip (deleted) —
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36 Steps to reproduce: Append script tags in JS for an ES6 module that imports another ES6 module that makes a synchronous XHR. Actual results: The second module (doing the importing) will never load. Note: if you make a synchronous XHR in a script before any modules load and then do the above then the second module will SOMETIMES load and sometimes it won't. Expected results: The second module should always load.
Assignee: nobody → jcoppeard
Attached patch bug1477090-module-sync-xhr (deleted) — Splinter Review
The problem here is that we are attempting to instantiate a module while a synchronous XHR is running. This re-enters the JS engine and the module graph is found to be in an invalid state. The patch moves module instantiation to just before module execution where it is restricted by the script loader's existing checks on whether it is safe to run scripts. I verified that this fixed the test case supplied.
Attachment #8996365 - Flags: review?(amarchesini)
Attachment #8996365 - Flags: review?(amarchesini) → review+
Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/de7bc7bd4a16 Only instantiate modules when it's safe to run script r=baku
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: