summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dom/script/ScriptLoader.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp
index f669690ce7..d2c5f5bd59 100644
--- a/dom/script/ScriptLoader.cpp
+++ b/dom/script/ScriptLoader.cpp
@@ -812,6 +812,10 @@ HostResolveImportedModule(JSContext* aCx, JS::Handle<JSObject*> aModule,
if (!string.init(aCx, aSpecifier)) {
return nullptr;
}
+ if (!aModule || !aCx) {
+ // Our module context was ripped out from under us...
+ return nullptr;
+ }
nsCOMPtr<nsIURI> uri = ResolveModuleSpecifier(script, string);
@@ -824,6 +828,10 @@ HostResolveImportedModule(JSContext* aCx, JS::Handle<JSObject*> aModule,
ModuleScript* ms = script->Loader()->GetFetchedModule(uri);
MOZ_ASSERT(ms, "Resolved module not found in module map");
+ if (!ms) {
+ // Already-resolved module has been removed from the map/unloaded...
+ return nullptr;
+ }
MOZ_ASSERT(!ms->HasParseError());
MOZ_ASSERT(ms->ModuleRecord());