Bug 1668126: Correct ordering of LocationChange and history index/length commit for SHIP r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D91848
This commit is contained in:
Randell Jesup
2020-09-30 17:52:59 +00:00
parent c3fd30d6fb
commit a2265185b1

View File

@@ -3291,6 +3291,9 @@ nsDocShell::GetCanGoBack(bool* aCanGoBack) {
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
if (rootSH) {
*aCanGoBack = rootSH->CanGo(-1);
MOZ_LOG(gSHLog, LogLevel::Verbose,
("nsDocShell %p CanGoBack()->%d", this, *aCanGoBack));
return NS_OK;
}
return NS_ERROR_FAILURE;
@@ -3305,6 +3308,8 @@ nsDocShell::GetCanGoForward(bool* aCanGoForward) {
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
if (rootSH) {
*aCanGoForward = rootSH->CanGo(1);
MOZ_LOG(gSHLog, LogLevel::Verbose,
("nsDocShell %p CanGoForward()->%d", this, *aCanGoForward));
return NS_OK;
}
return NS_ERROR_FAILURE;
@@ -8780,18 +8785,6 @@ nsresult nsDocShell::HandleSameDocumentNavigation(
newURIPartitionedPrincipalToInherit = doc->PartitionedPrincipal();
newCsp = doc->GetCsp();
}
// Pass true for aCloneSHChildren, since we're not
// changing documents here, so all of our subframes are
// still relevant to the new session history entry.
//
// It also makes OnNewURI(...) set LOCATION_CHANGE_SAME_DOCUMENT
// flag on firing onLocationChange(...).
// Anyway, aCloneSHChildren param is simply reflecting
// doSameDocumentNavigation in this scope.
OnNewURI(aLoadState->URI(), nullptr, newURITriggeringPrincipal,
newURIPrincipalToInherit, newURIPartitionedPrincipalToInherit,
newCsp, true, true, true);
nsCOMPtr<nsIInputStream> postData;
uint32_t cacheKey = 0;
@@ -8966,6 +8959,18 @@ nsresult nsDocShell::HandleSameDocumentNavigation(
}
}
// Pass true for aCloneSHChildren, since we're not
// changing documents here, so all of our subframes are
// still relevant to the new session history entry.
//
// It also makes OnNewURI(...) set LOCATION_CHANGE_SAME_DOCUMENT
// flag on firing onLocationChange(...).
// Anyway, aCloneSHChildren param is simply reflecting
// doSameDocumentNavigation in this scope.
OnNewURI(aLoadState->URI(), nullptr, newURITriggeringPrincipal,
newURIPrincipalToInherit, newURIPartitionedPrincipalToInherit,
newCsp, true, true, true);
/* Restore the original LSHE if we were loading something
* while same document navigation was initiated.
*/