Bug 1702248 - Limit encoding detection outcome telemetry to top level and to text/html and text/plain. r=emk

Differential Revision: https://phabricator.services.mozilla.com/D110902
This commit is contained in:
Henri Sivonen 2021-04-07 06:05:57 +00:00
Родитель b63b46f586
Коммит 29b3230825
2 изменённых файлов: 18 добавлений и 3 удалений

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

@ -210,9 +210,24 @@ nsHtml5TreeOpExecutor::DidBuildModel(bool aTerminated) {
if (mStarted) {
mDocument->EndLoad();
// Gather telemetry only for top-level content navigations in order to
// avoid noise from ad iframes.
bool topLevel = false;
if (BrowsingContext* bc = mDocument->GetBrowsingContext()) {
topLevel = bc->IsTopContent();
}
// Gather telemetry only for text/html and text/plain (excluding CSS, JS,
// etc. being viewed as text.)
nsAutoString contentType;
mDocument->GetContentType(contentType);
bool htmlOrPlain = contentType.EqualsLiteral(u"text/html") ||
contentType.EqualsLiteral(u"text/plain");
// Gather chardetng telemetry
MOZ_ASSERT(mDocument->IsHTMLDocument());
if (!aTerminated && !mDocument->AsHTMLDocument()->IsViewSource()) {
if (htmlOrPlain && topLevel && !aTerminated &&
!mDocument->AsHTMLDocument()->IsViewSource()) {
// We deliberately measure only normally-completed (non-aborted) loads
// that are not View Source loads. This seems like a better place for
// checking normal completion than anything in nsHtml5StreamParser.

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

@ -8533,7 +8533,7 @@
"record_in_processes": ["main", "content"],
"products": ["firefox"],
"alert_emails": ["hsivonen@mozilla.com"],
"bug_numbers": [1686463],
"bug_numbers": [1686463, 1702248],
"expires_in_version": "91",
"releaseChannelCollection": "opt-out",
"kind": "categorical",
@ -8544,7 +8544,7 @@
"record_in_processes": ["main", "content"],
"products": ["firefox"],
"alert_emails": ["hsivonen@mozilla.com"],
"bug_numbers": [1686463],
"bug_numbers": [1686463, 1702248],
"expires_in_version": "91",
"releaseChannelCollection": "opt-out",
"kind": "categorical",