Bug 1707138 - Don't send session store updates after we start process switching, r=farre

Differential Revision: https://phabricator.services.mozilla.com/D115015
This commit is contained in:
Anny Gakhokidze
2021-05-18 20:01:55 +00:00
parent f75bf1b62b
commit c8002511a8
2 changed files with 16 additions and 3 deletions

View File

@@ -6554,6 +6554,7 @@ nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
// Test whether this is the top frame or a subframe
bool isTopFrame = mBrowsingContext->IsTop();
bool hadErrorStatus = false;
// If status code indicates an error it means that DocumentChannel already
// tried to fixup the uri and failed. Throw an error dialog box here.
if (NS_FAILED(aStatus)) {
@@ -6574,6 +6575,7 @@ nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
mBrowsingContext->GetUseErrorPages(),
isInitialDocument,
&skippedUnknownProtocolNavigation);
hadErrorStatus = true;
if (NS_FAILED(aStatus)) {
if (!mIsBeingDestroyed) {
DisplayLoadError(aStatus, url, nullptr, aChannel);
@@ -6595,6 +6597,12 @@ nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
PredictorLearnRedirect(url, aChannel, loadInfo->GetOriginAttributes());
}
if (hadErrorStatus) {
// Don't send session store updates if the reason EndPageLoad was called is
// because we are process switching. Sometimes the update takes too long and
// incorrectly overrides session store data from the following load.
return NS_OK;
}
if constexpr (SessionStoreUtils::NATIVE_LISTENER) {
if (Document* document = GetDocument()) {
if (WindowGlobalChild* windowChild = document->GetWindowGlobalChild()) {