[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

@ -40,10 +40,6 @@ var gAdvancedPane = {
this.updateReadPrefs();
}
this.updateOfflineApps();
this.initTelemetry();
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this.initSubmitHealthReport();
}
this.updateOnScreenKeyboardVisibility();
this.updateCacheSizeInputField();
this.updateActualCacheSize();
@ -53,10 +49,6 @@ var gAdvancedPane = {
gAdvancedPane.updateHardwareAcceleration);
setEventListener("advancedPrefs", "select",
gAdvancedPane.tabSelectionChanged);
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
setEventListener("submitHealthReportBox", "command",
gAdvancedPane.updateSubmitHealthReport);
}
setEventListener("connectionSettings", "command",
gAdvancedPane.showConnections);
@ -107,15 +99,6 @@ var gAdvancedPane = {
var advancedPrefs = document.getElementById("advancedPrefs");
var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
// tabSelectionChanged gets called twice due to the selectedIndex being set
// by both the selectedItem and selectedPanel callstacks. This guard is used
// to prevent double-counting in Telemetry.
if (preference.valueFromPreferences != advancedPrefs.selectedIndex) {
Services.telemetry
.getHistogramById("FX_PREFERENCES_CATEGORY_OPENED")
.add(telemetryBucketForCategory("advanced"));
}
preference.valueFromPreferences = advancedPrefs.selectedIndex;
},
@ -249,64 +232,16 @@ var gAdvancedPane = {
"crashReporterLearnMore");
},
/**
* The preference/checkbox is configured in XUL.
*
* In all cases, set up the Learn More link sanely.
*/
initTelemetry: function ()
{
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
}
},
/**
* Set the status of the telemetry controls based on the input argument.
* @param {Boolean} aEnabled False disables the controls, true enables them.
*/
setTelemetrySectionEnabled: function (aEnabled)
{
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
// If FHR is disabled, additional data sharing should be disabled as well.
let disabled = !aEnabled;
document.getElementById("submitTelemetryBox").disabled = disabled;
if (disabled) {
// If we disable FHR, untick the telemetry checkbox.
Services.prefs.setBoolPref("toolkit.telemetry.enabled", false);
}
document.getElementById("telemetryDataDesc").disabled = disabled;
}
},
/**
* Initialize the health report service reference and checkbox.
*/
initSubmitHealthReport: function () {
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
let checkbox = document.getElementById("submitHealthReportBox");
if (Services.prefs.prefIsLocked(PREF_UPLOAD_ENABLED)) {
checkbox.setAttribute("disabled", "true");
return;
}
checkbox.checked = Services.prefs.getBoolPref(PREF_UPLOAD_ENABLED);
this.setTelemetrySectionEnabled(checkbox.checked);
}
},
/**
* Update the health report preference with state from checkbox.
*/
updateSubmitHealthReport: function () {
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
let checkbox = document.getElementById("submitHealthReportBox");
Services.prefs.setBoolPref(PREF_UPLOAD_ENABLED, checkbox.checked);
this.setTelemetrySectionEnabled(checkbox.checked);
}
},
updateOnScreenKeyboardVisibility() {

View file

@ -47,12 +47,6 @@
name="layout.spellcheckDefault"
type="int"/>
#ifdef MOZ_TELEMETRY_REPORTING
<preference id="toolkit.telemetry.enabled"
name="toolkit.telemetry.enabled"
type="bool"/>
#endif
<!-- Network tab -->
<preference id="browser.cache.disk.capacity"
name="browser.cache.disk.capacity"
@ -185,42 +179,6 @@
preference="layout.spellcheckDefault"/>
</groupbox>
</tabpanel>
#ifdef MOZ_DATA_REPORTING
<!-- Data Choices -->
<tabpanel id="dataChoicesPanel" orient="vertical">
#ifdef MOZ_TELEMETRY_REPORTING
<groupbox>
<caption>
<checkbox id="submitHealthReportBox" label="&enableHealthReport.label;"
accesskey="&enableHealthReport.accesskey;"/>
</caption>
<vbox>
<hbox class="indent">
<label flex="1">&healthReportDesc.label;</label>
<spacer flex="10"/>
<label id="FHRLearnMore"
class="text-link">&healthReportLearnMore.label;</label>
</hbox>
<hbox class="indent">
<groupbox flex="1">
<caption>
<checkbox id="submitTelemetryBox" preference="toolkit.telemetry.enabled"
label="&enableTelemetryData.label;"
accesskey="&enableTelemetryData.accesskey;"/>
</caption>
<hbox class="indent">
<label id="telemetryDataDesc" flex="1">&telemetryDesc.label;</label>
<spacer flex="10"/>
<label id="telemetryLearnMore"
class="text-link">&telemetryLearnMore.label;</label>
</hbox>
</groupbox>
</hbox>
</vbox>
</groupbox>
#endif
</tabpanel>
#endif
<!-- Network -->
<tabpanel id="networkPanel" orient="vertical">

View file

@ -117,11 +117,6 @@ var gContentPane = {
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
"resizable=yes", params);
try {
Services.telemetry
.getHistogramById("WEB_NOTIFICATION_EXCEPTIONS_OPENED").add();
} catch (e) {}
},

View file

@ -124,36 +124,6 @@ function init_dynamic_padding() {
document.documentElement.appendChild(mediaStyle);
}
function telemetryBucketForCategory(category) {
switch (category) {
case "general":
case "search":
case "content":
case "applications":
case "privacy":
case "security":
case "sync":
return category;
case "advanced":
let advancedPaneTabs = document.getElementById("advancedPrefs");
switch (advancedPaneTabs.selectedTab.id) {
case "generalTab":
return "advancedGeneral";
case "dataChoicesTab":
return "advancedDataChoices";
case "networkTab":
return "advancedNetwork";
case "updateTab":
return "advancedUpdates";
case "encryptionTab":
return "advancedCerts";
}
// fall-through for unknown.
default:
return "unknown";
}
}
function onHashChange() {
gotoPref();
}
@ -194,10 +164,6 @@ function gotoPref(aCategory) {
search(category, "data-category");
let mainContent = document.querySelector(".main-content");
mainContent.scrollTop = 0;
Services.telemetry
.getHistogramById("FX_PREFERENCES_CATEGORY_OPENED")
.add(telemetryBucketForCategory(friendlyName));
}
function search(aQuery, aAttribute) {