Bug 1761938 - Part 1: Call into the module loader via the module load request object r=yulia

The script loader will need to deal with requests from more than one module
loader so this adds methods to the request which dispatch to the correct
loader.

Differential Revision: https://phabricator.services.mozilla.com/D142828
This commit is contained in:
Jon Coppeard
2022-04-11 15:35:28 +00:00
parent c146088a27
commit 94bff9357d
5 changed files with 75 additions and 33 deletions

View File

@@ -142,10 +142,12 @@ class ModuleLoaderBase : public nsISupports {
// Public API methods.
public:
ScriptLoaderInterface* GetScriptLoaderInterface() const { return mLoader; }
bool HasPendingDynamicImports() const;
void CancelDynamicImport(ModuleLoadRequest* aRequest, nsresult aResult);
#ifdef DEBUG
bool HasDynamicImport(ModuleLoadRequest* aRequest) const;
bool HasDynamicImport(const ModuleLoadRequest* aRequest) const;
#endif
// Start a load for a module script URI. Returns immediately if the module is
@@ -161,7 +163,7 @@ class ModuleLoaderBase : public nsISupports {
// Implements https://html.spec.whatwg.org/#run-a-module-script
nsresult EvaluateModule(nsIGlobalObject* aGlobalObject,
ScriptLoadRequest* aRequest);
ModuleLoadRequest* aRequest);
void StartDynamicImport(ModuleLoadRequest* aRequest);
void ProcessDynamicImport(ModuleLoadRequest* aRequest);
@@ -215,7 +217,7 @@ class ModuleLoaderBase : public nsISupports {
ModuleScript* GetFetchedModule(nsIURI* aURL, nsIGlobalObject* aGlobal) const;
// Helper function to set up the global correctly for dynamic imports.
nsresult EvaluateModule(ScriptLoadRequest* aRequest);
nsresult EvaluateModule(ModuleLoadRequest* aRequest);
JS::Value FindFirstParseError(ModuleLoadRequest* aRequest);
static nsresult InitDebuggerDataForModuleTree(JSContext* aCx,