Bug 1697266 - Update performance.navigation.type when restoring page from bfcache, r=peterv

Differential Revision: https://phabricator.services.mozilla.com/D107709
This commit is contained in:
Olli Pettay
2021-03-10 14:51:49 +00:00
parent ff903d642c
commit 1bc76db3f2
4 changed files with 89 additions and 2 deletions

View File

@@ -1212,12 +1212,25 @@ void nsDocShell::FirePageHideShowNonRecursive(bool aShow) {
mFiredUnloadEvent = false;
RefPtr<Document> doc = contentViewer->GetDocument();
if (doc) {
RefPtr<nsGlobalWindowInner> inner =
mScriptGlobal ? mScriptGlobal->GetCurrentInnerWindowInternal()
: nullptr;
if (mBrowsingContext->IsTop()) {
doc->NotifyPossibleTitleChange(false);
if (inner) {
// Now that we have found the inner window of the page restored
// from the history, we have to make sure that
// performance.navigation.type is 2.
// Traditionally this type change has been done to the top level page
// only.
inner->GetPerformance()->GetDOMTiming()->NotifyRestoreStart();
}
}
if (mScriptGlobal && mScriptGlobal->GetCurrentInnerWindowInternal()) {
mScriptGlobal->GetCurrentInnerWindowInternal()->Thaw(false);
if (inner) {
inner->Thaw(false);
}
nsCOMPtr<nsIChannel> channel = doc->GetChannel();
if (channel) {
SetCurrentURI(doc->GetDocumentURI(), channel, true, 0);