Bug 1656007 - Move URLBAR_SELECTED_RESULT_TYPES to UrlbarUtils since it is not used in BrowserUsageTelemetry. r=mak

Differential Revision: https://phabricator.services.mozilla.com/D85302
This commit is contained in:
Mark Banner 2020-07-30 14:27:50 +00:00
Родитель 7b5f150a6a
Коммит c8578acd2d
12 изменённых файлов: 42 добавлений и 51 удалений

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

@ -19,7 +19,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
UrlbarProvidersManager: "resource:///modules/UrlbarProvidersManager.jsm",
UrlbarTokenizer: "resource:///modules/UrlbarTokenizer.jsm",
UrlbarUtils: "resource:///modules/UrlbarUtils.jsm",
URLBAR_SELECTED_RESULT_TYPES: "resource:///modules/BrowserUsageTelemetry.jsm",
});
const TELEMETRY_1ST_RESULT = "PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS";
@ -517,7 +516,7 @@ class UrlbarController {
// Do not modify existing telemetry types. To add a new type:
//
// * Set telemetryType appropriately below.
// * Add the type to BrowserUsageTelemetry.URLBAR_SELECTED_RESULT_TYPES.
// * Add the type to UrlbarUtils.SELECTED_RESULT_TYPES.
// * See n_values in Histograms.json for FX_URLBAR_SELECTED_RESULT_TYPE_2
// and FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE_2. If your new type causes
// the number of types to become larger than n_values, you'll need to
@ -582,10 +581,10 @@ class UrlbarController {
Services.telemetry
.getHistogramById("FX_URLBAR_SELECTED_RESULT_INDEX")
.add(resultIndex);
if (telemetryType in URLBAR_SELECTED_RESULT_TYPES) {
if (telemetryType in UrlbarUtils.SELECTED_RESULT_TYPES) {
Services.telemetry
.getHistogramById("FX_URLBAR_SELECTED_RESULT_TYPE_2")
.add(URLBAR_SELECTED_RESULT_TYPES[telemetryType]);
.add(UrlbarUtils.SELECTED_RESULT_TYPES[telemetryType]);
Services.telemetry
.getKeyedHistogramById("FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE_2")
.add(telemetryType, resultIndex);

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

@ -100,6 +100,30 @@ var UrlbarUtils = {
OTHER_NETWORK: 6,
},
/**
* Buckets used for logging telemetry to the FX_URLBAR_SELECTED_RESULT_TYPE_2
* histogram.
*/
SELECTED_RESULT_TYPES: {
autofill: 0,
bookmark: 1,
history: 2,
keyword: 3,
searchengine: 4,
searchsuggestion: 5,
switchtab: 6,
tag: 7,
visiturl: 8,
remotetab: 9,
extension: 10,
"preloaded-top-site": 11,
tip: 12,
topsite: 13,
formhistory: 14,
dynamic: 15,
// n_values = 32, so you'll need to create a new histogram if you need more.
},
// This defines icon locations that are commonly used in the UI.
ICON: {
// DEFAULT is defined lazily so it doesn't eagerly initialize PlacesUtils.

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

@ -101,14 +101,14 @@ FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE
This probe tracks picked result type, for each one it tracks the index where
it appeared.
It's a keyed histogram where the keys are result types (see
URLBAR_SELECTED_RESULT_TYPES). For each key, this records the indexes of
SELECTED_RESULT_TYPES). For each key, this records the indexes of
picked results for that result type.
FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE_2
This probe tracks picked result type, for each one it tracks the index where
it appeared.
It's a keyed histogram where the keys are result types (see
URLBAR_SELECTED_RESULT_TYPES). For each key, this records the indexes of
SELECTED_RESULT_TYPES). For each key, this records the indexes of
picked results for that result type.
Scalars

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

@ -9,7 +9,6 @@ var EXPORTED_SYMBOLS = [
"BrowserUsageTelemetry",
"getUniqueDomainsVisitedInPast24Hours",
"URICountListener",
"URLBAR_SELECTED_RESULT_TYPES",
"MINIMUM_TAB_COUNT_INTERVAL_MS",
];
@ -79,30 +78,6 @@ const KNOWN_ONEOFF_SOURCES = [
"unknown", // Edge case: this is the searchbar (see bug 1195733 comment 7).
];
/**
* Buckets used for logging telemetry to the FX_URLBAR_SELECTED_RESULT_TYPE_2
* histogram.
*/
const URLBAR_SELECTED_RESULT_TYPES = {
autofill: 0,
bookmark: 1,
history: 2,
keyword: 3,
searchengine: 4,
searchsuggestion: 5,
switchtab: 6,
tag: 7,
visiturl: 8,
remotetab: 9,
extension: 10,
"preloaded-top-site": 11,
tip: 12,
topsite: 13,
formhistory: 14,
dynamic: 15,
// n_values = 32, so you'll need to create a new histogram if you need more.
};
const MINIMUM_TAB_COUNT_INTERVAL_MS = 5 * 60 * 1000; // 5 minutes, in ms
// The elements we consider to be interactive.

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

@ -19,7 +19,6 @@ const SUGGESTION_ENGINE_NAME =
XPCOMUtils.defineLazyModuleGetters(this, {
SearchTelemetry: "resource:///modules/SearchTelemetry.jsm",
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.jsm",
URLBAR_SELECTED_RESULT_TYPES: "resource:///modules/BrowserUsageTelemetry.jsm",
});
function searchInAwesomebar(value, win = window) {
@ -219,7 +218,7 @@ add_task(async function test_simpleQuery() {
TelemetryTestUtils.assertHistogram(
resultTypeHist,
URLBAR_SELECTED_RESULT_TYPES.searchengine,
UrlbarUtils.SELECTED_RESULT_TYPES.searchengine,
1
);
@ -316,7 +315,7 @@ add_task(async function test_searchAlias() {
TelemetryTestUtils.assertHistogram(
resultTypeHist,
URLBAR_SELECTED_RESULT_TYPES.searchengine,
UrlbarUtils.SELECTED_RESULT_TYPES.searchengine,
1
);
@ -467,7 +466,7 @@ add_task(async function test_oneOff_enter() {
TelemetryTestUtils.assertHistogram(
resultTypeHist,
URLBAR_SELECTED_RESULT_TYPES.searchengine,
UrlbarUtils.SELECTED_RESULT_TYPES.searchengine,
1
);
@ -633,7 +632,7 @@ add_task(async function test_suggestion_click() {
TelemetryTestUtils.assertHistogram(
resultTypeHist,
URLBAR_SELECTED_RESULT_TYPES.searchsuggestion,
UrlbarUtils.SELECTED_RESULT_TYPES.searchsuggestion,
1
);
@ -832,7 +831,7 @@ add_task(async function test_formHistory_click() {
TelemetryTestUtils.assertHistogram(
resultTypeHist,
URLBAR_SELECTED_RESULT_TYPES.formhistory,
UrlbarUtils.SELECTED_RESULT_TYPES.formhistory,
1
);

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

@ -13,7 +13,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
UrlbarResult: "resource:///modules/UrlbarResult.jsm",
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.jsm",
UrlbarView: "resource:///modules/UrlbarView.jsm",
URLBAR_SELECTED_RESULT_TYPES: "resource:///modules/BrowserUsageTelemetry.jsm",
});
const DYNAMIC_TYPE_NAME = "test";
@ -135,7 +134,7 @@ function assertHistogramResults(histograms, type, index, method) {
TelemetryTestUtils.assertHistogram(
histograms.resultTypeHist,
URLBAR_SELECTED_RESULT_TYPES[type],
UrlbarUtils.SELECTED_RESULT_TYPES[type],
1
);

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

@ -12,7 +12,6 @@ const SCALAR_URLBAR = "browser.engagement.navigation.urlbar";
XPCOMUtils.defineLazyModuleGetters(this, {
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.jsm",
URLBAR_SELECTED_RESULT_TYPES: "resource:///modules/BrowserUsageTelemetry.jsm",
});
function assertSearchTelemetryEmpty(search_hist) {
@ -74,7 +73,7 @@ function assertHistogramResults(histograms, type, index, method) {
TelemetryTestUtils.assertHistogram(
histograms.resultTypeHist,
URLBAR_SELECTED_RESULT_TYPES[type],
UrlbarUtils.SELECTED_RESULT_TYPES[type],
1
);

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

@ -18,7 +18,6 @@ const TEST_URL = getRootDirectory(gTestPath).replace(
XPCOMUtils.defineLazyModuleGetters(this, {
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.jsm",
URLBAR_SELECTED_RESULT_TYPES: "resource:///modules/BrowserUsageTelemetry.jsm",
});
function searchInAwesomebar(value, win = window) {
@ -89,7 +88,7 @@ function assertHistogramResults(histograms, type, index, method) {
TelemetryTestUtils.assertHistogram(
histograms.resultTypeHist,
URLBAR_SELECTED_RESULT_TYPES[type],
UrlbarUtils.SELECTED_RESULT_TYPES[type],
1
);

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

@ -13,7 +13,6 @@ const SCALAR_URLBAR = "browser.engagement.navigation.urlbar";
XPCOMUtils.defineLazyModuleGetters(this, {
SyncedTabs: "resource://services-sync/SyncedTabs.jsm",
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.jsm",
URLBAR_SELECTED_RESULT_TYPES: "resource:///modules/BrowserUsageTelemetry.jsm",
});
const { sinon } = ChromeUtils.import("resource://testing-common/Sinon.jsm");
@ -76,7 +75,7 @@ function assertHistogramResults(histograms, type, index, method) {
TelemetryTestUtils.assertHistogram(
histograms.resultTypeHist,
URLBAR_SELECTED_RESULT_TYPES[type],
UrlbarUtils.SELECTED_RESULT_TYPES[type],
1
);

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

@ -13,7 +13,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
UrlbarProvidersManager: "resource:///modules/UrlbarProvidersManager.jsm",
UrlbarResult: "resource:///modules/UrlbarResult.jsm",
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.jsm",
URLBAR_SELECTED_RESULT_TYPES: "resource:///modules/BrowserUsageTelemetry.jsm",
});
function snapshotHistograms() {
@ -41,7 +40,7 @@ function assertHistogramResults(histograms, type, index, method) {
TelemetryTestUtils.assertHistogram(
histograms.resultTypeHist,
URLBAR_SELECTED_RESULT_TYPES[type],
UrlbarUtils.SELECTED_RESULT_TYPES[type],
1
);

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

@ -11,7 +11,6 @@
XPCOMUtils.defineLazyModuleGetters(this, {
AboutNewTab: "resource:///modules/AboutNewTab.jsm",
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.jsm",
URLBAR_SELECTED_RESULT_TYPES: "resource:///modules/BrowserUsageTelemetry.jsm",
});
const EN_US_TOPSITES =
@ -42,7 +41,7 @@ function assertHistogramResults(histograms, type, index, method) {
TelemetryTestUtils.assertHistogram(
histograms.resultTypeHist,
URLBAR_SELECTED_RESULT_TYPES[type],
UrlbarUtils.SELECTED_RESULT_TYPES[type],
1
);

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

@ -7629,7 +7629,7 @@
"n_values": 32,
"releaseChannelCollection": "opt-out",
"bug_numbers": [775825, 1617631, 1398416],
"description": "Firefox: The type of the selected result in the URL bar popup. See BrowserUsageTelemetry.jsm:URLBAR_SELECTED_RESULT_TYPES for the result types."
"description": "Firefox: The type of the selected result in the URL bar popup. See UrlbarUtils.jsm:SELECTED_RESULT_TYPES for the result types."
},
"FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE_2": {
"record_in_processes": ["main", "content"],
@ -7641,7 +7641,7 @@
"keyed": true,
"releaseChannelCollection": "opt-out",
"bug_numbers": [1345834, 1617631, 1398416],
"description": "Firefox: The index of the selected result in the URL bar popup by the type of the selected result in the URL bar popup. See BrowserUsageTelemetry.jsm:URLBAR_SELECTED_RESULT_TYPES for the result types."
"description": "Firefox: The index of the selected result in the URL bar popup by the type of the selected result in the URL bar popup. See UrlbarUtils.jsm:SELECTED_RESULT_TYPES for the result types."
},
"FX_URLBAR_SELECTED_RESULT_METHOD": {
"record_in_processes": ["main", "content"],