Bug 1875040 - Use GetExtantDocument instead of GetDocument. r=smaug

Avoids accidentally creating a document when checking if a document's
presentation can be saved.

Differential Revision: https://phabricator.services.mozilla.com/D198781
This commit is contained in:
Andreas Farre 2024-01-23 08:04:51 +00:00
parent cd3ae60da5
commit b51bf27f13

View File

@ -9436,7 +9436,7 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
// separate check for SHIP so that we know if there are ongoing requests
// before calling Stop() below.
if (mozilla::SessionHistoryInParent()) {
Document* document = GetDocument();
Document* document = GetExtantDocument();
uint32_t flags = 0;
if (document && !document->CanSavePresentation(nullptr, flags, true)) {
// This forces some flags into the WindowGlobalParent's mBFCacheStatus,