summaryrefslogtreecommitdiffstats
path: root/dom/script
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-09-08 11:00:27 +0000
committerMoonchild <moonchild@palemoon.org>2020-09-08 11:05:05 +0000
commitd49fb8a6919dfa446951bf83e14939ff2fc95db1 (patch)
treee14a97c8d906bdebbab7b6cf3a7ee057ebdbed9a /dom/script
parent71b988d1b43333431c4a087671c35486ac7ad586 (diff)
downloadUXP-d49fb8a6919dfa446951bf83e14939ff2fc95db1.tar
UXP-d49fb8a6919dfa446951bf83e14939ff2fc95db1.tar.gz
UXP-d49fb8a6919dfa446951bf83e14939ff2fc95db1.tar.lz
UXP-d49fb8a6919dfa446951bf83e14939ff2fc95db1.tar.xz
UXP-d49fb8a6919dfa446951bf83e14939ff2fc95db1.zip
Issue #618 - Clear the module map when changing a Document's global and add
release build assertions for mismatching compartments.
Diffstat (limited to 'dom/script')
-rw-r--r--dom/script/ScriptLoader.cpp5
-rw-r--r--dom/script/ScriptLoader.h6
2 files changed, 11 insertions, 0 deletions
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();