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-11 07:28:15 +00:00
Родитель 1a1f42da37
Коммит eb7947462a
3 изменённых файлов: 29 добавлений и 0 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -5065,6 +5065,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));
@ -5080,6 +5083,9 @@ nsresult nsHttpChannel::AsyncProcessRedirection(uint32_t redirectType) {
URLQueryStringStripper::Strip(mRedirectURI, strippedURI)) {
mUnstrippedRedirectURI = mRedirectURI;
mRedirectURI = strippedURI;
Telemetry::AccumulateCategorical(
Telemetry::LABELS_QUERY_STRIPPING_COUNT::StripForRedirect);
}
}
}

Просмотреть файл

@ -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"],