Bug 1647229 - Synchronize layouthistorystate to parent process, r=peterv

Differential Revision: https://phabricator.services.mozilla.com/D81753
This commit is contained in:
Olli Pettay
2020-07-23 19:35:29 +00:00
parent 44dd336269
commit c0a4310e33
9 changed files with 121 additions and 24 deletions

View File

@@ -2950,9 +2950,19 @@ nsDocShell::GetCurrentSHEntry(nsISHEntry** aEntry, bool* aOSHE) {
}
NS_IMETHODIMP nsDocShell::SynchronizeLayoutHistoryState() {
if (mOSHE) {
mOSHE->SynchronizeLayoutHistoryState();
if (mActiveEntry && mActiveEntry->GetLayoutHistoryState()) {
if (XRE_IsContentProcess()) {
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
if (contentChild) {
contentChild->SendSynchronizeLayoutHistoryState(
mActiveEntry->Id(), mActiveEntry->GetLayoutHistoryState());
}
} else {
SessionHistoryEntry::UpdateLayoutHistoryState(
mActiveEntry->Id(), mActiveEntry->GetLayoutHistoryState());
}
}
return NS_OK;
}
@@ -11682,6 +11692,9 @@ nsDocShell::SetLayoutHistoryState(nsILayoutHistoryState* aLayoutHistoryState) {
if (mOSHE) {
mOSHE->SetLayoutHistoryState(aLayoutHistoryState);
}
if (mActiveEntry) {
mActiveEntry->SetLayoutHistoryState(aLayoutHistoryState);
}
return NS_OK;
}