Bug 1842247 - Integrate clipboard result feature with existing telemetry for success measurement. r=mak

Differential Revision: https://phabricator.services.mozilla.com/D187046
This commit is contained in:
Karandeep 2023-09-15 14:16:16 +00:00
Родитель a2cff36d50
Коммит 7c27382e27
12 изменённых файлов: 178 добавлений и 1 удалений

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

@ -41,6 +41,10 @@ class ProviderClipboard extends UrlbarProvider {
return UrlbarUtils.PROVIDER_TYPE.PROFILE;
}
setPreviousClipboardValue(newValue) {
this.#previousClipboard.value = newValue;
}
isActive(queryContext, controller) {
// Return clipboard results only for empty searches.
if (

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

@ -1218,6 +1218,9 @@ export var UrlbarUtils = {
}
return "quicksuggest";
}
if (result.providerName == "UrlbarProviderClipboard") {
return "clipboard";
}
if (result.providerName == "InputHistory") {
return result.source == UrlbarUtils.RESULT_SOURCE.BOOKMARKS
? "bookmark_adaptive"
@ -1431,6 +1434,9 @@ export var UrlbarUtils = {
if (result.providerName === "UrlbarProviderTopSites") {
return "top_site";
}
if (result.providerName === "UrlbarProviderClipboard") {
return "clipboard";
}
return result.source === UrlbarUtils.RESULT_SOURCE.BOOKMARKS
? "bookmark"
: "history";

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

@ -349,6 +349,8 @@ urlbar.picked.*
A bookmarked URL.
- ``bookmark_adaptive``
A bookmarked URL retrieved from adaptive history.
- ``clipboard``
A URL retrieved from the system clipboard.
- ``dynamic``
A specially crafted result, often used in experiments when basic types are
not flexible enough for a rich layout.

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

@ -98,6 +98,7 @@ urlbar:
`autofill_url`,
`bookmark`,
`calc`,
`clipboard`,
`history`,
`intervention_clear`,
`intervention_refresh`,
@ -137,9 +138,11 @@ urlbar:
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1800414
- https://bugzilla.mozilla.org/show_bug.cgi?id=1805717
- https://bugzilla.mozilla.org/show_bug.cgi?id=1842247
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1800414#c2
- https://bugzilla.mozilla.org/show_bug.cgi?id=1805717#c4
- https://bugzilla.mozilla.org/show_bug.cgi?id=1842247#c3
data_sensitivity:
- interaction
notification_emails:
@ -219,6 +222,7 @@ urlbar:
`autofill_url`,
`bookmark`,
`calc`,
`clipboard`,
`experimental_addon`,
`history`,
`input_field`,
@ -333,6 +337,7 @@ urlbar:
`autofill_url`,
`bookmark`,
`calc`,
`clipboard`,
`history`,
`intervention_clear`,
`intervention_refresh`,
@ -372,9 +377,11 @@ urlbar:
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1797265
- https://bugzilla.mozilla.org/show_bug.cgi?id=1805717
- https://bugzilla.mozilla.org/show_bug.cgi?id=1842247
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1797265#c3
- https://bugzilla.mozilla.org/show_bug.cgi?id=1805717#c4
- https://bugzilla.mozilla.org/show_bug.cgi?id=1842247#c3
data_sensitivity:
- interaction
notification_emails:
@ -470,6 +477,7 @@ urlbar:
`autofill_url`,
`bookmark`,
`calc`,
`clipboard`,
`history`,
`intervention_clear`,
`intervention_refresh`,
@ -509,9 +517,11 @@ urlbar:
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1800579
- https://bugzilla.mozilla.org/show_bug.cgi?id=1805717
- https://bugzilla.mozilla.org/show_bug.cgi?id=1842247
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1800579#c4
- https://bugzilla.mozilla.org/show_bug.cgi?id=1805717#c4
- https://bugzilla.mozilla.org/show_bug.cgi?id=1842247#c3
data_sensitivity:
- interaction
notification_emails:

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

@ -266,3 +266,37 @@ add_task(async function testClipboardSuggestToggle() {
}
);
});
add_task(async function testScalarTelemetry() {
SpecialPowers.clipboardCopyString("https://example.com/6");
await BrowserTestUtils.withNewTab(
{ gBrowser, url: "about:home" },
async () => {
Services.telemetry.clearScalars();
await UrlbarTestUtils.promiseAutocompleteResultPopup({
window,
value: "",
waitForFocus,
fireInputEvent: true,
});
await UrlbarTestUtils.promisePopupClose(window, () => {
EventUtils.synthesizeKey("KEY_ArrowDown");
EventUtils.synthesizeKey("KEY_Enter");
});
const scalars = TelemetryTestUtils.getProcessScalars(
"parent",
true,
true
);
TelemetryTestUtils.assertKeyedScalar(
scalars,
`urlbar.picked.clipboard`,
0,
1
);
}
);
});

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

@ -105,6 +105,20 @@ add_task(async function top_site() {
});
});
add_task(async function clipboard() {
await doClipboardTest({
trigger: () => doBlur(),
assert: () =>
assertAbandonmentTelemetry([
{
groups: "general,suggested_index",
results: "clipboard,action",
n_results: 2,
},
]),
});
});
add_task(async function remote_tab() {
await doRemoteTabTest({
trigger: () => doBlur(),

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

@ -105,6 +105,20 @@ add_task(async function top_site() {
});
});
add_task(async function clipboard() {
await doClipboardTest({
trigger: () => doEnter(),
assert: () =>
assertEngagementTelemetry([
{
groups: "general,suggested_index",
results: "clipboard,action",
n_results: 2,
},
]),
});
});
add_task(async function remote_tab() {
await doRemoteTabTest({
trigger: () => doEnter(),

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

@ -10,6 +10,11 @@
// - provider
// - results
ChromeUtils.defineESModuleGetters(this, {
UrlbarProviderClipboard:
"resource:///modules/UrlbarProviderClipboard.sys.mjs",
});
// This test has many subtests and can time out in verify mode.
requestLongerTimeout(5);
@ -433,6 +438,38 @@ add_task(async function selected_result_calc() {
await SpecialPowers.popPrefEnv();
});
add_task(async function selected_result_clipboard() {
await SpecialPowers.pushPrefEnv({
set: [
["browser.urlbar.clipboard.featureGate", true],
["browser.urlbar.suggest.clipboard", true],
],
});
SpecialPowers.clipboardCopyString(
"https://example.com/selected_result_clipboard"
);
await doTest(async browser => {
await openPopup("");
await selectRowByProvider("UrlbarProviderClipboard");
await doEnter();
assertEngagementTelemetry([
{
selected_result: "clipboard",
selected_result_subtype: "",
selected_position: 1,
provider: "UrlbarProviderClipboard",
results: "clipboard,action",
},
]);
});
SpecialPowers.clipboardCopyString("");
UrlbarProviderClipboard.setPreviousClipboardValue("");
await SpecialPowers.popPrefEnv();
});
add_task(async function selected_result_unit() {
await SpecialPowers.pushPrefEnv({
set: [["browser.urlbar.unitConversion.enabled", true]],

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

@ -120,6 +120,21 @@ add_task(async function top_site() {
});
});
add_task(async function clipboard() {
await doClipboardTest({
trigger: () => waitForPauseImpression(),
assert: () =>
assertImpressionTelemetry([
{
reason: "pause",
groups: "general,suggested_index",
results: "clipboard,action",
n_results: 2,
},
]),
});
});
add_task(async function remote_tab() {
await doRemoteTabTest({
trigger: () => waitForPauseImpression(),

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

@ -5,6 +5,11 @@
/* import-globals-from head.js */
ChromeUtils.defineESModuleGetters(this, {
UrlbarProviderClipboard:
"resource:///modules/UrlbarProviderClipboard.sys.mjs",
});
async function doHeuristicsTest({ trigger, assert }) {
await doTest(async browser => {
await openPopup("x");
@ -121,6 +126,26 @@ async function doTopSiteTest({ trigger, assert }) {
});
}
async function doClipboardTest({ trigger, assert }) {
await SpecialPowers.pushPrefEnv({
set: [
["browser.urlbar.clipboard.featureGate", true],
["browser.urlbar.suggest.clipboard", true],
],
});
SpecialPowers.clipboardCopyString("https://example.com/clipboard");
await doTest(async browser => {
await showResultByArrowDown();
await selectRowByURL("https://example.com/clipboard");
await trigger();
await assert();
});
SpecialPowers.clipboardCopyString("");
UrlbarProviderClipboard.setPreviousClipboardValue("");
await SpecialPowers.popPrefEnv();
}
async function doRemoteTabTest({ trigger, assert }) {
const remoteTab = await loadRemoteTab("https://example.com");

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

@ -784,7 +784,7 @@ urlbar:
"searchsuggestion_rich", "switchtab", "remotetab", "extension",
"oneoff", "keywordoffer", "canonized", "tip", "tiphelp",
"formhistory", "tabtosearch", "quicksuggest", "weather",
"dynamic-wikipedia", "navigational", "none"
"clipboard", "dynamic-wikipedia", "navigational", "none"
provider: The name of the provider that presented the result.
abandonment:
objects: ["blur"]

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

@ -7542,6 +7542,22 @@ urlbar.picked:
- 'firefox'
record_in_processes:
- main
clipboard:
bug_numbers:
- 1842247
description: >
Counts how many times this result type was picked at a given index.
expires: never
kind: uint
keyed: true
notification_emails:
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- main
dynamic:
bug_numbers: