Bug 1761938 - Part 4: Give module loaders a global object field r=smaug,yulia
This gives the module loader a field for the current global, since a module map is only associated with a single global. This adds a method to Document to tell the script loader when its global changes. I'm not sure of when we do this exactly. Differential Revision: https://phabricator.services.mozilla.com/D142831
This commit is contained in:
@@ -92,6 +92,8 @@ class ModuleLoaderBase : public nsISupports {
|
||||
// List of dynamic imports that are currently being loaded.
|
||||
ScriptLoadRequestList mDynamicImportRequests;
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> mGlobalObject;
|
||||
|
||||
protected:
|
||||
RefPtr<ScriptLoaderInterface> mLoader;
|
||||
|
||||
@@ -100,7 +102,8 @@ class ModuleLoaderBase : public nsISupports {
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(ModuleLoaderBase)
|
||||
explicit ModuleLoaderBase(ScriptLoaderInterface* aLoader);
|
||||
explicit ModuleLoaderBase(ScriptLoaderInterface* aLoader,
|
||||
nsIGlobalObject* aGlobalObject);
|
||||
|
||||
using LoadedScript = JS::loader::LoadedScript;
|
||||
using ScriptFetchOptions = JS::loader::ScriptFetchOptions;
|
||||
@@ -143,6 +146,8 @@ class ModuleLoaderBase : public nsISupports {
|
||||
public:
|
||||
ScriptLoaderInterface* GetScriptLoaderInterface() const { return mLoader; }
|
||||
|
||||
nsIGlobalObject* GetGlobalObject() const { return mGlobalObject; }
|
||||
|
||||
bool HasPendingDynamicImports() const;
|
||||
void CancelDynamicImport(ModuleLoadRequest* aRequest, nsresult aResult);
|
||||
#ifdef DEBUG
|
||||
|
||||
Reference in New Issue
Block a user