зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 2c479e5f52df (bug 1798986) for causing failures on browser_urlQueryStringStripping_telemetry.js. CLOSED TREE
This commit is contained in:
Родитель
21771ec470
Коммит
1107d2eb9a
|
@ -2073,6 +2073,10 @@ nsresult BrowsingContext::LoadURI(nsDocShellLoadState* aLoadState,
|
|||
wgc->SendLoadURI(this, aLoadState, aSetNavigating);
|
||||
}
|
||||
} else if (XRE_IsParentProcess()) {
|
||||
// Strip the target query parameters before loading the URI in the parent.
|
||||
// The loading in content will be handled in nsDocShell.
|
||||
aLoadState->MaybeStripTrackerQueryStrings(this);
|
||||
|
||||
if (Canonical()->LoadInParent(aLoadState, aSetNavigating)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -578,7 +578,7 @@ bool nsDocShellLoadState::LoadIsFromSessionHistory() const {
|
|||
}
|
||||
|
||||
void nsDocShellLoadState::MaybeStripTrackerQueryStrings(
|
||||
BrowsingContext* aContext) {
|
||||
BrowsingContext* aContext, nsIURI* aCurrentUnstrippedURI) {
|
||||
MOZ_ASSERT(aContext);
|
||||
|
||||
// Return early if the triggering principal doesn't exist. This could happen
|
||||
|
@ -619,14 +619,17 @@ void nsDocShellLoadState::MaybeStripTrackerQueryStrings(
|
|||
uint32_t numStripped = URLQueryStringStripper::Strip(
|
||||
URI(), aContext->UsePrivateBrowsing(), strippedURI);
|
||||
if (numStripped) {
|
||||
if (!mUnstrippedURI) {
|
||||
mUnstrippedURI = URI();
|
||||
}
|
||||
mUnstrippedURI = URI();
|
||||
SetURI(strippedURI);
|
||||
|
||||
Telemetry::AccumulateCategorical(
|
||||
Telemetry::LABELS_QUERY_STRIPPING_COUNT::StripForNavigation);
|
||||
Telemetry::Accumulate(Telemetry::QUERY_STRIPPING_PARAM_COUNT, numStripped);
|
||||
} else if (LoadType() & nsIDocShell::LOAD_CMD_RELOAD) {
|
||||
// Preserve the Unstripped URI if it's a reload. By doing this, we can
|
||||
// restore the stripped query parameters once the ETP has been toggled to
|
||||
// off.
|
||||
mUnstrippedURI = aCurrentUnstrippedURI;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -1073,7 +1076,3 @@ DocShellLoadStateInit nsDocShellLoadState::Serialize() {
|
|||
}
|
||||
|
||||
nsIURI* nsDocShellLoadState::GetUnstrippedURI() const { return mUnstrippedURI; }
|
||||
|
||||
void nsDocShellLoadState::SetUnstrippedURI(nsIURI* aUnstrippedURI) {
|
||||
mUnstrippedURI = aUnstrippedURI;
|
||||
}
|
||||
|
|
|
@ -249,8 +249,6 @@ class nsDocShellLoadState final {
|
|||
|
||||
nsIURI* GetUnstrippedURI() const;
|
||||
|
||||
void SetUnstrippedURI(nsIURI* aUnstrippedURI);
|
||||
|
||||
// Give the type of DocShell we're loading into (chrome/content/etc) and
|
||||
// origin attributes for the URI we're loading, figure out if we should
|
||||
// inherit our principal from the document the load was requested from, or
|
||||
|
@ -331,7 +329,8 @@ class nsDocShellLoadState final {
|
|||
void SetLoadIsFromSessionHistory(int32_t aOffset, bool aLoadingCurrentEntry);
|
||||
void ClearLoadIsFromSessionHistory();
|
||||
|
||||
void MaybeStripTrackerQueryStrings(mozilla::dom::BrowsingContext* aContext);
|
||||
void MaybeStripTrackerQueryStrings(mozilla::dom::BrowsingContext* aContext,
|
||||
nsIURI* aCurrentUnstrippedURI = nullptr);
|
||||
|
||||
protected:
|
||||
// Destructor can't be defaulted or inlined, as header doesn't have all type
|
||||
|
|
|
@ -45,7 +45,6 @@ SessionHistoryInfo::SessionHistoryInfo(nsDocShellLoadState* aLoadState,
|
|||
: mURI(aLoadState->URI()),
|
||||
mOriginalURI(aLoadState->OriginalURI()),
|
||||
mResultPrincipalURI(aLoadState->ResultPrincipalURI()),
|
||||
mUnstrippedURI(aLoadState->GetUnstrippedURI()),
|
||||
mLoadType(aLoadState->LoadType()),
|
||||
mSrcdocData(aLoadState->SrcdocData().IsVoid()
|
||||
? Nothing()
|
||||
|
@ -104,7 +103,6 @@ SessionHistoryInfo::SessionHistoryInfo(
|
|||
aChannel->GetLoadInfo(getter_AddRefs(loadInfo));
|
||||
|
||||
loadInfo->GetResultPrincipalURI(getter_AddRefs(mResultPrincipalURI));
|
||||
loadInfo->GetUnstrippedURI(getter_AddRefs(mUnstrippedURI));
|
||||
loadInfo->GetTriggeringPrincipal(
|
||||
getter_AddRefs(mSharedState.Get()->mTriggeringPrincipal));
|
||||
loadInfo->GetPrincipalToInherit(
|
||||
|
@ -137,7 +135,6 @@ void SessionHistoryInfo::Reset(nsIURI* aURI, const nsID& aDocShellID,
|
|||
mURI = aURI;
|
||||
mOriginalURI = nullptr;
|
||||
mResultPrincipalURI = nullptr;
|
||||
mUnstrippedURI = nullptr;
|
||||
mReferrerInfo = nullptr;
|
||||
// Default title is the URL.
|
||||
nsAutoCString spec;
|
||||
|
@ -248,7 +245,6 @@ void SessionHistoryInfo::SetSaveLayoutStateFlag(bool aSaveLayoutStateFlag) {
|
|||
void SessionHistoryInfo::FillLoadInfo(nsDocShellLoadState& aLoadState) const {
|
||||
aLoadState.SetOriginalURI(mOriginalURI);
|
||||
aLoadState.SetMaybeResultPrincipalURI(Some(mResultPrincipalURI));
|
||||
aLoadState.SetUnstrippedURI(mUnstrippedURI);
|
||||
aLoadState.SetLoadReplace(mLoadReplace);
|
||||
nsCOMPtr<nsIInputStream> postData = GetPostData();
|
||||
aLoadState.SetPostDataStream(postData);
|
||||
|
@ -532,19 +528,6 @@ SessionHistoryEntry::SetResultPrincipalURI(nsIURI* aResultPrincipalURI) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SessionHistoryEntry::GetUnstrippedURI(nsIURI** aUnstrippedURI) {
|
||||
nsCOMPtr<nsIURI> unstrippedURI = mInfo->mUnstrippedURI;
|
||||
unstrippedURI.forget(aUnstrippedURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SessionHistoryEntry::SetUnstrippedURI(nsIURI* aUnstrippedURI) {
|
||||
mInfo->mUnstrippedURI = aUnstrippedURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SessionHistoryEntry::GetLoadReplace(bool* aLoadReplace) {
|
||||
*aLoadReplace = mInfo->mLoadReplace;
|
||||
|
@ -1066,9 +1049,9 @@ SessionHistoryEntry::Create(
|
|||
nsIPrincipal* aPartitionedPrincipalToInherit,
|
||||
nsIContentSecurityPolicy* aCsp, const nsID& aDocshellID,
|
||||
bool aDynamicCreation, nsIURI* aOriginalURI, nsIURI* aResultPrincipalURI,
|
||||
nsIURI* aUnstrippedURI, bool aLoadReplace, nsIReferrerInfo* aReferrerInfo,
|
||||
const nsAString& aSrcdoc, bool aSrcdocEntry, nsIURI* aBaseURI,
|
||||
bool aSaveLayoutState, bool aExpired, bool aUserActivation) {
|
||||
bool aLoadReplace, nsIReferrerInfo* aReferrerInfo, const nsAString& aSrcdoc,
|
||||
bool aSrcdocEntry, nsIURI* aBaseURI, bool aSaveLayoutState, bool aExpired,
|
||||
bool aUserActivation) {
|
||||
MOZ_CRASH("Might need to implement this");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -1530,7 +1513,6 @@ void IPDLParamTraits<dom::SessionHistoryInfo>::Write(
|
|||
WriteIPDLParam(aWriter, aActor, aParam.mURI);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mOriginalURI);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mResultPrincipalURI);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mUnstrippedURI);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mReferrerInfo);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mTitle);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mName);
|
||||
|
@ -1572,7 +1554,6 @@ bool IPDLParamTraits<dom::SessionHistoryInfo>::Read(
|
|||
if (!ReadIPDLParam(aReader, aActor, &aResult->mURI) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mOriginalURI) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mResultPrincipalURI) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mUnstrippedURI) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mReferrerInfo) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mTitle) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mName) ||
|
||||
|
|
|
@ -67,11 +67,6 @@ class SessionHistoryInfo {
|
|||
|
||||
void SetOriginalURI(nsIURI* aOriginalURI) { mOriginalURI = aOriginalURI; }
|
||||
|
||||
nsIURI* GetUnstrippedURI() const { return mUnstrippedURI; }
|
||||
void SetUnstrippedURI(nsIURI* aUnstrippedURI) {
|
||||
mUnstrippedURI = aUnstrippedURI;
|
||||
}
|
||||
|
||||
void SetResultPrincipalURI(nsIURI* aResultPrincipalURI) {
|
||||
mResultPrincipalURI = aResultPrincipalURI;
|
||||
}
|
||||
|
@ -165,7 +160,6 @@ class SessionHistoryInfo {
|
|||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
nsCOMPtr<nsIURI> mResultPrincipalURI;
|
||||
nsCOMPtr<nsIURI> mUnstrippedURI;
|
||||
nsCOMPtr<nsIReferrerInfo> mReferrerInfo;
|
||||
nsString mTitle;
|
||||
nsString mName;
|
||||
|
|
|
@ -65,11 +65,6 @@ interface nsISHEntry : nsISupports
|
|||
*/
|
||||
[infallible] attribute nsIURI resultPrincipalURI;
|
||||
|
||||
/**
|
||||
* If non-null, the URI as it was before query stripping was performed.
|
||||
*/
|
||||
[infallible] attribute nsIURI unstrippedURI;
|
||||
|
||||
/**
|
||||
* This flag remembers whether channel has LOAD_REPLACE set.
|
||||
*/
|
||||
|
@ -329,7 +324,6 @@ interface nsISHEntry : nsISupports
|
|||
in boolean dynamicCreation,
|
||||
in nsIURI originalURI,
|
||||
in nsIURI resultPrincipalURI,
|
||||
in nsIURI unstrippedURI,
|
||||
in bool loadReplace,
|
||||
in nsIReferrerInfo referrerInfo,
|
||||
in AString srcdoc,
|
||||
|
|
|
@ -51,14 +51,16 @@ nsSHEntry::nsSHEntry(const nsSHEntry& aOther)
|
|||
mURI(aOther.mURI),
|
||||
mOriginalURI(aOther.mOriginalURI),
|
||||
mResultPrincipalURI(aOther.mResultPrincipalURI),
|
||||
mUnstrippedURI(aOther.mUnstrippedURI),
|
||||
mReferrerInfo(aOther.mReferrerInfo),
|
||||
mTitle(aOther.mTitle),
|
||||
mPostData(aOther.mPostData),
|
||||
mLoadType(0), // XXX why not copy?
|
||||
mLoadType(0) // XXX why not copy?
|
||||
,
|
||||
mID(aOther.mID),
|
||||
mScrollPositionX(0), // XXX why not copy?
|
||||
mScrollPositionY(0), // XXX why not copy?
|
||||
mScrollPositionX(0) // XXX why not copy?
|
||||
,
|
||||
mScrollPositionY(0) // XXX why not copy?
|
||||
,
|
||||
mParent(aOther.mParent),
|
||||
mStateData(aOther.mStateData),
|
||||
mSrcdocData(aOther.mSrcdocData),
|
||||
|
@ -148,19 +150,6 @@ nsSHEntry::SetResultPrincipalURI(nsIURI* aResultPrincipalURI) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetUnstrippedURI(nsIURI** aUnstrippedURI) {
|
||||
*aUnstrippedURI = mUnstrippedURI;
|
||||
NS_IF_ADDREF(*aUnstrippedURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetUnstrippedURI(nsIURI* aUnstrippedURI) {
|
||||
mUnstrippedURI = aUnstrippedURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetLoadReplace(bool* aLoadReplace) {
|
||||
*aLoadReplace = mLoadReplace;
|
||||
|
@ -374,16 +363,18 @@ nsSHEntry::SetContentType(const nsACString& aContentType) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::Create(
|
||||
nsIURI* aURI, const nsAString& aTitle, nsIInputStream* aInputStream,
|
||||
uint32_t aCacheKey, const nsACString& aContentType,
|
||||
nsIPrincipal* aTriggeringPrincipal, nsIPrincipal* aPrincipalToInherit,
|
||||
nsIPrincipal* aPartitionedPrincipalToInherit,
|
||||
nsIContentSecurityPolicy* aCsp, const nsID& aDocShellID,
|
||||
bool aDynamicCreation, nsIURI* aOriginalURI, nsIURI* aResultPrincipalURI,
|
||||
nsIURI* aUnstrippedURI, bool aLoadReplace, nsIReferrerInfo* aReferrerInfo,
|
||||
const nsAString& aSrcdocData, bool aSrcdocEntry, nsIURI* aBaseURI,
|
||||
bool aSaveLayoutState, bool aExpired, bool aUserActivation) {
|
||||
nsSHEntry::Create(nsIURI* aURI, const nsAString& aTitle,
|
||||
nsIInputStream* aInputStream, uint32_t aCacheKey,
|
||||
const nsACString& aContentType,
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
nsIPrincipal* aPrincipalToInherit,
|
||||
nsIPrincipal* aPartitionedPrincipalToInherit,
|
||||
nsIContentSecurityPolicy* aCsp, const nsID& aDocShellID,
|
||||
bool aDynamicCreation, nsIURI* aOriginalURI,
|
||||
nsIURI* aResultPrincipalURI, bool aLoadReplace,
|
||||
nsIReferrerInfo* aReferrerInfo, const nsAString& aSrcdocData,
|
||||
bool aSrcdocEntry, nsIURI* aBaseURI, bool aSaveLayoutState,
|
||||
bool aExpired, bool aUserActivation) {
|
||||
MOZ_ASSERT(
|
||||
aTriggeringPrincipal,
|
||||
"need a valid triggeringPrincipal to create a session history entry");
|
||||
|
@ -422,7 +413,6 @@ nsSHEntry::Create(
|
|||
|
||||
mOriginalURI = aOriginalURI;
|
||||
mResultPrincipalURI = aResultPrincipalURI;
|
||||
mUnstrippedURI = aUnstrippedURI;
|
||||
mLoadReplace = aLoadReplace;
|
||||
mReferrerInfo = aReferrerInfo;
|
||||
|
||||
|
@ -903,9 +893,6 @@ nsSHEntry::CreateLoadInfo(nsDocShellLoadState** aLoadState) {
|
|||
emplacedResultPrincipalURI.emplace(std::move(resultPrincipalURI));
|
||||
loadState->SetMaybeResultPrincipalURI(emplacedResultPrincipalURI);
|
||||
|
||||
nsCOMPtr<nsIURI> unstrippedURI = GetUnstrippedURI();
|
||||
loadState->SetUnstrippedURI(unstrippedURI);
|
||||
|
||||
loadState->SetLoadReplace(GetLoadReplace());
|
||||
nsCOMPtr<nsIInputStream> postData = GetPostData();
|
||||
loadState->SetPostDataStream(postData);
|
||||
|
|
|
@ -45,7 +45,6 @@ class nsSHEntry : public nsISHEntry {
|
|||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
nsCOMPtr<nsIURI> mResultPrincipalURI;
|
||||
nsCOMPtr<nsIURI> mUnstrippedURI;
|
||||
nsCOMPtr<nsIReferrerInfo> mReferrerInfo;
|
||||
nsString mTitle;
|
||||
nsString mName;
|
||||
|
|
Загрузка…
Ссылка в новой задаче