Bug 1660868 - Forward RemoveDynEntries to the parent process for session history in the parent. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D88060
This commit is contained in:
Peter Van der Beken 2020-08-25 16:04:51 +00:00
Родитель f916ec87b2
Коммит f0aa8ed5fe
8 изменённых файлов: 44 добавлений и 3 удалений

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

@ -2586,6 +2586,15 @@ void BrowsingContext::ReplaceActiveSessionHistoryEntry(
}
}
void BrowsingContext::RemoveDynEntriesFromActiveSessionHistoryEntry() {
if (XRE_IsContentProcess()) {
ContentChild::GetSingleton()
->SendRemoveDynEntriesFromActiveSessionHistoryEntry(this);
} else {
Canonical()->RemoveDynEntriesFromActiveSessionHistoryEntry();
}
}
} // namespace dom
namespace ipc {

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

@ -648,6 +648,9 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
// implementing history.replaceState.
void ReplaceActiveSessionHistoryEntry(SessionHistoryInfo* aInfo);
// Removes dynamic child entries of the active entry.
void RemoveDynEntriesFromActiveSessionHistoryEntry();
protected:
virtual ~BrowsingContext();
BrowsingContext(WindowContext* aParentWindow, BrowsingContextGroup* aGroup,

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

@ -471,6 +471,12 @@ void CanonicalBrowsingContext::ReplaceActiveSessionHistoryEntry(
// FIXME Need to do the equivalent of EvictContentViewersOrReplaceEntry.
}
void CanonicalBrowsingContext::RemoveDynEntriesFromActiveSessionHistoryEntry() {
nsISHistory* shistory = GetSessionHistory();
nsCOMPtr<nsISHEntry> root = nsSHistory::GetRootSHEntry(mActiveEntry);
shistory->RemoveDynEntries(shistory->GetIndexOfEntry(root), mActiveEntry);
}
JSObject* CanonicalBrowsingContext::WrapObject(
JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
return CanonicalBrowsingContext_Binding::Wrap(aCx, this, aGivenProto);

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

@ -122,6 +122,8 @@ class CanonicalBrowsingContext final : public BrowsingContext {
void ReplaceActiveSessionHistoryEntry(SessionHistoryInfo* aInfo);
void RemoveDynEntriesFromActiveSessionHistoryEntry();
JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;

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

@ -1057,9 +1057,15 @@ void nsDocShell::FirePageHideNotificationInternal(
// If the document is unloading, remove all dynamic subframe entries.
if (aIsUnload && !aSkipCheckingDynEntries) {
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
if (rootSH && mOSHE) {
int32_t index = rootSH->Index();
rootSH->LegacySHistory()->RemoveDynEntries(index, mOSHE);
if (rootSH) {
if (StaticPrefs::fission_sessionHistoryInParent()) {
if (mActiveEntry) {
mBrowsingContext->RemoveDynEntriesFromActiveSessionHistoryEntry();
}
} else if (mOSHE) {
int32_t index = rootSH->Index();
rootSH->LegacySHistory()->RemoveDynEntries(index, mOSHE);
}
}
}

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

@ -7037,6 +7037,15 @@ mozilla::ipc::IPCResult ContentParent::RecvReplaceActiveSessionHistoryEntry(
return IPC_OK();
}
mozilla::ipc::IPCResult
ContentParent::RecvRemoveDynEntriesFromActiveSessionHistoryEntry(
const MaybeDiscarded<BrowsingContext>& aContext) {
if (!aContext.IsDiscarded()) {
aContext.get_canonical()->RemoveDynEntriesFromActiveSessionHistoryEntry();
}
return IPC_OK();
}
mozilla::ipc::IPCResult ContentParent::RecvCommitWindowContextTransaction(
const MaybeDiscarded<WindowContext>& aContext,
WindowContext::BaseTransaction&& aTransaction, uint64_t aEpoch) {

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

@ -1370,6 +1370,9 @@ class ContentParent final
const MaybeDiscarded<BrowsingContext>& aContext,
SessionHistoryInfo&& aInfo);
mozilla::ipc::IPCResult RecvRemoveDynEntriesFromActiveSessionHistoryEntry(
const MaybeDiscarded<BrowsingContext>& aContext);
// Notify the ContentChild to enable the input event prioritization when
// initializing.
void MaybeEnableRemoteInputEventQueue();

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

@ -1690,6 +1690,9 @@ parent:
async ReplaceActiveSessionHistoryEntry(
MaybeDiscardedBrowsingContext aContext, SessionHistoryInfo info);
async RemoveDynEntriesFromActiveSessionHistoryEntry(
MaybeDiscardedBrowsingContext aContext);
both:
async ScriptError(nsString message, nsString sourceName, nsString sourceLine,
uint32_t lineNumber, uint32_t colNumber, uint32_t flags,