Bug 1706604 - Part 2: Strip the URI before create the channel in nsDocShell. r=smaug

The target query parameters will be stripped from the loading URI in
nsDocShell before creating the channel for the loading. We will only
strip the URI for top-level loading but not for frames. It's because
there is no need to strip frames if we've stripped in top-level already.

Differential Revision: https://phabricator.services.mozilla.com/D113843
This commit is contained in:
Tim Huang
2021-05-20 11:22:12 +00:00
parent b178a76416
commit 81e8d1b2a5
3 changed files with 41 additions and 0 deletions

View File

@@ -10447,6 +10447,9 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState,
nsLoadFlags loadFlags = aLoadState->CalculateChannelLoadFlags(
mBrowsingContext, Some(uriModified), Some(isXFOError));
// Strip the target query parameters before creating the channel.
aLoadState->MaybeStripTrackerQueryStrings(mBrowsingContext);
nsCOMPtr<nsIChannel> channel;
if (DocumentChannel::CanUseDocumentChannel(aLoadState->URI())) {
channel = DocumentChannel::CreateForDocument(aLoadState, loadInfo,