Bug 1803628, initiate frameloader destroy asynchronously, r=mccr8

Differential Revision: https://phabricator.services.mozilla.com/D166830
This commit is contained in:
Olli Pettay 2023-01-20 16:39:39 +00:00
parent 4f996eda52
commit ee07926a1f

View file

@ -73,7 +73,12 @@ SHEntrySharedParentState::~SHEntrySharedParentState() {
RefPtr<nsFrameLoader> loader = mFrameLoader;
SetFrameLoader(nullptr);
if (loader) {
loader->AsyncDestroy();
if (NS_FAILED(NS_DispatchToCurrentThread(NS_NewRunnableFunction(
"SHEntrySharedParentState::~SHEntrySharedParentState",
[loader]() -> void { loader->AsyncDestroy(); })))) {
// Trigger AsyncDestroy immediately during shutdown.
loader->AsyncDestroy();
}
}
sIdToSharedState->Remove(mId);