Bug 1706615 - Part 8: Preserve the unstripped URI when doing a reload. r=smaug
To restore the stripped query parameters when ETP toggle has been set to off, we preserve the current unstripped URI to the new loadState when doing a reload. By doing this, it will redirect the channel back to the unstripped URI because the loading channel is in the content blocking allow list and it has a unstripped URI in its loadInfo. Differential Revision: https://phabricator.services.mozilla.com/D116116
This commit is contained in:
@@ -10451,8 +10451,18 @@ 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);
|
||||
aLoadState->MaybeStripTrackerQueryStrings(mBrowsingContext,
|
||||
currentUnstrippedURI);
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
if (DocumentChannel::CanUseDocumentChannel(aLoadState->URI())) {
|
||||
|
||||
Reference in New Issue
Block a user