From df55ce90372c71ec9cb186677044aacc96c87187 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Tue, 8 Sep 2020 11:00:27 +0000 Subject: Issue #618 - Clear the module map when changing a Document's global and add release build assertions for mismatching compartments. --- dom/script/ScriptLoader.cpp | 5 +++++ dom/script/ScriptLoader.h | 6 ++++++ 2 files changed, 11 insertions(+) (limited to 'dom/script') diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp index 71838580f..362c27f3e 100644 --- a/dom/script/ScriptLoader.cpp +++ b/dom/script/ScriptLoader.cpp @@ -477,6 +477,11 @@ ScriptLoader::GetFetchedModule(nsIURI* aURL) const return ms; } +void ScriptLoader::ClearModuleMap() { + MOZ_ASSERT(mFetchingModules.IsEmpty()); + mFetchedModules.Clear(); +} + nsresult ScriptLoader::ProcessFetchedModuleSource(ModuleLoadRequest* aRequest) { diff --git a/dom/script/ScriptLoader.h b/dom/script/ScriptLoader.h index 2c5b683e7..73f2a9258 100644 --- a/dom/script/ScriptLoader.h +++ b/dom/script/ScriptLoader.h @@ -506,6 +506,12 @@ public: return mPendingChildLoaders.AppendElement(aChild) != nullptr; } + /* + * Clear the map of loaded modules. Called when a Document object is reused + * for a different global. + */ + void ClearModuleMap(); + private: virtual ~ScriptLoader(); -- cgit v1.2.3