Bug 1721217 - Part 5: Change the error code when we cancel loads due to another one starting, r=nika

This allows us to move away from using IsNavigating field in parent-controlled
paths.  Use a new distinct error code in cases when we cancel loads in
Canonical BC due to another load starting. This way, we know to not reset the
urlbar if we are doing another load.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1721217#c10 for longer
explanation of what is going on here.

Differential Revision: https://phabricator.services.mozilla.com/D126845
This commit is contained in:
Anny Gakhokidze
2021-11-25 20:40:58 +00:00
parent 03175760b4
commit a81e51b3a2
6 changed files with 270 additions and 7 deletions

View File

@@ -1293,7 +1293,7 @@ void CanonicalBrowsingContext::GoBack(
// Stop any known network loads if necessary.
if (mCurrentLoad) {
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD);
}
if (nsDocShell* docShell = nsDocShell::Cast(GetDocShell())) {
@@ -1319,7 +1319,7 @@ void CanonicalBrowsingContext::GoForward(
// Stop any known network loads if necessary.
if (mCurrentLoad) {
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD);
}
if (auto* docShell = nsDocShell::Cast(GetDocShell())) {
@@ -1345,7 +1345,7 @@ void CanonicalBrowsingContext::GoToIndex(
// Stop any known network loads if necessary.
if (mCurrentLoad) {
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD);
}
if (auto* docShell = nsDocShell::Cast(GetDocShell())) {
@@ -1369,7 +1369,7 @@ void CanonicalBrowsingContext::Reload(uint32_t aReloadFlags) {
// Stop any known network loads if necessary.
if (mCurrentLoad) {
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD);
}
if (auto* docShell = nsDocShell::Cast(GetDocShell())) {
@@ -2084,7 +2084,7 @@ bool CanonicalBrowsingContext::StartDocumentLoad(
// that we need to cancel any existing ones.
if (StaticPrefs::browser_tabs_documentchannel_parent_controlled() &&
mozilla::SessionHistoryInParent() && mCurrentLoad) {
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD);
}
mCurrentLoad = aLoad;