Bug 1842798 - Part 3: Complete dynamic imports asynchronously with a microtask r=smaug

According to the spec this should happen as the result of resolving a promise
(see ContinueDynamicImport). If this happens synchronously it's possible for
the importing module to still be in the evaluating state when trying to
instantiate and evaluate the dynamically imported module which breaks the
module loader invariants.

Differential Revision: https://phabricator.services.mozilla.com/D183876
This commit is contained in:
Jon Coppeard
2023-08-03 08:15:29 +00:00
parent 1e096c450d
commit 5be6a6eed0
2 changed files with 45 additions and 4 deletions

View File

@@ -388,6 +388,8 @@ class ModuleLoaderBase : public nsISupports {
void StartFetchingModuleAndDependencies(ModuleLoadRequest* aParent,
nsIURI* aURI);
void InstantiateAndEvaluateDynamicImport(ModuleLoadRequest* aRequest);
/**
* Shorthand Wrapper for JSAPI FinishDynamicImport function for the reject
* case where we do not have `aEvaluationPromise`. As there is no evaluation