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:
Jon Coppeard
2022-04-11 15:35:29 +00:00
parent 9847491365
commit 95257109ee
8 changed files with 60 additions and 14 deletions

View File

@@ -48,8 +48,9 @@ namespace mozilla::dom {
// DOM module loader
//////////////////////////////////////////////////////////////
ModuleLoader::ModuleLoader(ScriptLoader* aLoader, Kind aKind)
: ModuleLoaderBase(aLoader), mKind(aKind) {}
ModuleLoader::ModuleLoader(ScriptLoader* aLoader,
nsIGlobalObject* aGlobalObject, Kind aKind)
: ModuleLoaderBase(aLoader, aGlobalObject), mKind(aKind) {}
ScriptLoader* ModuleLoader::GetScriptLoader() {
return static_cast<ScriptLoader*>(mLoader.get());