diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index e21addb0c298..560a77a8be08 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -1212,12 +1212,25 @@ void nsDocShell::FirePageHideShowNonRecursive(bool aShow) { mFiredUnloadEvent = false; RefPtr doc = contentViewer->GetDocument(); if (doc) { + RefPtr 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 channel = doc->GetChannel(); if (channel) { SetCurrentURI(doc->GetDocumentURI(), channel, true, 0); diff --git a/docshell/test/navigation/file_navigation_type.html b/docshell/test/navigation/file_navigation_type.html new file mode 100644 index 000000000000..bb538eefec20 --- /dev/null +++ b/docshell/test/navigation/file_navigation_type.html @@ -0,0 +1,25 @@ + + + + + + + \ No newline at end of file diff --git a/docshell/test/navigation/mochitest.ini b/docshell/test/navigation/mochitest.ini index cdea7b8efcdb..73decdcb0544 100644 --- a/docshell/test/navigation/mochitest.ini +++ b/docshell/test/navigation/mochitest.ini @@ -88,6 +88,8 @@ support-files = file_bug1536471.html support-files = file_docshell_gotoindex.html [test_grandchild.html] [test_load_history_entry.html] +[test_navigation_type.html] +support-files = file_navigation_type.html [test_not-opener.html] [test_opener.html] [test_popup-navigates-children.html] diff --git a/docshell/test/navigation/test_navigation_type.html b/docshell/test/navigation/test_navigation_type.html new file mode 100644 index 000000000000..75ea88bcbd56 --- /dev/null +++ b/docshell/test/navigation/test_navigation_type.html @@ -0,0 +1,47 @@ + + + + + performance.navigation.type + + + + + +

+ +

+
+