Bug 1357386: Gather telemetry for toplevel data: URI loads. r=dveditz,francois

This commit is contained in:
Christoph Kerschbaumer 2017-05-31 20:24:17 +02:00
Родитель 0bd0cd9cd7
Коммит d0c653622f
2 изменённых файлов: 31 добавлений и 0 удалений

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

@ -11018,6 +11018,28 @@ nsDocShell::DoURILoad(nsIURI* aURI,
new LoadInfo(loadingPrincipal, aTriggeringPrincipal, loadingNode,
securityFlags, aContentPolicyType);
if (aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT) {
enum TopLevelDataState {
DATA_NAVIGATED = 0,
DATA_TYPED = 1,
NO_DATA = 2,
};
bool isDataURI = (NS_SUCCEEDED(aURI->SchemeIs("data", &isDataURI)) && isDataURI);
if (isDataURI) {
// In all cases where the toplevel document is navigated to a data: URI
// the triggeringPrincipal is a CodeBasePrincipal. In all other cases
// e.g. typing a data: URL into the URL-Bar or also clicking a bookmark
// uses a SystemPrincipal as the triggeringPrincipal.
if (aTriggeringPrincipal->GetIsCodebasePrincipal()) {
Telemetry::Accumulate(Telemetry::DOCUMENT_DATA_URI_LOADS, DATA_NAVIGATED);
} else {
Telemetry::Accumulate(Telemetry::DOCUMENT_DATA_URI_LOADS, DATA_TYPED);
}
} else {
Telemetry::Accumulate(Telemetry::DOCUMENT_DATA_URI_LOADS, NO_DATA);
}
}
if (aPrincipalToInherit) {
loadInfo->SetPrincipalToInherit(aPrincipalToInherit);
}

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

@ -13173,6 +13173,15 @@
"bug_numbers": [1351021],
"description": "Every time we run an unlabeled runnable, this histogram records the time (in ms) since the last unlabeled runnable ran."
},
"DOCUMENT_DATA_URI_LOADS": {
"record_in_processes": ["main", "content"],
"alert_emails": ["seceng-telemetry@mozilla.com"],
"bug_numbers": [1357386],
"expires_in_version": "60",
"kind": "enumerated",
"n_values": 3,
"description": "Whether a toplevel document uses data: URI? (0=data-navigated, 1=data-typed, 2=nodata)"
},
"VFC_INVALIDATE_LOCK_WAIT_MS": {
"record_in_processes": ["main", "content"],
"alert_emails": ["jwwang@mozilla.com"],