Bug 1658280 - nsISHEntry.scrollRestorationIsManual setter for session-history-in-parent, r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D86547
This commit is contained in:
@@ -8508,11 +8508,18 @@ nsresult nsDocShell::HandleSameDocumentNavigation(
|
||||
// Link our new SHEntry to the old SHEntry's back/forward
|
||||
// cache data, since the two SHEntries correspond to the
|
||||
// same document.
|
||||
if (mLoadingEntry && !mLoadingEntry->mIsLoadFromSessionHistory) {
|
||||
// If we're not doing a history load, scroll restoration
|
||||
// should be inherited from the previous session history entry.
|
||||
SetScrollRestorationIsManualOnHistoryEntry(
|
||||
nullptr, &mLoadingEntry->mInfo, scrollRestorationIsManual);
|
||||
}
|
||||
if (mLSHE) {
|
||||
if (!aLoadState->SHEntry()) {
|
||||
// If we're not doing a history load, scroll restoration
|
||||
// should be inherited from the previous session history entry.
|
||||
mLSHE->SetScrollRestorationIsManual(scrollRestorationIsManual);
|
||||
SetScrollRestorationIsManualOnHistoryEntry(mLSHE, nullptr,
|
||||
scrollRestorationIsManual);
|
||||
}
|
||||
mLSHE->AdoptBFCacheEntry(mOSHE);
|
||||
}
|
||||
@@ -10787,13 +10794,35 @@ nsDocShell::GetCurrentScrollRestorationIsManual(bool* aIsManual) {
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetCurrentScrollRestorationIsManual(bool aIsManual) {
|
||||
if (mOSHE) {
|
||||
mOSHE->SetScrollRestorationIsManual(aIsManual);
|
||||
}
|
||||
SetScrollRestorationIsManualOnHistoryEntry(mOSHE, mActiveEntry.get(),
|
||||
aIsManual);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsDocShell::SetScrollRestorationIsManualOnHistoryEntry(
|
||||
nsISHEntry* aSHEntry, mozilla::dom::SessionHistoryInfo* aInfo,
|
||||
bool aIsManual) {
|
||||
if (aSHEntry) {
|
||||
aSHEntry->SetScrollRestorationIsManual(aIsManual);
|
||||
}
|
||||
|
||||
if (aInfo) {
|
||||
aInfo->SetScrollRestorationIsManual(aIsManual);
|
||||
if (XRE_IsParentProcess()) {
|
||||
SessionHistoryEntry* entry =
|
||||
SessionHistoryEntry::GetByInfoId(aInfo->Id());
|
||||
if (entry) {
|
||||
entry->SetScrollRestorationIsManual(aIsManual);
|
||||
}
|
||||
} else {
|
||||
mozilla::Unused << ContentChild::GetSingleton()
|
||||
->SendSessionHistoryEntryScrollRestorationIsManual(
|
||||
aInfo->Id(), aIsManual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool nsDocShell::ShouldAddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel) {
|
||||
// I believe none of the about: urls should go in the history. But then
|
||||
// that could just be me... If the intent is only deny about:blank then we
|
||||
|
||||
Reference in New Issue
Block a user