Bug 1650257: Part 2 - Abort SetNewDocument() if ancestors are discarded/cached. r=nika,smaug,sg

Differential Revision: https://phabricator.services.mozilla.com/D87486
This commit is contained in:
Kris Maglione
2020-08-31 18:51:56 +00:00
parent d6859a14a7
commit c67b4248ac
12 changed files with 86 additions and 59 deletions

View File

@@ -6398,6 +6398,11 @@ nsresult nsDocShell::CreateAboutBlankContentViewer(
return NS_ERROR_FAILURE;
}
if (!mBrowsingContext->AncestorsAreCurrent()) {
mBrowsingContext->RemoveRootFromBFCacheSync();
return NS_ERROR_NOT_AVAILABLE;
}
// mContentViewer->PermitUnload may release |this| docshell.
nsCOMPtr<nsIDocShell> kungFuDeathGrip(this);
@@ -7518,6 +7523,11 @@ nsresult nsDocShell::CreateContentViewer(const nsACString& aContentType,
return NS_ERROR_DOCSHELL_DYING;
}
if (!mBrowsingContext->AncestorsAreCurrent()) {
mBrowsingContext->RemoveRootFromBFCacheSync();
return NS_ERROR_NOT_AVAILABLE;
}
// Can we check the content type of the current content viewer
// and reuse it without destroying it and re-creating it?