Backed out changeset 0a3a586fbbec (bug 1603760) for causing bc failures on browser_urlbar_telemetry_handoff.js CLOSED TREE

This commit is contained in:
Norisz Fay 2024-09-18 00:37:24 +03:00
Родитель 9bd8521616
Коммит 2edb3a1661
8 изменённых файлов: 246 добавлений и 2 удалений

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

@ -288,6 +288,15 @@ class BrowserSearchTelemetryHandler {
scalarKey,
1
);
Services.telemetry.recordEvent(
"navigation",
"search",
scalarSource,
action,
{
engine: engine.telemetryId,
}
);
}
/**

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

@ -129,6 +129,14 @@ browser.engagement.navigation.*
For ``urlbar`` or ``searchbar``, indicates the user confirmed a search
suggestion.
navigation.search (OBSOLETE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is a legacy and disabled event telemetry that is currently under
discussion for removal or modernization. It can't be enabled through a pref.
it's more or less equivalent to browser.engagement.navigation, but can also
report the picked search engine.
SearchSERPTelemetry.sys.mjs
~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

@ -32,6 +32,9 @@ add_setup(async function () {
let oldCanRecord = Services.telemetry.canRecordExtended;
Services.telemetry.canRecordExtended = true;
// Enable event recording for the events tested here.
Services.telemetry.setEventRecordingEnabled("navigation", true);
await SpecialPowers.pushPrefEnv({
set: [
[
@ -43,6 +46,7 @@ add_setup(async function () {
registerCleanupFunction(async function () {
await PlacesUtils.history.clear();
Services.telemetry.setEventRecordingEnabled("navigation", false);
Services.telemetry.canRecordExtended = oldCanRecord;
});
});
@ -102,7 +106,19 @@ add_task(async function test_abouthome_activitystream_simpleQuery() {
1
);
// Also check Glean events.
// Also check events.
TelemetryTestUtils.assertEvents(
[
{
object: "about_home",
value: "enter",
extra: { engine: "other-MozSearch" },
},
],
{ category: "navigation", method: "search" }
);
// Also also check Glean events.
const record = Glean.newtabSearch.issued.testGetValue();
Assert.ok(!!record, "Must have recorded a search issuance");
Assert.equal(record.length, 1, "One search, one event");

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

@ -28,8 +28,12 @@ add_setup(async function () {
let oldCanRecord = Services.telemetry.canRecordExtended;
Services.telemetry.canRecordExtended = true;
// Enable event recording for the events tested here.
Services.telemetry.setEventRecordingEnabled("navigation", true);
registerCleanupFunction(async function () {
await PlacesUtils.history.clear();
Services.telemetry.setEventRecordingEnabled("navigation", false);
Services.telemetry.canRecordExtended = oldCanRecord;
});
});
@ -97,6 +101,18 @@ add_task(async function test_context_menu() {
1
);
// Also check events.
TelemetryTestUtils.assertEvents(
[
{
object: "contextmenu",
value: null,
extra: { engine: "other-MozSearch" },
},
],
{ category: "navigation", method: "search" }
);
contextMenu.hidePopup();
BrowserTestUtils.removeTab(gBrowser.selectedTab);
BrowserTestUtils.removeTab(tab);
@ -158,6 +174,18 @@ add_task(async function test_about_newtab() {
1
);
// Also check events.
TelemetryTestUtils.assertEvents(
[
{
object: "about_newtab",
value: "enter",
extra: { engine: "other-MozSearch" },
},
],
{ category: "navigation", method: "search" }
);
// Also also check Glean events.
const record = Glean.newtabSearch.issued.testGetValue();
Assert.ok(!!record, "Must have recorded a search issuance");

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

@ -78,8 +78,12 @@ add_setup(async function () {
let oldCanRecord = Services.telemetry.canRecordExtended;
Services.telemetry.canRecordExtended = true;
// Enable event recording for the events tested here.
Services.telemetry.setEventRecordingEnabled("navigation", true);
registerCleanupFunction(async function () {
Services.telemetry.canRecordExtended = oldCanRecord;
Services.telemetry.setEventRecordingEnabled("navigation", false);
});
});
@ -125,6 +129,18 @@ add_task(async function test_plainQuery() {
1
);
// Also check events.
TelemetryTestUtils.assertEvents(
[
{
object: "searchbar",
value: "enter",
extra: { engine: "other-MozSearch" },
},
],
{ category: "navigation", method: "search" }
);
// Check the histograms as well.
let resultMethods = resultMethodHist.snapshot();
checkHistogramResults(
@ -183,6 +199,18 @@ add_task(async function test_oneOff_enter() {
1
);
// Also check events.
TelemetryTestUtils.assertEvents(
[
{
object: "searchbar",
value: "oneoff",
extra: { engine: "other-MozSearch2" },
},
],
{ category: "navigation", method: "search" }
);
// Check the histograms as well.
let resultMethods = resultMethodHist.snapshot();
checkHistogramResults(
@ -323,6 +351,18 @@ async function checkSuggestionClick(clickOptions, waitForActionFn) {
1
);
// Also check events.
TelemetryTestUtils.assertEvents(
[
{
object: "searchbar",
value: "suggestion",
extra: { engine: searchEngineId },
},
],
{ category: "navigation", method: "search" }
);
// Check the histograms as well.
let resultMethods = resultMethodHist.snapshot();
checkHistogramResults(

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

@ -113,6 +113,9 @@ add_setup(async function () {
let oldCanRecord = Services.telemetry.canRecordExtended;
Services.telemetry.canRecordExtended = true;
// Enable event recording for the events tested here.
Services.telemetry.setEventRecordingEnabled("navigation", true);
// Clear history so that history added by previous tests doesn't mess up this
// test when it selects results in the urlbar.
await PlacesUtils.history.clear();
@ -134,6 +137,7 @@ add_setup(async function () {
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
await PlacesUtils.history.clear();
await UrlbarTestUtils.formHistory.clear();
Services.telemetry.setEventRecordingEnabled("navigation", false);
});
});
@ -185,6 +189,20 @@ add_task(async function test_simpleQuery() {
undefined
);
// Also check events.
TelemetryTestUtils.assertEvents(
[
[
"navigation",
"search",
"urlbar",
"enter",
{ engine: "other-MozSearch" },
],
],
{ category: "navigation", method: "search" }
);
TelemetryTestUtils.assertHistogram(
resultMethodHist,
UrlbarTestUtils.SELECTED_RESULT_METHODS.enter,
@ -227,6 +245,20 @@ add_task(async function test_searchMode_enter() {
"This search must only increment one entry in the scalar."
);
// Also check events.
TelemetryTestUtils.assertEvents(
[
[
"navigation",
"search",
"urlbar_searchmode",
"enter",
{ engine: "other-MozSearch" },
],
],
{ category: "navigation", method: "search" }
);
TelemetryTestUtils.assertHistogram(
resultMethodHist,
UrlbarTestUtils.SELECTED_RESULT_METHODS.enter,
@ -301,6 +333,20 @@ add_task(async function test_oneOff_enter() {
undefined
);
// Also check events.
TelemetryTestUtils.assertEvents(
[
[
"navigation",
"search",
"urlbar_searchmode",
"enter",
{ engine: "other-MozSearch" },
],
],
{ category: "navigation", method: "search" }
);
TelemetryTestUtils.assertHistogram(
resultMethodHist,
UrlbarTestUtils.SELECTED_RESULT_METHODS.enter,
@ -459,6 +505,20 @@ add_task(async function test_suggestion_click() {
1
);
// Also check events.
TelemetryTestUtils.assertEvents(
[
[
"navigation",
"search",
"urlbar",
"suggestion",
{ engine: searchEngineId },
],
],
{ category: "navigation", method: "search" }
);
TelemetryTestUtils.assertHistogram(
resultMethodHist,
UrlbarTestUtils.SELECTED_RESULT_METHODS.click,
@ -616,6 +676,20 @@ add_task(async function test_searchmode_suggestion_click() {
1
);
// Also check events.
TelemetryTestUtils.assertEvents(
[
[
"navigation",
"search",
"urlbar_searchmode",
"suggestion",
{ engine: searchEngineId },
],
],
{ category: "navigation", method: "search" }
);
TelemetryTestUtils.assertHistogram(
resultMethodHist,
UrlbarTestUtils.SELECTED_RESULT_METHODS.click,
@ -784,6 +858,20 @@ add_task(async function test_formHistory_click() {
1
);
// Also check events.
TelemetryTestUtils.assertEvents(
[
[
"navigation",
"search",
"urlbar",
"formhistory",
{ engine: searchEngineId },
],
],
{ category: "navigation", method: "search" }
);
TelemetryTestUtils.assertHistogram(
resultMethodHist,
UrlbarTestUtils.SELECTED_RESULT_METHODS.click,

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

@ -3,7 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* This file tests browser.engagement.navigation.urlbar_persisted.
* This file tests browser.engagement.navigation.urlbar_persisted and the
* event navigation.search.urlbar_persisted
*/
"use strict";
@ -110,6 +111,25 @@ function assertScalarDoesNotExist(scalar) {
Assert.ok(!(scalar in scalars), scalar + " must not be recorded.");
}
function assertTelemetryEvents() {
TelemetryTestUtils.assertEvents(
[
["navigation", "search", "urlbar", "enter", { engine: "Example" }],
[
"navigation",
"search",
"urlbar_persisted",
"enter",
{ engine: "Example" },
],
],
{
category: "navigation",
method: "search",
}
);
}
// A user making a search after making a search should result
// in the telemetry being recorded.
add_task(async function search_after_search() {
@ -135,6 +155,9 @@ add_task(async function search_after_search() {
1
);
// Check events.
assertTelemetryEvents();
BrowserTestUtils.removeTab(tab);
});
@ -161,6 +184,9 @@ add_task(async function switch_to_tab_and_search() {
1
);
// Check events.
assertTelemetryEvents();
BrowserTestUtils.removeTab(tab1);
BrowserTestUtils.removeTab(tab2);
});
@ -187,6 +213,9 @@ add_task(async function handle_revert() {
1
);
// Check events.
assertTelemetryEvents();
BrowserTestUtils.removeTab(tab);
});
@ -221,5 +250,8 @@ add_task(async function back_and_forth() {
1
);
// Check events.
assertTelemetryEvents();
BrowserTestUtils.removeTab(tab);
});

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

@ -667,6 +667,29 @@ homepage:
extra_keys:
webExtensionId: The identifier of the webextension, if known.
navigation:
search:
objects: ["about_home", "about_newtab", "contextmenu", "oneoff",
"suggestion", "alias", "enter", "searchbar", "urlbar",
"urlbar_handoff", "urlbar_persisted", "urlbar_searchmode",
"webextension"]
release_channel_collection: opt-out
products:
- "firefox"
- "fennec"
record_in_processes: ["main"]
description: >
This is recorded on each search navigation.
The value field records the action used to trigger the search:
"enter", "oneoff", "suggestion", "alias", null (for contextmenu and webextension)
bug_numbers: [1316281, 1496764]
notification_emails:
- "mdeboer@mozilla.com"
- "rharter@mozilla.com"
expiry_version: never
extra_keys:
engine: The id of the search engine used.
upgrade_dialog:
trigger:
objects: ["reason"]