зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1689685 - Ensure docshell/test/navigation/test_scrollRestoration.html works with SHIP-BFCache, r=peterv
Similarly to the old session history implementation, scroll position needs to be stored in HandleSameDocumentNavigation. The relevant old implementation is couple of lines above the new code in nsDocShell. Differential Revision: https://phabricator.services.mozilla.com/D109756
This commit is contained in:
Родитель
bccda20440
Коммит
cc185f2b74
|
@ -9047,6 +9047,23 @@ nsresult nsDocShell::HandleSameDocumentNavigation(
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (mActiveEntry) {
|
||||
mActiveEntry->SetScrollPosition(scrollPos.x, scrollPos.y);
|
||||
if (mBrowsingContext) {
|
||||
if (XRE_IsParentProcess()) {
|
||||
SessionHistoryEntry* entry =
|
||||
mBrowsingContext->Canonical()->GetActiveSessionHistoryEntry();
|
||||
if (entry) {
|
||||
entry->SetScrollPosition(scrollPos.x, scrollPos.y);
|
||||
}
|
||||
} else {
|
||||
mozilla::Unused << ContentChild::GetSingleton()
|
||||
->SendSessionHistoryEntryScrollPosition(
|
||||
mBrowsingContext, scrollPos.x,
|
||||
scrollPos.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mLoadingEntry) {
|
||||
if (!mLoadingEntry->mLoadIsFromSessionHistory) {
|
||||
// If we're not doing a history load, scroll restoration
|
||||
|
|
|
@ -76,6 +76,12 @@ class SessionHistoryInfo {
|
|||
*aScrollPositionX = mScrollPositionX;
|
||||
*aScrollPositionY = mScrollPositionY;
|
||||
}
|
||||
|
||||
void SetScrollPosition(int32_t aScrollPositionX, int32_t aScrollPositionY) {
|
||||
mScrollPositionX = aScrollPositionX;
|
||||
mScrollPositionY = aScrollPositionY;
|
||||
}
|
||||
|
||||
bool GetScrollRestorationIsManual() const {
|
||||
return mScrollRestorationIsManual;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,8 @@
|
|||
bc.postMessage({command: "nextCase"});
|
||||
callTest = true;
|
||||
nextCase = currentCase + 1;
|
||||
history.back(); // go back to state 4
|
||||
// go back to state 3 (state 4 was removed when state 5 was pushed)
|
||||
history.back();
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
|
|
|
@ -131,7 +131,6 @@ support-files = file_sessionhistory_iframe_removal.html
|
|||
[test_nested_frames.html]
|
||||
[test_shiftReload_and_pushState.html]
|
||||
[test_scrollRestoration.html]
|
||||
skip-if = sessionHistoryInParent # It relies on the bfcache
|
||||
[test_bug1609475.html]
|
||||
[test_bug1300461.html]
|
||||
skip-if =
|
||||
|
|
|
@ -143,7 +143,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
}
|
||||
|
||||
function runTest() {
|
||||
test1();
|
||||
// If Fission is disabled, the pref is no-op.
|
||||
SpecialPowers.pushPrefEnv({set: [["fission.bfcacheInParent", true]]}, () => {
|
||||
test1();
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
@ -7301,6 +7301,21 @@ ContentParent::RecvSessionHistoryEntryScrollRestorationIsManual(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvSessionHistoryEntryScrollPosition(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext, const int32_t& aX,
|
||||
const int32_t& aY) {
|
||||
if (aContext.IsNullOrDiscarded()) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
SessionHistoryEntry* entry =
|
||||
aContext.get_canonical()->GetActiveSessionHistoryEntry();
|
||||
if (entry) {
|
||||
entry->SetScrollPosition(aX, aY);
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
ContentParent::RecvSessionHistoryEntryStoreWindowNameInContiguousEntries(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext, const nsString& aName) {
|
||||
|
|
|
@ -1375,6 +1375,10 @@ class ContentParent final
|
|||
mozilla::ipc::IPCResult RecvSessionHistoryEntryScrollRestorationIsManual(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext, const bool& aIsManual);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSessionHistoryEntryScrollPosition(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext, const int32_t& aX,
|
||||
const int32_t& aY);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSessionHistoryEntryCacheKey(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext,
|
||||
const uint32_t& aCacheKey);
|
||||
|
|
|
@ -956,6 +956,8 @@ parent:
|
|||
|
||||
async SessionHistoryEntryScrollRestorationIsManual(MaybeDiscardedBrowsingContext aContext,
|
||||
bool aIsManual);
|
||||
async SessionHistoryEntryScrollPosition(MaybeDiscardedBrowsingContext aContext,
|
||||
int32_t aX, int32_t aY);
|
||||
|
||||
async SessionHistoryEntryCacheKey(MaybeDiscardedBrowsingContext aContext,
|
||||
uint32_t aCacheKey);
|
||||
|
|
Загрузка…
Ссылка в новой задаче