Bug 1819940 - Remove expired histogram EXTENSION_INSTALL_PROMPT_RESULT. r=willdurand

Depends on D171112

Differential Revision: https://phabricator.services.mozilla.com/D171113
This commit is contained in:
Luca Greco 2023-03-03 11:45:30 +00:00
parent 127d5ef00e
commit 796a297357
6 changed files with 23 additions and 111 deletions

View File

@ -9,7 +9,6 @@ const { AddonTestUtils } = ChromeUtils.import(
AddonTestUtils.initMochitest(this);
hookExtensionsTelemetry();
AddonTestUtils.hookAMTelemetryEvents();
const kSideloaded = true;
@ -315,9 +314,6 @@ add_task(async function test_sideloading() {
// Test post install notification on addon 3.
await testPostInstallIncognitoCheckbox(addon3);
// We should have recorded 1 cancelled followed by 2 accepted sideloads.
expectTelemetry(["sideloadRejected", "sideloadAccepted", "sideloadAccepted"]);
isnot(
menuButton.getAttribute("badge-status"),
"addon-alert",

View File

@ -7,6 +7,7 @@ const { AddonTestUtils } = ChromeUtils.import(
);
AddonTestUtils.initMochitest(this);
AddonTestUtils.hookAMTelemetryEvents();
const ID = "update2@tests.mozilla.org";
const ID_ICON = "update_icon2@tests.mozilla.org";
@ -56,9 +57,6 @@ add_setup(async function() {
});
});
hookExtensionsTelemetry();
AddonTestUtils.hookAMTelemetryEvents();
// Helper function to test background updates.
async function backgroundUpdateTest(url, id, checkIconFn) {
await SpecialPowers.pushPrefEnv({
@ -197,9 +195,6 @@ async function backgroundUpdateTest(url, id, checkIconFn) {
is(getBadgeStatus(), "", "Addon alert badge should be gone");
// Should have recorded 1 canceled followed by 1 accepted update.
expectTelemetry(["updateRejected", "updateAccepted"]);
await addon.uninstall();
await SpecialPowers.popPrefEnv();

View File

@ -7,8 +7,6 @@ const { AddonTestUtils } = ChromeUtils.import(
);
AddonTestUtils.initMochitest(this);
hookExtensionsTelemetry();
AddonTestUtils.hookAMTelemetryEvents();
const ID_PERMS = "update_perms@tests.mozilla.org";

View File

@ -328,10 +328,6 @@ async function testInstallMethod(installFn, telemetryBase) {
],
});
if (telemetryBase !== undefined) {
hookExtensionsTelemetry();
}
let testURI = makeURI("https://example.com/");
PermissionTestUtils.add(testURI, "install", Services.perms.ALLOW_ACTION);
registerCleanupFunction(() => PermissionTestUtils.remove(testURI, "install"));
@ -435,16 +431,6 @@ async function testInstallMethod(installFn, telemetryBase) {
// the extension to clean up.)
await runOnce(PERMS_XPI, false);
if (telemetryBase !== undefined) {
// Should see 2 canceled installs followed by 1 successful install
// for this method.
expectTelemetry([
`${telemetryBase}Rejected`,
`${telemetryBase}Rejected`,
`${telemetryBase}Accepted`,
]);
}
await SpecialPowers.popPrefEnv();
}
@ -671,26 +657,3 @@ add_setup(async function head_setup() {
}
});
});
let collectedTelemetry = [];
function hookExtensionsTelemetry() {
let originalHistogram = ExtensionsUI.histogram;
ExtensionsUI.histogram = {
add(value) {
collectedTelemetry.push(value);
},
};
registerCleanupFunction(() => {
is(
collectedTelemetry.length,
0,
"No unexamined telemetry after test is finished"
);
ExtensionsUI.histogram = originalHistogram;
});
}
function expectTelemetry(values) {
Assert.deepEqual(values, collectedTelemetry);
collectedTelemetry = [];
}

View File

@ -54,15 +54,10 @@ var ExtensionsUI = {
sideloaded: new Set(),
updates: new Set(),
sideloadListener: null,
histogram: null,
pendingNotifications: new WeakMap(),
async init() {
this.histogram = Services.telemetry.getHistogramById(
"EXTENSION_INSTALL_PROMPT_RESULT"
);
Services.obs.addObserver(this, "webextension-permission-prompt");
Services.obs.addObserver(this, "webextension-update-permissions");
Services.obs.addObserver(this, "webextension-install-notify");
@ -121,13 +116,13 @@ var ExtensionsUI = {
this.emit("change");
},
showAddonsManager(tabbrowser, strings, icon, histkey) {
showAddonsManager(tabbrowser, strings, icon) {
let global = tabbrowser.selectedBrowser.ownerGlobal;
return global
.BrowserOpenAddonsMgr("addons://list/extension")
.then(aomWin => {
let aomBrowser = aomWin.docShell.chromeEventHandler;
return this.showPermissionsPrompt(aomBrowser, strings, icon, histkey);
return this.showPermissionsPrompt(aomBrowser, strings, icon);
});
},
@ -146,7 +141,7 @@ var ExtensionsUI = {
num_strings: strings.msgs.length,
});
this.showAddonsManager(tabbrowser, strings, addon.iconURL, "sideload").then(
this.showAddonsManager(tabbrowser, strings, addon.iconURL).then(
async answer => {
if (answer) {
await addon.enable();
@ -174,22 +169,19 @@ var ExtensionsUI = {
num_strings: info.strings.msgs.length,
});
this.showAddonsManager(
browser,
info.strings,
info.addon.iconURL,
"update"
).then(answer => {
if (answer) {
info.resolve();
} else {
info.reject();
this.showAddonsManager(browser, info.strings, info.addon.iconURL).then(
answer => {
if (answer) {
info.resolve();
} else {
info.reject();
}
// At the moment, this prompt will re-appear next time we do an update
// check. See bug 1332360 for proposal to avoid this.
this.updates.delete(info);
this._updateNotifications();
}
// At the moment, this prompt will re-appear next time we do an update
// check. See bug 1332360 for proposal to avoid this.
this.updates.delete(info);
this._updateNotifications();
});
);
},
observe(subject, topic, data) {
@ -231,19 +223,6 @@ var ExtensionsUI = {
? "chrome://global/skin/icons/warning.svg"
: info.icon;
let histkey;
if (info.type == "sideload") {
histkey = "sideload";
} else if (info.type == "update") {
histkey = "update";
} else if (info.source == "AMO") {
histkey = "installAmo";
} else if (info.source == "local") {
histkey = "installLocal";
} else {
histkey = "installWeb";
}
if (info.type == "sideload") {
lazy.AMTelemetry.recordManageEvent(info.addon, "sideload_prompt", {
num_strings: strings.msgs.length,
@ -255,15 +234,13 @@ var ExtensionsUI = {
});
}
this.showPermissionsPrompt(browser, strings, icon, histkey).then(
answer => {
if (answer) {
info.resolve();
} else {
info.reject();
}
this.showPermissionsPrompt(browser, strings, icon).then(answer => {
if (answer) {
info.resolve();
} else {
info.reject();
}
);
});
} else if (topic == "webextension-update-permissions") {
let info = subject.wrappedJSObject;
info.type = "update";
@ -363,7 +340,7 @@ var ExtensionsUI = {
return strings;
},
async showPermissionsPrompt(target, strings, icon, histkey) {
async showPermissionsPrompt(target, strings, icon) {
let { browser, window } = getTabBrowser(target);
// Wait for any pending prompts to complete before showing the next one.
@ -454,9 +431,6 @@ var ExtensionsUI = {
label: strings.acceptText,
accessKey: strings.acceptKey,
callback: () => {
if (histkey) {
this.histogram.add(histkey + "Accepted");
}
resolve(true);
},
};
@ -465,9 +439,6 @@ var ExtensionsUI = {
label: strings.cancelText,
accessKey: strings.cancelKey,
callback: () => {
if (histkey) {
this.histogram.add(histkey + "Rejected");
}
resolve(false);
},
},

View File

@ -15324,17 +15324,6 @@
"description": "The total usage amount of the operations of tab audio indicator, mute=0 , unmuted=1, unblockByVisitingTab=2, unblockingByClickingIcon=3",
"releaseChannelCollection": "opt-out"
},
"EXTENSION_INSTALL_PROMPT_RESULT": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec"],
"alert_emails": ["aswan@mozilla.com", "andym@mozilla.com"],
"bug_numbers": [1338713],
"expires_in_version": "60",
"kind": "categorical",
"labels": ["installAmoAccepted", "installAmoRejected", "installLocalAccepted", "installLocalRejected", "installWebAccepted", "installWebRejected", "sideloadAccepted", "sideloadRejected", "updateAccepted", "updateRejected"],
"description": "Results of displaying add-on installation notifications.",
"releaseChannelCollection": "opt-out"
},
"INPUT_EVENT_QUEUED_CLICK_MS": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec"],