Bug 1803810 - Part 4: Add mozJSModuleLoader for non-shared global. r=jonco

On the main thread, single mozJSModuleLoader instance is shared across all
loads in non-shared global, with resetting the internal state after importing
a module graph.

NonSharedGlobalSyncModuleLoaderScope manages the lifetime of each usage.
Import into the same non-shared global can be nested, but import into the
different non-shared gloobal is not allowed while other import for non-shared
global is ongoing.

Differential Revision: https://phabricator.services.mozilla.com/D199456
This commit is contained in:
Tooru Fujisawa
2024-02-13 14:34:22 +00:00
parent b51d74f7cd
commit 42d300d169
4 changed files with 165 additions and 4 deletions

View File

@@ -282,6 +282,8 @@ class ModuleLoaderBase : public nsISupports {
nsIGlobalObject* GetGlobalObject() const { return mGlobalObject; }
bool HasFetchingModules() const;
bool HasPendingDynamicImports() const;
void CancelDynamicImport(ModuleLoadRequest* aRequest, nsresult aResult);
#ifdef DEBUG