Bug 1602115 - Make history.length Fission compatible, r=peterv

Differential Revision: https://phabricator.services.mozilla.com/D79197
This commit is contained in:
Olli Pettay
2020-07-16 19:01:36 +00:00
parent 582297169c
commit 81ced2e67b
14 changed files with 158 additions and 23 deletions

View File

@@ -5367,17 +5367,22 @@ nsresult nsDocShell::Embed(nsIContentViewer* aContentViewer,
SetDocCurrentStateObj(mLSHE);
SetHistoryEntryAndUpdateBC(Nothing(), Some<nsISHEntry*>(mLSHE));
nsID changeID = {};
if (StaticPrefs::fission_sessionHistoryInParent()) {
mActiveEntry = nullptr;
mLoadingEntry.swap(mActiveEntry);
if (mActiveEntry) {
if (XRE_IsParentProcess()) {
mBrowsingContext->Canonical()->SessionHistoryCommit(
mActiveEntry->Id());
mActiveEntry->Id(), changeID);
} else {
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
if (rootSH) {
changeID = rootSH->AddPendingHistoryChange();
}
ContentChild* cc = ContentChild::GetSingleton();
mozilla::Unused << cc->SendHistoryCommit(mBrowsingContext,
mActiveEntry->Id());
mozilla::Unused << cc->SendHistoryCommit(
mBrowsingContext, mActiveEntry->Id(), changeID);
}
}
}