Bug 1597499 - Make Session Restore work in Fission, r=nika

Differential Revision: https://phabricator.services.mozilla.com/D107883
This commit is contained in:
Kashav Madan
2021-03-23 18:01:21 +00:00
parent 16af59aa57
commit b912b90222
25 changed files with 791 additions and 109 deletions

View File

@@ -6555,6 +6555,12 @@ nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
//
nsCOMPtr<nsIDocShell> kungFuDeathGrip(this);
// We'll never need to restore data into an about:blank document, so we can
// ignore those here.
if (!NS_IsAboutBlank(url)) {
MaybeRestoreTabContent();
}
// Notify the ContentViewer that the Document has finished loading. This
// will cause any OnLoad(...) and PopState(...) handlers to fire.
if (!mEODForCurrentDocument && mContentViewer) {
@@ -13304,6 +13310,23 @@ void nsDocShell::NotifyJSRunToCompletionStop() {
}
}
void nsDocShell::MaybeRestoreTabContent() {
BrowsingContext* bc = mBrowsingContext;
if (bc && bc->Top()->GetHasRestoreData()) {
if (XRE_IsParentProcess()) {
if (WindowGlobalParent* wgp = bc->Canonical()->GetCurrentWindowGlobal()) {
bc->Canonical()->RequestRestoreTabContent(wgp);
}
} else {
if (WindowContext* windowContext = bc->GetCurrentWindowContext()) {
if (WindowGlobalChild* wgc = windowContext->GetWindowGlobalChild()) {
wgc->SendRequestRestoreTabContent();
}
}
}
}
}
/* static */
void nsDocShell::MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
const nsString& aKeyword) {