diff --git a/docshell/shistory/ChildSHistory.cpp b/docshell/shistory/ChildSHistory.cpp index dbc7a0e09cca..ec07b60bc9c5 100644 --- a/docshell/shistory/ChildSHistory.cpp +++ b/docshell/shistory/ChildSHistory.cpp @@ -6,6 +6,7 @@ #include "mozilla/dom/ChildSHistory.h" #include "mozilla/dom/ChildSHistoryBinding.h" +#include "mozilla/dom/CanonicalBrowsingContext.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/ContentFrameMessageManager.h" #include "mozilla/StaticPrefs_fission.h" @@ -105,6 +106,20 @@ void ChildSHistory::SetIndexAndLength(uint32_t aIndex, uint32_t aLength, } void ChildSHistory::Reload(uint32_t aReloadFlags, ErrorResult& aRv) { + if (StaticPrefs::fission_sessionHistoryInParent()) { + if (XRE_IsParentProcess()) { + nsISHistory* shistory = + mBrowsingContext->Canonical()->GetSessionHistory(); + if (shistory) { + aRv = shistory->Reload(aReloadFlags); + } + } else { + ContentChild::GetSingleton()->SendHistoryReload(mBrowsingContext, + aReloadFlags); + } + + return; + } aRv = mHistory->Reload(aReloadFlags); } diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 63d189999a00..c3c2debb2660 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -7072,6 +7072,18 @@ mozilla::ipc::IPCResult ContentParent::RecvRemoveFromSessionHistory( return IPC_OK(); } +mozilla::ipc::IPCResult ContentParent::RecvHistoryReload( + const MaybeDiscarded& aContext, + const uint32_t aReloadFlags) { + if (!aContext.IsDiscarded()) { + nsISHistory* shistory = aContext.get_canonical()->GetSessionHistory(); + if (shistory) { + shistory->Reload(aReloadFlags); + } + } + return IPC_OK(); +} + mozilla::ipc::IPCResult ContentParent::RecvCommitWindowContextTransaction( const MaybeDiscarded& aContext, WindowContext::BaseTransaction&& aTransaction, uint64_t aEpoch) { diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 16b4e4729097..a1c81b1705da 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -1379,6 +1379,10 @@ class ContentParent final mozilla::ipc::IPCResult RecvRemoveFromSessionHistory( const MaybeDiscarded& aContext); + mozilla::ipc::IPCResult RecvHistoryReload( + const MaybeDiscarded& aContext, + const uint32_t aReloadFlags); + // Notify the ContentChild to enable the input event prioritization when // initializing. void MaybeEnableRemoteInputEventQueue(); diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index eaf811c390bd..cfa8d4ad709a 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -1668,6 +1668,8 @@ parent: */ async AbortOtherOrientationPendingPromises(MaybeDiscardedBrowsingContext aContext); + async HistoryReload(MaybeDiscardedBrowsingContext aContext, uint32_t aReloadFlags); + async NotifyOnHistoryReload(MaybeDiscardedBrowsingContext aContext) returns (bool canReload, nsDocShellLoadState? loadState, bool? reloadActiveEntry);