Bug 1742865 - Handle meta refresh correctly with session history in the parent. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D132837
This commit is contained in:
Peter Van der Beken
2021-12-14 10:13:58 +00:00
parent 2a0421d5e6
commit 3303fb66bd
9 changed files with 258 additions and 13 deletions

View File

@@ -797,7 +797,6 @@ void CanonicalBrowsingContext::SessionHistoryCommit(
RemoveDynEntriesFromActiveSessionHistoryEntry();
}
}
mActiveEntry = newActiveEntry;
if (LOAD_TYPE_HAS_FLAGS(aLoadType,
nsIWebNavigation::LOAD_FLAGS_REPLACE_HISTORY)) {
@@ -808,8 +807,16 @@ void CanonicalBrowsingContext::SessionHistoryCommit(
// should append instead.
addEntry = index < 0;
if (!addEntry) {
shistory->ReplaceEntry(index, mActiveEntry);
shistory->ReplaceEntry(index, newActiveEntry);
}
mActiveEntry = newActiveEntry;
} else if (LOAD_TYPE_HAS_FLAGS(
aLoadType, nsIWebNavigation::LOAD_FLAGS_IS_REFRESH) &&
!ShouldAddEntryForRefresh(newActiveEntry)) {
addEntry = false;
mActiveEntry->ReplaceWith(*newActiveEntry);
} else {
mActiveEntry = newActiveEntry;
}
if (loadFromSessionHistory) {
@@ -841,7 +848,10 @@ void CanonicalBrowsingContext::SessionHistoryCommit(
} else if (addEntry) {
if (mActiveEntry) {
if (LOAD_TYPE_HAS_FLAGS(
aLoadType, nsIWebNavigation::LOAD_FLAGS_REPLACE_HISTORY)) {
aLoadType, nsIWebNavigation::LOAD_FLAGS_REPLACE_HISTORY) ||
(LOAD_TYPE_HAS_FLAGS(aLoadType,
nsIWebNavigation::LOAD_FLAGS_IS_REFRESH) &&
!ShouldAddEntryForRefresh(newActiveEntry))) {
// FIXME We need to make sure that when we create the info we
// make a copy of the shared state.
mActiveEntry->ReplaceWith(*newActiveEntry);