Backed out 10 changesets (bug 1581859) for causing hazard failures. CLOSED TREE

Backed out changeset 93fe6801a5e2 (bug 1581859)
Backed out changeset 0a33cb185fb3 (bug 1581859)
Backed out changeset 9ceaad6dab5b (bug 1581859)
Backed out changeset ee611f0839ca (bug 1581859)
Backed out changeset 4199963fe477 (bug 1581859)
Backed out changeset b4c5ace21b9e (bug 1581859)
Backed out changeset 6003469dc449 (bug 1581859)
Backed out changeset 826c62b783c0 (bug 1581859)
Backed out changeset e1d7851295fd (bug 1581859)
Backed out changeset 9796577af27a (bug 1581859)
This commit is contained in:
Csoregi Natalia
2021-03-24 08:48:00 +02:00
parent 0f02bd2182
commit 38f6ebd14b
36 changed files with 649 additions and 1033 deletions

View File

@@ -5349,7 +5349,7 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
* we have in mind (15000 ms as defined by REFRESH_REDIRECT_TIMER).
* Pass a REPLACE flag to LoadURI().
*/
loadState->SetLoadType(LOAD_REFRESH_REPLACE);
loadState->SetLoadType(LOAD_NORMAL_REPLACE);
/* For redirects we mimic HTTP, which passes the
* original referrer.
@@ -5827,7 +5827,6 @@ nsresult nsDocShell::Embed(nsIContentViewer* aContentViewer,
// Determine if this type of load should update history
switch (mLoadType) {
case LOAD_NORMAL_REPLACE:
case LOAD_REFRESH_REPLACE:
case LOAD_STOP_CONTENT_AND_REPLACE:
case LOAD_RELOAD_BYPASS_CACHE:
case LOAD_RELOAD_BYPASS_PROXY:
@@ -8714,6 +8713,7 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
targetContext = newBC;
}
}
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(targetContext, rv);
@@ -8735,27 +8735,6 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
return targetContext->InternalLoad(aLoadState);
}
static nsAutoCString RefMaybeNull(nsIURI* aURI) {
nsAutoCString result;
if (NS_FAILED(aURI->GetRef(result))) {
result.SetIsVoid(true);
}
return result;
}
uint32_t nsDocShell::GetSameDocumentNavigationFlags(nsIURI* aNewURI) {
uint32_t flags = LOCATION_CHANGE_SAME_DOCUMENT;
bool equal = false;
if (mCurrentURI &&
NS_SUCCEEDED(mCurrentURI->EqualsExceptRef(aNewURI, &equal)) && equal &&
RefMaybeNull(mCurrentURI) != RefMaybeNull(aNewURI)) {
flags |= LOCATION_CHANGE_HASHCHANGE;
}
return flags;
}
bool nsDocShell::IsSameDocumentNavigation(nsDocShellLoadState* aLoadState,
SameDocumentNavigationState& aState) {
MOZ_ASSERT(aLoadState);
@@ -8957,10 +8936,6 @@ nsresult nsDocShell::HandleSameDocumentNavigation(
newURIPartitionedPrincipalToInherit = doc->PartitionedPrincipal();
newCsp = doc->GetCsp();
}
uint32_t locationChangeFlags =
GetSameDocumentNavigationFlags(aLoadState->URI());
// 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.
@@ -9148,7 +9123,8 @@ nsresult nsDocShell::HandleSameDocumentNavigation(
}
if (locationChangeNeeded) {
FireOnLocationChange(this, nullptr, aLoadState->URI(), locationChangeFlags);
FireOnLocationChange(this, nullptr, aLoadState->URI(),
LOCATION_CHANGE_SAME_DOCUMENT);
}
/* Restore the original LSHE if we were loading something
@@ -11117,7 +11093,7 @@ bool nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel,
// in session history.
if (!mozilla::SessionHistoryInParent() && rootSH &&
((mLoadType & (LOAD_CMD_HISTORY | LOAD_CMD_RELOAD)) ||
mLoadType == LOAD_NORMAL_REPLACE || mLoadType == LOAD_REFRESH_REPLACE)) {
mLoadType == LOAD_NORMAL_REPLACE)) {
mPreviousEntryIndex = rootSH->Index();
if (!mozilla::SessionHistoryInParent()) {
rootSH->LegacySHistory()->UpdateIndex();
@@ -11542,7 +11518,7 @@ nsresult nsDocShell::UpdateURLAndHistory(Document* aDocument, nsIURI* aNewURI,
aDocument->SetDocumentURI(aNewURI);
SetCurrentURI(aNewURI, nullptr, /* aFireLocationChange */ true,
/* aIsInitialAboutBlank */ false,
GetSameDocumentNavigationFlags(aNewURI));
LOCATION_CHANGE_SAME_DOCUMENT);
AddURIVisit(aNewURI, aCurrentURI, 0);
@@ -12222,23 +12198,22 @@ nsDocShell::MakeEditable(bool aInWaitForUriLoad) {
return;
}
nsresult rv;
nsCOMPtr<nsIURI> uri(do_GetProperty(props, u"docshell.previousURI"_ns, &rv));
if (NS_SUCCEEDED(rv)) {
uri.forget(aURI);
nsresult rv = props->GetPropertyAsInterface(u"docshell.previousURI"_ns,
NS_GET_IID(nsIURI),
reinterpret_cast<void**>(aURI));
if (NS_FAILED(rv)) {
// There is no last visit for this channel, so this must be the first
// link. Link the visit to the referrer of this request, if any.
// Treat referrer as null if there is an error getting it.
(void)NS_GetReferrerFromChannel(aChannel, aURI);
} else {
rv = props->GetPropertyAsUint32(u"docshell.previousFlags"_ns,
aChannelRedirectFlags);
NS_WARNING_ASSERTION(
NS_SUCCEEDED(rv),
"Could not fetch previous flags, URI will be treated like referrer");
} else {
// There is no last visit for this channel, so this must be the first
// link. Link the visit to the referrer of this request, if any.
// Treat referrer as null if there is an error getting it.
NS_GetReferrerFromChannel(aChannel, aURI);
}
}