[Basilisk] Issue MoonchildProductions/GRE#3029 - Remove telemetry from FE

This commit is contained in:
Moonchild 2021-11-01 00:24:15 +00:00 committed by roytam1
commit 653cba3202
49 changed files with 17 additions and 1661 deletions

View file

@ -8,14 +8,6 @@ var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm");
const TELEMETRY_RESULT_ENUM = {
RESTORED_DEFAULT: 0,
KEPT_CURRENT: 1,
CHANGED_ENGINE: 2,
CLOSED_PAGE: 3,
OPENED_SETTINGS: 4
};
window.onload = function() {
let defaultEngine = document.getElementById("defaultEngine");
let originalDefault = Services.search.originalDefaultEngine;
@ -24,7 +16,6 @@ window.onload = function() {
'url("' + originalDefault.iconURI.spec + '")';
document.getElementById("searchResetChangeEngine").focus();
window.addEventListener("unload", recordPageClosed);
document.getElementById("linkSettingsPage")
.addEventListener("click", openingSettings);
};
@ -46,8 +37,6 @@ function doSearch() {
let engine = Services.search.currentEngine;
let submission = engine.getSubmission(queryString, null, purpose);
window.removeEventListener("unload", recordPageClosed);
let win = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
@ -58,19 +47,12 @@ function doSearch() {
}
function openingSettings() {
record(TELEMETRY_RESULT_ENUM.OPENED_SETTINGS);
window.removeEventListener("unload", recordPageClosed);
}
function record(result) {
Services.telemetry.getHistogramById("SEARCH_RESET_RESULT").add(result);
}
function keepCurrentEngine() {
// Calling the currentEngine setter will force a correct loadPathHash to be
// written for this engine, so that we don't prompt the user again.
Services.search.currentEngine = Services.search.currentEngine;
record(TELEMETRY_RESULT_ENUM.KEPT_CURRENT);
doSearch();
}
@ -80,11 +62,6 @@ function changeSearchEngine() {
engine.hidden = false;
Services.search.currentEngine = engine;
record(TELEMETRY_RESULT_ENUM.RESTORED_DEFAULT);
doSearch();
}
function recordPageClosed() {
record(TELEMETRY_RESULT_ENUM.CLOSED_PAGE);
}