Bug 1703607 - Exempt about:*pages from new bfcache, with the exception of about:blank, r=peterv

This also fixes test
browser/base/content/test/tabs/browser_navigate_through_urls_origin_attributes.js
which was failing for fission + bfcacheInParent, because about:privatebrowsing
was getting bfcached, and an extra XULFrameLoaderCreated event was firing, when
we were not expecting it.

Differential Revision: https://phabricator.services.mozilla.com/D112441
This commit is contained in:
Anny Gakhokidze
2021-04-28 20:17:35 +00:00
parent 3468883144
commit 3013fd614d
7 changed files with 234 additions and 10 deletions

View File

@@ -2123,6 +2123,18 @@ bool CanonicalBrowsingContext::AllowedInBFCache(
(" * auxiliary BrowsingContexts"));
}
// There are not a lot of about:* pages that are allowed to load in
// subframes, so it's OK to allow those few about:* pages enter BFCache.
MOZ_ASSERT(IsTop(), "Trying to put a non top level BC into BFCache");
nsCOMPtr<nsIURI> currentURI = GetCurrentURI();
// Exempt about:* pages from bfcache, with the exception of about:blank
if (currentURI && currentURI->SchemeIs("about") &&
!currentURI->GetSpecOrDefault().EqualsLiteral("about:blank")) {
bfcacheCombo |= BFCacheStatus::ABOUT_PAGE;
MOZ_LOG(gSHIPBFCacheLog, LogLevel::Debug, (" * about:* page"));
}
// For telemetry we're collecting all the flags for all the BCs hanging
// from this top-level BC.
PreOrderWalk([&](BrowsingContext* aBrowsingContext) {