зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1644140 - Remove nsDocShell::AddChildSHEntryInternal and make some session history code in nsDocShell work with fission. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D78686
This commit is contained in:
Родитель
cdf90ed4e3
Коммит
c7c65a2a89
|
@ -2832,29 +2832,10 @@ nsDocShell::AddChildSHEntry(nsISHEntry* aCloneRef, nsISHEntry* aNewEntry,
|
|||
rv = mOSHE->AddChild(aNewEntry, aChildOffset, UseRemoteSubframes());
|
||||
}
|
||||
} else {
|
||||
rv = AddChildSHEntryInternal(aCloneRef, aNewEntry, aChildOffset, aLoadType,
|
||||
aCloneChildren);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsDocShell::AddChildSHEntryInternal(nsISHEntry* aCloneRef,
|
||||
nsISHEntry* aNewEntry,
|
||||
int32_t aChildOffset,
|
||||
uint32_t aLoadType,
|
||||
bool aCloneChildren) {
|
||||
nsresult rv = NS_OK;
|
||||
if (GetSessionHistory()) {
|
||||
rv = GetSessionHistory()->LegacySHistory()->AddChildSHEntryHelper(
|
||||
aCloneRef, aNewEntry, mBrowsingContext, aCloneChildren);
|
||||
} else {
|
||||
/* Just pass this along */
|
||||
nsCOMPtr<nsIDocShell> parent =
|
||||
do_QueryInterface(GetAsSupports(mParent), &rv);
|
||||
if (parent) {
|
||||
rv = static_cast<nsDocShell*>(parent.get())
|
||||
->AddChildSHEntryInternal(aCloneRef, aNewEntry, aChildOffset,
|
||||
aLoadType, aCloneChildren);
|
||||
RefPtr<ChildSHistory> shistory = GetRootSessionHistory();
|
||||
if (shistory) {
|
||||
rv = shistory->LegacySHistory()->AddChildSHEntryHelper(
|
||||
aCloneRef, aNewEntry, mBrowsingContext->Top(), aCloneChildren);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
@ -2899,8 +2880,7 @@ nsresult nsDocShell::AddChildSHEntryToParent(nsISHEntry* aNewEntry,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::RemoveFromSessionHistory() {
|
||||
RefPtr<ChildSHistory> sessionHistory =
|
||||
mBrowsingContext->Top()->GetChildSessionHistory();
|
||||
RefPtr<ChildSHistory> sessionHistory = GetRootSessionHistory();
|
||||
if (!sessionHistory) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -10062,8 +10042,7 @@ bool nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel,
|
|||
|
||||
// Create SH Entry (mLSHE) only if there is a SessionHistory object in the
|
||||
// in the root browsing context.
|
||||
RefPtr<ChildSHistory> rootSH =
|
||||
mBrowsingContext->Top()->GetChildSessionHistory();
|
||||
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
|
||||
if (!rootSH) {
|
||||
updateSHistory = false;
|
||||
updateGHistory = false; // XXX Why global history too?
|
||||
|
@ -10659,16 +10638,13 @@ nsresult nsDocShell::AddToSessionHistory(
|
|||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsISHEntry> entry;
|
||||
|
||||
// Get a handle to the root docshell
|
||||
nsCOMPtr<nsIDocShellTreeItem> root;
|
||||
GetInProcessSameTypeRootTreeItem(getter_AddRefs(root));
|
||||
/*
|
||||
* If this is a LOAD_FLAGS_REPLACE_HISTORY in a subframe, we use
|
||||
* the existing SH entry in the page and replace the url and
|
||||
* other vitalities.
|
||||
*/
|
||||
if (LOAD_TYPE_HAS_FLAGS(mLoadType, LOAD_FLAGS_REPLACE_HISTORY) &&
|
||||
root != static_cast<nsIDocShellTreeItem*>(this)) {
|
||||
!mBrowsingContext->IsTop()) {
|
||||
// This is a subframe
|
||||
entry = mOSHE;
|
||||
if (entry) {
|
||||
|
@ -10678,10 +10654,7 @@ nsresult nsDocShell::AddToSessionHistory(
|
|||
|
||||
// Create a new entry if necessary.
|
||||
if (!entry) {
|
||||
nsCOMPtr<nsIWebNavigation> webnav = do_QueryInterface(root);
|
||||
NS_ENSURE_TRUE(webnav, NS_ERROR_FAILURE);
|
||||
|
||||
RefPtr<ChildSHistory> shistory = webnav->GetSessionHistory();
|
||||
RefPtr<ChildSHistory> shistory = GetRootSessionHistory();
|
||||
entry = new nsSHEntry(shistory ? shistory->LegacySHistory() : nullptr);
|
||||
}
|
||||
|
||||
|
@ -10810,7 +10783,7 @@ nsresult nsDocShell::AddToSessionHistory(
|
|||
resultPrincipalURI, loadReplace, referrerInfo, srcdoc,
|
||||
srcdocEntry, baseURI, saveLayoutState, expired);
|
||||
|
||||
if (root == static_cast<nsIDocShellTreeItem*>(this) && GetSessionHistory()) {
|
||||
if (mBrowsingContext->IsTop() && GetSessionHistory()) {
|
||||
bool shouldPersist = ShouldAddToSessionHistory(aURI, aChannel);
|
||||
Maybe<int32_t> previousEntryIndex;
|
||||
Maybe<int32_t> loadedEntryIndex;
|
||||
|
@ -11019,16 +10992,9 @@ already_AddRefed<nsISHEntry> nsDocShell::SetHistoryEntry(
|
|||
}
|
||||
|
||||
already_AddRefed<ChildSHistory> nsDocShell::GetRootSessionHistory() {
|
||||
nsCOMPtr<nsIDocShellTreeItem> root;
|
||||
nsresult rv = GetInProcessSameTypeRootTreeItem(getter_AddRefs(root));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return nullptr;
|
||||
}
|
||||
nsCOMPtr<nsIWebNavigation> webnav = do_QueryInterface(root);
|
||||
if (!webnav) {
|
||||
return nullptr;
|
||||
}
|
||||
return webnav->GetSessionHistory();
|
||||
RefPtr<ChildSHistory> childSHistory =
|
||||
mBrowsingContext->Top()->GetChildSessionHistory();
|
||||
return childSHistory.forget();
|
||||
}
|
||||
|
||||
nsresult nsDocShell::GetHttpChannel(nsIChannel* aChannel,
|
||||
|
|
|
@ -603,10 +603,6 @@ class nsDocShell final : public nsDocLoader,
|
|||
nsresult AddChildSHEntryToParent(nsISHEntry* aNewEntry, int32_t aChildOffset,
|
||||
bool aCloneChildren);
|
||||
|
||||
nsresult AddChildSHEntryInternal(nsISHEntry* aCloneRef, nsISHEntry* aNewEntry,
|
||||
int32_t aChildOffset, uint32_t aLoadType,
|
||||
bool aCloneChildren);
|
||||
|
||||
// Call this method to swap in a new history entry to m[OL]SHE, rather than
|
||||
// setting it directly. This completes the navigation in all docshells
|
||||
// in the case of a subframe navigation.
|
||||
|
|
Загрузка…
Ссылка в новой задаче