Bug 1817203: Introduce go_button in engagement_type r=mak

Differential Revision: https://phabricator.services.mozilla.com/D171033
This commit is contained in:
Daisuke Akatsuka
2023-02-28 01:26:49 +00:00
parent b4d694fef0
commit 95dabb81e9
3 changed files with 19 additions and 2 deletions

View File

@@ -944,8 +944,10 @@ class TelemetryEvent {
startEventInfo.interactionType == "dropped" ? "drop_go" : "paste_go"; startEventInfo.interactionType == "dropped" ? "drop_go" : "paste_go";
} else if (event.type == "blur") { } else if (event.type == "blur") {
action = "blur"; action = "blur";
} else if (MouseEvent.isInstance(event)) {
action = event.target.id == "urlbar-go-button" ? "go_button" : "click";
} else { } else {
action = MouseEvent.isInstance(event) ? "click" : "enter"; action = "enter";
} }
let method = action == "blur" ? "abandonment" : "engagement"; let method = action == "blur" ? "abandonment" : "engagement";
@@ -982,6 +984,11 @@ class TelemetryEvent {
return; return;
} }
if (action == "go_button") {
// Fall back since the conventional telemetry dones't support "go_button" action.
action = "click";
}
let endTime = (event && event.timeStamp) || Cu.now(); let endTime = (event && event.timeStamp) || Cu.now();
let startTime = startEventInfo.timeStamp || endTime; let startTime = startEventInfo.timeStamp || endTime;
// Synthesized events in tests may have a bogus timeStamp, causing a // Synthesized events in tests may have a bogus timeStamp, causing a

View File

@@ -198,7 +198,8 @@ urlbar:
engagement_type: engagement_type:
description: > description: >
Records how the user selected the result. The possible values are: Records how the user selected the result. The possible values are:
`click`, `enter`, `drop_go`, `paste_go`, `dismiss`, `help`. `click`, `enter`, `go_button`, `drop_go`, `paste_go`, `dismiss`,
`help`.
type: string type: string
groups: groups:
description: > description: >

View File

@@ -28,6 +28,15 @@ add_task(async function engagement_type_enter() {
}); });
}); });
add_task(async function engagement_type_go_button() {
await doTest(async browser => {
await openPopup("x");
EventUtils.synthesizeMouseAtCenter(gURLBar.goButton, {});
assertEngagementTelemetry([{ engagement_type: "go_button" }]);
});
});
add_task(async function engagement_type_drop_go() { add_task(async function engagement_type_drop_go() {
await doTest(async browser => { await doTest(async browser => {
await doDropAndGo("example.com"); await doDropAndGo("example.com");