Bug 1700719 - Discard-check all ancestors before restoring, r=nika

Differential Revision: https://phabricator.services.mozilla.com/D109722
This commit is contained in:
Kashav Madan 2021-03-26 16:24:47 +00:00
parent 76329096fd
commit 5c37b3d6b9
3 changed files with 6 additions and 4 deletions

View File

@ -1745,6 +1745,8 @@ void CanonicalBrowsingContext::SetRestoreData(SessionStoreRestoreData* aData) {
void CanonicalBrowsingContext::RequestRestoreTabContent(
WindowGlobalParent* aWindow) {
MOZ_DIAGNOSTIC_ASSERT(IsTop());
if (IsDiscarded() || !mRestoreData || mRestoreData->IsEmpty()) {
return;
}

View File

@ -1301,9 +1301,9 @@ mozilla::ipc::IPCResult WindowGlobalParent::RecvResetSessionStore(
}
mozilla::ipc::IPCResult WindowGlobalParent::RecvRequestRestoreTabContent() {
CanonicalBrowsingContext* bc = BrowsingContext()->Top();
if (bc && !bc->IsDiscarded()) {
bc->RequestRestoreTabContent(this);
CanonicalBrowsingContext* bc = BrowsingContext();
if (bc && bc->AncestorsAreCurrent()) {
bc->Top()->RequestRestoreTabContent(this);
}
return IPC_OK();
}

View File

@ -100,7 +100,7 @@ RestoreTabContentObserver::Observe(nsISupports* aSubject, const char* aTopic,
}
if (XRE_IsParentProcess()) {
if (WindowGlobalParent* wgp = bc->Canonical()->GetCurrentWindowGlobal()) {
bc->Canonical()->RequestRestoreTabContent(wgp);
bc->Canonical()->Top()->RequestRestoreTabContent(wgp);
}
} else if (WindowContext* windowContext = bc->GetCurrentWindowContext()) {
if (WindowGlobalChild* wgc = windowContext->GetWindowGlobalChild()) {