зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1783155
- Add Scalar to inform which QuickActions are picked. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D155800
This commit is contained in:
Родитель
8296bdbac0
Коммит
d5a62d8fa2
|
@ -138,6 +138,7 @@ class ProviderQuickActions extends UrlbarProvider {
|
|||
results: results.map(key => ({ key })),
|
||||
dynamicType: DYNAMIC_TYPE_NAME,
|
||||
helpUrl: this.helpUrl,
|
||||
inputLength: input.length,
|
||||
}
|
||||
);
|
||||
result.suggestedIndex = SUGGESTED_INDEX;
|
||||
|
@ -161,6 +162,7 @@ class ProviderQuickActions extends UrlbarProvider {
|
|||
tag: "span",
|
||||
attributes: {
|
||||
"data-key": key,
|
||||
"data-input-length": result.payload.inputLength,
|
||||
class: "urlbarView-quickaction-row",
|
||||
role: inActive ? "" : "button",
|
||||
},
|
||||
|
@ -224,6 +226,15 @@ class ProviderQuickActions extends UrlbarProvider {
|
|||
}
|
||||
|
||||
pickResult(result, itemPicked) {
|
||||
let { key, inputLength } = itemPicked.dataset;
|
||||
// We clamp the input length to limit the number of keys to
|
||||
// the number of actions * 10.
|
||||
inputLength = Math.min(inputLength, 10);
|
||||
Services.telemetry.keyedScalarAdd(
|
||||
`quickaction.picked`,
|
||||
`${key}-${inputLength}`,
|
||||
1
|
||||
);
|
||||
let options = this.#actions.get(itemPicked.dataset.key).onPick() ?? {};
|
||||
if (options.focusContent) {
|
||||
itemPicked.ownerGlobal.gBrowser.selectedBrowser.focus();
|
||||
|
|
|
@ -49,11 +49,25 @@ add_task(async function test() {
|
|||
|
||||
Assert.equal(testActionCalled, 1, "Test action was called");
|
||||
|
||||
assertTelemetryResults(
|
||||
histograms,
|
||||
"quickaction",
|
||||
"1",
|
||||
UrlbarTestUtils.SELECTED_RESULT_METHODS.arrowEnterSelection
|
||||
TelemetryTestUtils.assertHistogram(
|
||||
histograms.resultMethodHist,
|
||||
UrlbarTestUtils.SELECTED_RESULT_METHODS.arrowEnterSelection,
|
||||
1
|
||||
);
|
||||
|
||||
let scalars = TelemetryTestUtils.getProcessScalars("parent", true, true);
|
||||
TelemetryTestUtils.assertKeyedScalar(
|
||||
scalars,
|
||||
`urlbar.picked.quickaction`,
|
||||
1,
|
||||
1
|
||||
);
|
||||
|
||||
TelemetryTestUtils.assertKeyedScalar(
|
||||
scalars,
|
||||
"quickaction.picked",
|
||||
"testaction-10",
|
||||
1
|
||||
);
|
||||
|
||||
// Clean up for subsequent tests.
|
||||
|
@ -69,14 +83,3 @@ function snapshotHistograms() {
|
|||
),
|
||||
};
|
||||
}
|
||||
|
||||
function assertTelemetryResults(histograms, type, index, method) {
|
||||
TelemetryTestUtils.assertHistogram(histograms.resultMethodHist, method, 1);
|
||||
|
||||
TelemetryTestUtils.assertKeyedScalar(
|
||||
TelemetryTestUtils.getProcessScalars("parent", true, true),
|
||||
`urlbar.picked.${type}`,
|
||||
index,
|
||||
1
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ ChromeUtils.defineESModuleGetters(this, {
|
|||
"resource:///modules/UrlbarProviderQuickActions.sys.mjs",
|
||||
});
|
||||
|
||||
let expectedMatch = key => ({
|
||||
let expectedMatch = (key, inputLength) => ({
|
||||
type: UrlbarUtils.RESULT_TYPE.DYNAMIC,
|
||||
source: UrlbarUtils.RESULT_SOURCE.ACTIONS,
|
||||
heuristic: false,
|
||||
|
@ -17,6 +17,7 @@ let expectedMatch = key => ({
|
|||
results: [{ key }],
|
||||
dynamicType: "quickactions",
|
||||
helpUrl: UrlbarProviderQuickActions.helpUrl,
|
||||
inputLength,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -67,7 +68,7 @@ add_task(async function quickactions_match() {
|
|||
});
|
||||
await check_results({
|
||||
context,
|
||||
matches: [expectedMatch("newaction")],
|
||||
matches: [expectedMatch("newaction", 3)],
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -83,7 +84,7 @@ add_task(async function duplicate_matches() {
|
|||
|
||||
await check_results({
|
||||
context,
|
||||
matches: [expectedMatch("testaction")],
|
||||
matches: [expectedMatch("testaction", 10)],
|
||||
});
|
||||
|
||||
UrlbarProviderQuickActions.removeAction("testaction");
|
||||
|
|
|
@ -7483,6 +7483,24 @@ urlbar.picked.searchmode:
|
|||
record_in_processes:
|
||||
- main
|
||||
|
||||
quickaction:
|
||||
picked:
|
||||
bug_numbers:
|
||||
- 1783155
|
||||
description: >
|
||||
Counts how many times quickaction results were selected. The key
|
||||
is the in the form "actionkey-N" where N is the number of characters
|
||||
the user typed to be shown the action.
|
||||
expires: never
|
||||
kind: uint
|
||||
keyed: true
|
||||
notification_emails:
|
||||
- fx-search-telemetry@mozilla.com
|
||||
release_channel_collection: opt-out
|
||||
products:
|
||||
- 'firefox'
|
||||
record_in_processes:
|
||||
- main
|
||||
|
||||
migration:
|
||||
uninstaller_profile_refresh:
|
||||
|
|
Загрузка…
Ссылка в новой задаче