зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1663486 - Synchronize ChildSHistory state when sending a browsing context to a new process. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D89419
This commit is contained in:
Родитель
7720088b5c
Коммит
fe3f64a907
|
@ -409,8 +409,12 @@ void BrowsingContext::CreateFromIPC(BrowsingContext::IPCInitializer&& aInit,
|
|||
}
|
||||
|
||||
context->mWindowless = aInit.mWindowless;
|
||||
if (aInit.mHasSessionHistory) {
|
||||
context->InitSessionHistory();
|
||||
if (context->GetHasSessionHistory()) {
|
||||
context->CreateChildSHistory();
|
||||
if (StaticPrefs::fission_sessionHistoryInParent()) {
|
||||
context->GetChildSessionHistory()->SetIndexAndLength(
|
||||
aInit.mSessionHistoryIndex, aInit.mSessionHistoryCount, nsID());
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: Call through the `Set` methods for these values to ensure that any
|
||||
|
@ -607,7 +611,7 @@ void BrowsingContext::Attach(bool aFromIPC, ContentParent* aOriginProcess) {
|
|||
PopupBlocker::RegisterOpenPopupSpam();
|
||||
}
|
||||
|
||||
if (IsTop() && GetHasSessionHistory()) {
|
||||
if (IsTop() && GetHasSessionHistory() && !mChildSessionHistory) {
|
||||
CreateChildSHistory();
|
||||
}
|
||||
|
||||
|
@ -2069,7 +2073,10 @@ BrowsingContext::IPCInitializer BrowsingContext::GetIPCInitializer() {
|
|||
init.mUseRemoteTabs = mUseRemoteTabs;
|
||||
init.mUseRemoteSubframes = mUseRemoteSubframes;
|
||||
init.mOriginAttributes = mOriginAttributes;
|
||||
init.mHasSessionHistory = mChildSessionHistory != nullptr;
|
||||
if (mChildSessionHistory && StaticPrefs::fission_sessionHistoryInParent()) {
|
||||
init.mSessionHistoryIndex = mChildSessionHistory->Index();
|
||||
init.mSessionHistoryCount = mChildSessionHistory->Count();
|
||||
}
|
||||
init.mRequestContextId = mRequestContextId;
|
||||
init.mFields = mFields.RawValues();
|
||||
return init;
|
||||
|
@ -2726,6 +2733,12 @@ void BrowsingContext::HistoryGo(int32_t aIndex,
|
|||
}
|
||||
}
|
||||
|
||||
void BrowsingContext::SetChildSHistory(ChildSHistory* aChildSHistory) {
|
||||
mChildSessionHistory = aChildSHistory;
|
||||
mChildSessionHistory->SetBrowsingContext(this);
|
||||
mFields.SetWithoutSyncing<IDX_HasSessionHistory>(true);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
||||
namespace ipc {
|
||||
|
@ -2768,6 +2781,8 @@ void IPDLParamTraits<dom::BrowsingContext::IPCInitializer>::Write(
|
|||
WriteIPDLParam(aMessage, aActor, aInit.mUseRemoteSubframes);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mOriginAttributes);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mRequestContextId);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mSessionHistoryIndex);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mSessionHistoryCount);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mFields);
|
||||
}
|
||||
|
||||
|
@ -2783,6 +2798,10 @@ bool IPDLParamTraits<dom::BrowsingContext::IPCInitializer>::Read(
|
|||
&aInit->mUseRemoteSubframes) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mOriginAttributes) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mRequestContextId) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor,
|
||||
&aInit->mSessionHistoryIndex) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor,
|
||||
&aInit->mSessionHistoryCount) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mFields)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -591,7 +591,8 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
|||
bool mWindowless = false;
|
||||
bool mUseRemoteTabs = false;
|
||||
bool mUseRemoteSubframes = false;
|
||||
bool mHasSessionHistory = false;
|
||||
int32_t mSessionHistoryIndex = -1;
|
||||
int32_t mSessionHistoryCount = 0;
|
||||
OriginAttributes mOriginAttributes;
|
||||
uint64_t mRequestContextId = 0;
|
||||
|
||||
|
@ -679,6 +680,12 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
|||
BrowsingContext(WindowContext* aParentWindow, BrowsingContextGroup* aGroup,
|
||||
uint64_t aBrowsingContextId, Type aType, FieldValues&& aInit);
|
||||
|
||||
void SetChildSHistory(ChildSHistory* aChildSHistory);
|
||||
already_AddRefed<ChildSHistory> ForgetChildSHistory() {
|
||||
// FIXME Do we need to unset mHasSessionHistory?
|
||||
return mChildSessionHistory.forget();
|
||||
}
|
||||
|
||||
private:
|
||||
void Attach(bool aFromIPC, ContentParent* aOriginProcess);
|
||||
|
||||
|
|
|
@ -164,6 +164,8 @@ void CanonicalBrowsingContext::ReplacedBy(
|
|||
if (mSessionHistory) {
|
||||
mSessionHistory->SetBrowsingContext(aNewContext);
|
||||
mSessionHistory.swap(aNewContext->mSessionHistory);
|
||||
RefPtr<ChildSHistory> childSHistory = ForgetChildSHistory();
|
||||
aNewContext->SetChildSHistory(childSHistory);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aNewContext->mLoadingEntries.IsEmpty());
|
||||
|
|
|
@ -21,6 +21,10 @@ namespace dom {
|
|||
ChildSHistory::ChildSHistory(BrowsingContext* aBrowsingContext)
|
||||
: mBrowsingContext(aBrowsingContext) {}
|
||||
|
||||
void ChildSHistory::SetBrowsingContext(BrowsingContext* aBrowsingContext) {
|
||||
mBrowsingContext = aBrowsingContext;
|
||||
}
|
||||
|
||||
void ChildSHistory::SetIsInProcess(bool aIsInProcess) {
|
||||
if (!aIsInProcess) {
|
||||
mHistory = nullptr;
|
||||
|
|
|
@ -44,6 +44,8 @@ class ChildSHistory : public nsISupports, public nsWrapperCache {
|
|||
|
||||
explicit ChildSHistory(BrowsingContext* aBrowsingContext);
|
||||
|
||||
void SetBrowsingContext(BrowsingContext* aBrowsingContext);
|
||||
|
||||
// Create or destroy the session history implementation in the child process.
|
||||
// This can be removed once session history is stored exclusively in the
|
||||
// parent process.
|
||||
|
|
Загрузка…
Ссылка в новой задаче