Bug 1670098 - location.replace should do a proper replace for same document navigations, r=peterv

With this change SHIP seems to also fix an issue with hashchange event - those are triggered now
more consistently than without SHIP.

Differential Revision: https://phabricator.services.mozilla.com/D92993
This commit is contained in:
Olli Pettay 2020-10-09 19:20:07 +00:00
parent 5a6250bf22
commit ab91a68474
4 changed files with 17 additions and 10 deletions

View File

@ -2730,6 +2730,7 @@ void BrowsingContext::SetActiveSessionHistoryEntry(
const Maybe<nsPoint>& aPreviousScrollPos, SessionHistoryInfo* aInfo,
uint32_t aLoadType, int32_t aChildOffset, uint32_t aUpdatedCacheKey) {
if (XRE_IsContentProcess()) {
// XXX Why we update cache key only in content process case?
if (aUpdatedCacheKey != 0) {
aInfo->SetCacheKey(aUpdatedCacheKey);
}

View File

@ -8955,12 +8955,16 @@ nsresult nsDocShell::HandleSameDocumentNavigation(
scrollRestorationIsManual.value());
}
// FIXME We should probably just compute mChildOffset in the parent
// instead of passing it over IPC here.
mBrowsingContext->SetActiveSessionHistoryEntry(
Some(scrollPos), mActiveEntry.get(), mLoadType, mChildOffset,
cacheKey);
// FIXME Do we need to update mPreviousEntryIndex and mLoadedEntryIndex?
if (LOAD_TYPE_HAS_FLAGS(mLoadType, LOAD_FLAGS_REPLACE_HISTORY)) {
mBrowsingContext->ReplaceActiveSessionHistoryEntry(mActiveEntry.get());
} else {
// FIXME We should probably just compute mChildOffset in the parent
// instead of passing it over IPC here.
mBrowsingContext->SetActiveSessionHistoryEntry(
Some(scrollPos), mActiveEntry.get(), mLoadType, mChildOffset,
cacheKey);
// FIXME Do we need to update mPreviousEntryIndex and mLoadedEntryIndex?
}
}
}

View File

@ -1,5 +1,9 @@
[forward-triggers-hashchange.html]
expected: TIMEOUT
expected:
if fission: OK
TIMEOUT
[Navigating forward after replace() should still trigger hashchange]
expected: TIMEOUT
expected:
if fission: PASS
TIMEOUT

View File

@ -1,6 +1,4 @@
[replacement-enabled.html]
disabled:
if fission: https://bugzilla.mozilla.org/show_bug.cgi?id=1656208
[Navigating to a fragment should not clear forward history]
expected:
if webrender and debug and (os == "linux") and not fission: ["PASS", "FAIL"]