Bug 1663488 - Forward ChildSHistory::Reload to the parent process with session history in the parent. r=smaug

Depends on D89420

Differential Revision: https://phabricator.services.mozilla.com/D89421
This commit is contained in:
Peter Van der Beken 2020-09-08 14:10:31 +00:00
Родитель 709c5edefe
Коммит f5c5e66824
4 изменённых файлов: 33 добавлений и 0 удалений

Просмотреть файл

@ -6,6 +6,7 @@
#include "mozilla/dom/ChildSHistory.h" #include "mozilla/dom/ChildSHistory.h"
#include "mozilla/dom/ChildSHistoryBinding.h" #include "mozilla/dom/ChildSHistoryBinding.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/dom/ContentChild.h" #include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentFrameMessageManager.h" #include "mozilla/dom/ContentFrameMessageManager.h"
#include "mozilla/StaticPrefs_fission.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) { 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); aRv = mHistory->Reload(aReloadFlags);
} }

Просмотреть файл

@ -7072,6 +7072,18 @@ mozilla::ipc::IPCResult ContentParent::RecvRemoveFromSessionHistory(
return IPC_OK(); return IPC_OK();
} }
mozilla::ipc::IPCResult ContentParent::RecvHistoryReload(
const MaybeDiscarded<BrowsingContext>& 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( mozilla::ipc::IPCResult ContentParent::RecvCommitWindowContextTransaction(
const MaybeDiscarded<WindowContext>& aContext, const MaybeDiscarded<WindowContext>& aContext,
WindowContext::BaseTransaction&& aTransaction, uint64_t aEpoch) { WindowContext::BaseTransaction&& aTransaction, uint64_t aEpoch) {

Просмотреть файл

@ -1379,6 +1379,10 @@ class ContentParent final
mozilla::ipc::IPCResult RecvRemoveFromSessionHistory( mozilla::ipc::IPCResult RecvRemoveFromSessionHistory(
const MaybeDiscarded<BrowsingContext>& aContext); const MaybeDiscarded<BrowsingContext>& aContext);
mozilla::ipc::IPCResult RecvHistoryReload(
const MaybeDiscarded<BrowsingContext>& aContext,
const uint32_t aReloadFlags);
// Notify the ContentChild to enable the input event prioritization when // Notify the ContentChild to enable the input event prioritization when
// initializing. // initializing.
void MaybeEnableRemoteInputEventQueue(); void MaybeEnableRemoteInputEventQueue();

Просмотреть файл

@ -1668,6 +1668,8 @@ parent:
*/ */
async AbortOtherOrientationPendingPromises(MaybeDiscardedBrowsingContext aContext); async AbortOtherOrientationPendingPromises(MaybeDiscardedBrowsingContext aContext);
async HistoryReload(MaybeDiscardedBrowsingContext aContext, uint32_t aReloadFlags);
async NotifyOnHistoryReload(MaybeDiscardedBrowsingContext aContext) async NotifyOnHistoryReload(MaybeDiscardedBrowsingContext aContext)
returns (bool canReload, nsDocShellLoadState? loadState, returns (bool canReload, nsDocShellLoadState? loadState,
bool? reloadActiveEntry); bool? reloadActiveEntry);