mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-22 18:32:00 +00:00

Based on the explanation on the bug, the solution would seem to be to call the ModuleLoaderBase::OnModuleLoadComplete hook from a microtask. This causes a ton of test failures. Instead this patch changes the DOM script loader to implement this hook with a runnable. This fixes the problem (verified manually) and all tests pass. (Replacing the runnable with a microtask just in the DOM script loader also does not work and results in many test failures. I'm still trying to understand why.) The changes to ContinueDynamicImport are removed because they are also on this path and we don't need a microtask as well. This takes us closer to the state before bug 1842798 landed when all the module loader used MozPromise internally and completions like this happened via runnables. I was not able to immediately come up with a test for this. Differential Revision: https://phabricator.services.mozilla.com/D185830