Bug 1706616 - Part 1: Add telemetry probe for query stripping. r=dimi,necko-reviewers,dragana

Differential Revision: https://phabricator.services.mozilla.com/D117006
This commit is contained in:
Tim Huang 2021-06-14 19:45:39 +00:00
parent 2dadd43ab1
commit e2b6812898
3 changed files with 29 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#include "mozilla/dom/LoadURIOptionsBinding.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_fission.h"
#include "mozilla/Telemetry.h"
#include "mozilla/URLQueryStringStripper.h"
#include "mozilla/OriginAttributes.h"
@ -601,10 +602,16 @@ void nsDocShellLoadState::MaybeStripTrackerQueryStrings(
return;
}
Telemetry::AccumulateCategorical(
Telemetry::LABELS_QUERY_STRIPPING_COUNT::Navigation);
nsCOMPtr<nsIURI> strippedURI;
if (URLQueryStringStripper::Strip(URI(), strippedURI)) {
mUnstrippedURI = URI();
SetURI(strippedURI);
Telemetry::AccumulateCategorical(
Telemetry::LABELS_QUERY_STRIPPING_COUNT::StripForNavigation);
} 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

View File

@ -5064,6 +5064,9 @@ nsresult nsHttpChannel::AsyncProcessRedirection(uint32_t redirectType) {
&isThirdPartyRedirectURI);
if (isThirdPartyRedirectURI && mLoadInfo->GetExternalContentPolicyType() ==
ExtContentPolicy::TYPE_DOCUMENT) {
Telemetry::AccumulateCategorical(
Telemetry::LABELS_QUERY_STRIPPING_COUNT::Redirect);
nsCOMPtr<nsIPrincipal> prin;
ContentBlockingAllowList::RecomputePrincipal(
mRedirectURI, mLoadInfo->GetOriginAttributes(), getter_AddRefs(prin));
@ -5079,6 +5082,9 @@ nsresult nsHttpChannel::AsyncProcessRedirection(uint32_t redirectType) {
URLQueryStringStripper::Strip(mRedirectURI, strippedURI)) {
mUnstrippedRedirectURI = mRedirectURI;
mRedirectURI = strippedURI;
Telemetry::AccumulateCategorical(
Telemetry::LABELS_QUERY_STRIPPING_COUNT::StripForRedirect);
}
}
}

View File

@ -13002,6 +13002,22 @@
"alert_emails": ["tihuang@mozilla.com", "aedelstein@mozilla.com", "senglehardt@mozilla.com", "seceng-telemetry@mozilla.com"],
"description": "The time remaining until expiration per storage access permissions, in days (one record per permission, not averaged)."
},
"QUERY_STRIPPING_COUNT": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec"],
"expires_in_version": "never",
"releaseChannelCollection": "opt-out",
"kind": "categorical",
"labels": [
"Navigation",
"Redirect",
"StripForNavigation",
"StripForRedirect"
],
"description": "A count of the query stripping. ('Navigation' = There was a top-level loading via navigation, 'Redirect' = There was a top-level loading via redirect, 'StripForNavigation' = There was a stripping happened for a top-level navigation, 'StripForRedirect' = There was a stripping happened for a top-level redirect.",
"alert_emails": ["tihuang@mozilla.com", "aedelstein@mozilla.com", "jhofmann@mozilla.com", "pbz@mozilla.com", "seceng-telemetry@mozilla.com"],
"bug_numbers": [1706616]
},
"SERVICE_WORKER_LAUNCH_TIME": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec"],