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-02 14:39:33 +00:00
parent f8f59b4727
commit f1d1fc89a2
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