Bug 1740516 - Fire pageshow for an iframe before the pageshow for its parent window when coming out of BFCache with session history in parent. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D131891
This commit is contained in:
Peter Van der Beken
2021-11-23 20:04:35 +00:00
parent 558f3681bd
commit 64e739ad46
6 changed files with 151 additions and 6 deletions

View File

@@ -2910,12 +2910,21 @@ void BrowsingContext::DidSet(FieldIndex<IDX_IsInBFCache>) {
nsDocShell::Cast(mDocShell)->MaybeDisconnectChildListenersOnPageHide();
}
PreOrderWalk([&](BrowsingContext* aContext) {
nsCOMPtr<nsIDocShell> shell = aContext->GetDocShell();
if (shell) {
nsDocShell::Cast(shell)->FirePageHideShowNonRecursive(!isInBFCache);
}
});
if (isInBFCache) {
PreOrderWalk([&](BrowsingContext* aContext) {
nsCOMPtr<nsIDocShell> shell = aContext->GetDocShell();
if (shell) {
nsDocShell::Cast(shell)->FirePageHideShowNonRecursive(false);
}
});
} else {
PostOrderWalk([&](BrowsingContext* aContext) {
nsCOMPtr<nsIDocShell> shell = aContext->GetDocShell();
if (shell) {
nsDocShell::Cast(shell)->FirePageHideShowNonRecursive(true);
}
});
}
if (isInBFCache) {
PreOrderWalk([&](BrowsingContext* aContext) {