mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-18 13:17:29 +09:00
Issue #618 - Clear the module map when changing a Document's global and add
release build assertions for mismatching compartments.
This commit is contained in:
parent
7316d91ba2
commit
ef11a4d7e8
4 changed files with 17 additions and 3 deletions
|
|
@ -1471,6 +1471,9 @@ nsHTMLDocument::Open(JSContext* cx,
|
||||||
// document again otherwise the document could have a non-zero onload block
|
// document again otherwise the document could have a non-zero onload block
|
||||||
// count without the onload blocker request being in the loadgroup.
|
// count without the onload blocker request being in the loadgroup.
|
||||||
EnsureOnloadBlocker();
|
EnsureOnloadBlocker();
|
||||||
|
|
||||||
|
// Throw away loaded modules created for the previous global.
|
||||||
|
ScriptLoader()->ClearModuleMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 8 - Clear all event listeners out of our DOM tree
|
// Step 8 - Clear all event listeners out of our DOM tree
|
||||||
|
|
|
||||||
|
|
@ -477,6 +477,11 @@ ScriptLoader::GetFetchedModule(nsIURI* aURL) const
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptLoader::ClearModuleMap() {
|
||||||
|
MOZ_ASSERT(mFetchingModules.IsEmpty());
|
||||||
|
mFetchedModules.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
ScriptLoader::ProcessFetchedModuleSource(ModuleLoadRequest* aRequest)
|
ScriptLoader::ProcessFetchedModuleSource(ModuleLoadRequest* aRequest)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -506,6 +506,12 @@ public:
|
||||||
return mPendingChildLoaders.AppendElement(aChild) != nullptr;
|
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:
|
private:
|
||||||
virtual ~ScriptLoader();
|
virtual ~ScriptLoader();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4708,7 +4708,7 @@ JS::ModuleInstantiate(JSContext* cx, JS::HandleObject moduleArg)
|
||||||
{
|
{
|
||||||
AssertHeapIsIdle(cx);
|
AssertHeapIsIdle(cx);
|
||||||
CHECK_REQUEST(cx);
|
CHECK_REQUEST(cx);
|
||||||
assertSameCompartment(cx, moduleArg);
|
releaseAssertSameCompartment(cx, moduleArg);
|
||||||
return ModuleObject::Instantiate(cx, moduleArg.as<ModuleObject>());
|
return ModuleObject::Instantiate(cx, moduleArg.as<ModuleObject>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4717,7 +4717,7 @@ JS::ModuleEvaluate(JSContext* cx, JS::HandleObject moduleArg)
|
||||||
{
|
{
|
||||||
AssertHeapIsIdle(cx);
|
AssertHeapIsIdle(cx);
|
||||||
CHECK_REQUEST(cx);
|
CHECK_REQUEST(cx);
|
||||||
assertSameCompartment(cx, moduleArg);
|
releaseAssertSameCompartment(cx, moduleArg);
|
||||||
return ModuleObject::Evaluate(cx, moduleArg.as<ModuleObject>());
|
return ModuleObject::Evaluate(cx, moduleArg.as<ModuleObject>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6204,7 +6204,7 @@ JS_SetPendingException(JSContext* cx, HandleValue value)
|
||||||
{
|
{
|
||||||
AssertHeapIsIdle(cx);
|
AssertHeapIsIdle(cx);
|
||||||
CHECK_REQUEST(cx);
|
CHECK_REQUEST(cx);
|
||||||
assertSameCompartment(cx, value);
|
releaseAssertSameCompartment(cx, value);
|
||||||
cx->setPendingException(value);
|
cx->setPendingException(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue