Closed Bug 1477090 Opened 2 years ago Closed 2 years ago
ES6 modules making synchronous XHRs prevents other modules from loading
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
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 email@example.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/de7bc7bd4a16 Only instantiate modules when it's safe to run script r=baku
You need to log in before you can comment on or make changes to this bug.