Backed out changeset 2c479e5f52df (bug 1798986) for causing failures on browser_urlQueryStringStripping_telemetry.js. CLOSED TREE

This commit is contained in:
Csoregi Natalia
2022-11-14 20:51:27 +02:00
parent 7045d63156
commit 17a6c794ec
9 changed files with 49 additions and 90 deletions

View File

@@ -9870,9 +9870,6 @@ nsIPrincipal* nsDocShell::GetInheritedPrincipal(
isSrcdoc);
}
// Strip the target query parameters before creating the channel.
aLoadState->MaybeStripTrackerQueryStrings(aBrowsingContext);
OriginAttributes attrs;
// Inherit origin attributes from PrincipalToInherit if inheritAttrs is
@@ -10543,6 +10540,19 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState,
nsLoadFlags loadFlags = aLoadState->CalculateChannelLoadFlags(
mBrowsingContext, Some(uriModified), Some(isXFOError));
// Get the unstripped URI from the current document channel. The unstripped
// URI will be preserved if it's a reload.
nsCOMPtr<nsIURI> currentUnstrippedURI;
nsCOMPtr<nsIChannel> docChannel = GetCurrentDocChannel();
if (docChannel) {
nsCOMPtr<nsILoadInfo> docLoadInfo = docChannel->LoadInfo();
docLoadInfo->GetUnstrippedURI(getter_AddRefs(currentUnstrippedURI));
}
// Strip the target query parameters before creating the channel.
aLoadState->MaybeStripTrackerQueryStrings(mBrowsingContext,
currentUnstrippedURI);
nsCOMPtr<nsIChannel> channel;
if (DocumentChannel::CanUseDocumentChannel(aLoadState->URI()) &&
!isAboutBlankLoadOntoInitialAboutBlank) {
@@ -11561,9 +11571,6 @@ nsresult nsDocShell::UpdateURLAndHistory(Document* aDocument, nsIURI* aNewURI,
newSHEntry->SetURI(aNewURI);
newSHEntry->SetOriginalURI(aNewURI);
// We replaced the URI of the entry, clear the unstripped URI as it
// shouldn't be used for reloads anymore.
newSHEntry->SetUnstrippedURI(nullptr);
// Setting the resultPrincipalURI to nullptr is fine here: it will cause
// NS_GetFinalChannelURI to use the originalURI as the URI, which is aNewURI
// in our case. We could also set it to aNewURI, with the same result.
@@ -11791,7 +11798,6 @@ nsresult nsDocShell::AddToSessionHistory(
nsCOMPtr<nsIInputStream> inputStream;
nsCOMPtr<nsIURI> originalURI;
nsCOMPtr<nsIURI> resultPrincipalURI;
nsCOMPtr<nsIURI> unstrippedURI;
bool loadReplace = false;
nsCOMPtr<nsIReferrerInfo> referrerInfo;
uint32_t cacheKey = 0;
@@ -11845,8 +11851,6 @@ nsresult nsDocShell::AddToSessionHistory(
loadInfo->GetResultPrincipalURI(getter_AddRefs(resultPrincipalURI));
loadInfo->GetUnstrippedURI(getter_AddRefs(unstrippedURI));
userActivation = loadInfo->GetHasValidUserGestureActivation();
// For now keep storing just the principal in the SHEntry.
@@ -11916,9 +11920,8 @@ nsresult nsDocShell::AddToSessionHistory(
triggeringPrincipal, // Channel or provided principal
principalToInherit, partitionedPrincipalToInherit, csp,
HistoryID(), GetCreatedDynamically(), originalURI,
resultPrincipalURI, unstrippedURI, loadReplace, referrerInfo,
srcdoc, srcdocEntry, baseURI, saveLayoutState, expired,
userActivation);
resultPrincipalURI, loadReplace, referrerInfo, srcdoc,
srcdocEntry, baseURI, saveLayoutState, expired, userActivation);
if (mBrowsingContext->IsTop() && GetSessionHistory()) {
bool shouldPersist = ShouldAddToSessionHistory(aURI, aChannel);
@@ -12003,7 +12006,6 @@ void nsDocShell::UpdateActiveEntry(
aURI, aTriggeringPrincipal, nullptr, nullptr, aCsp, mContentTypeHint);
}
mActiveEntry->SetOriginalURI(aOriginalURI);
mActiveEntry->SetUnstrippedURI(nullptr);
mActiveEntry->SetReferrerInfo(aReferrerInfo);
mActiveEntry->SetTitle(aTitle);
mActiveEntry->SetStateData(static_cast<nsStructuredCloneContainer*>(aData));