зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1312182 - Consolidate the uses of MOZ_TELEMETRY_REPORTING in the code. r=flod,gfritzsche,jaws
The MOZ_TELEMETRY_REPORTING define does not control whether or not Telemetry is enabled but rather if it will send the gathered data to Mozilla servers. We still want to display the about:preferences options and let developers know about this behaviour. Please note that this patch is not changing any behaviour: it's only making it explicit by showing the options as disabled rather than hiding them. MozReview-Commit-ID: 7A0y0E0hm0Q --HG-- extra : rebase_source : 36d1a7f5ec5c05b43731daf9507d3068fe7674ee
This commit is contained in:
Родитель
562ade4850
Коммит
0d02dac163
|
@ -61,7 +61,7 @@
|
|||
onclick="checkForMiddleClick(this, event);"
|
||||
label="&helpKeyboardShortcuts.label;"
|
||||
accesskey="&helpKeyboardShortcuts.accesskey;"/>
|
||||
#ifdef MOZ_TELEMETRY_REPORTING
|
||||
#ifdef MOZ_SERVICES_HEALTHREPORT
|
||||
<menuitem id="healthReport"
|
||||
label="&healthReport2.label;"
|
||||
accesskey="&healthReport2.accesskey;"
|
||||
|
|
|
@ -530,9 +530,7 @@ BrowserGlue.prototype = {
|
|||
os.addObserver(this, "distribution-customization-complete");
|
||||
os.addObserver(this, "handle-xul-text-link");
|
||||
os.addObserver(this, "profile-before-change");
|
||||
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
os.addObserver(this, "keyword-search");
|
||||
}
|
||||
os.addObserver(this, "keyword-search");
|
||||
os.addObserver(this, "browser-search-engine-modified");
|
||||
os.addObserver(this, "restart-in-safe-mode");
|
||||
os.addObserver(this, "flash-plugin-hang");
|
||||
|
@ -585,9 +583,7 @@ BrowserGlue.prototype = {
|
|||
os.removeObserver(this, "places-database-locked");
|
||||
os.removeObserver(this, "handle-xul-text-link");
|
||||
os.removeObserver(this, "profile-before-change");
|
||||
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
os.removeObserver(this, "keyword-search");
|
||||
}
|
||||
os.removeObserver(this, "keyword-search");
|
||||
os.removeObserver(this, "browser-search-engine-modified");
|
||||
os.removeObserver(this, "flash-plugin-hang");
|
||||
os.removeObserver(this, "xpi-signature-changed");
|
||||
|
|
|
@ -183,11 +183,9 @@
|
|||
name="layout.spellcheckDefault"
|
||||
type="int"/>
|
||||
|
||||
#ifdef MOZ_TELEMETRY_REPORTING
|
||||
<preference id="toolkit.telemetry.enabled"
|
||||
name="toolkit.telemetry.enabled"
|
||||
type="bool"/>
|
||||
#endif
|
||||
|
||||
<preference id="browser.preferences.defaultPerformanceSettings.enabled"
|
||||
name="browser.preferences.defaultPerformanceSettings.enabled"
|
||||
|
|
|
@ -321,11 +321,9 @@ var gPrivacyPane = {
|
|||
this.initSubmitCrashes();
|
||||
}
|
||||
this.initTelemetry();
|
||||
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
this.initSubmitHealthReport();
|
||||
setEventListener("submitHealthReportBox", "command",
|
||||
gPrivacyPane.updateSubmitHealthReport);
|
||||
}
|
||||
this.initSubmitHealthReport();
|
||||
setEventListener("submitHealthReportBox", "command",
|
||||
gPrivacyPane.updateSubmitHealthReport);
|
||||
|
||||
// Append search keywords into the elements could open subdialogs.
|
||||
let bundlePrefs = document.getElementById("bundlePreferences");
|
||||
|
@ -1414,8 +1412,10 @@ var gPrivacyPane = {
|
|||
* In all cases, set up the Learn More link sanely.
|
||||
*/
|
||||
initTelemetry() {
|
||||
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
|
||||
this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
|
||||
// If we're not sending any Telemetry, disable the telemetry upload checkbox as well.
|
||||
if (!AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
document.getElementById("submitTelemetryBox").setAttribute("disabled", "true");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1439,9 +1439,6 @@ var gPrivacyPane = {
|
|||
* @param {Boolean} aEnabled False disables the controls, true enables them.
|
||||
*/
|
||||
setTelemetrySectionEnabled(aEnabled) {
|
||||
if (!AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
return;
|
||||
}
|
||||
// If FHR is disabled, additional data sharing should be disabled as well.
|
||||
let disabled = !aEnabled;
|
||||
document.getElementById("submitTelemetryBox").disabled = disabled;
|
||||
|
@ -1456,19 +1453,21 @@ var gPrivacyPane = {
|
|||
* Initialize the health report service reference and checkbox.
|
||||
*/
|
||||
initSubmitHealthReport() {
|
||||
if (!AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
return;
|
||||
}
|
||||
this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
|
||||
|
||||
let checkbox = document.getElementById("submitHealthReportBox");
|
||||
|
||||
if (Services.prefs.prefIsLocked(PREF_UPLOAD_ENABLED)) {
|
||||
// Telemetry is only sending data if MOZ_TELEMETRY_REPORTING is defined.
|
||||
// We still want to display the preferences panel if that's not the case, but
|
||||
// we want it to be disabled and unchecked.
|
||||
if (Services.prefs.prefIsLocked(PREF_UPLOAD_ENABLED) ||
|
||||
!AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
checkbox.setAttribute("disabled", "true");
|
||||
return;
|
||||
}
|
||||
|
||||
checkbox.checked = Services.prefs.getBoolPref(PREF_UPLOAD_ENABLED);
|
||||
checkbox.checked = Services.prefs.getBoolPref(PREF_UPLOAD_ENABLED) &&
|
||||
AppConstants.MOZ_TELEMETRY_REPORTING;
|
||||
this.setTelemetrySectionEnabled(checkbox.checked);
|
||||
},
|
||||
|
||||
|
@ -1476,9 +1475,6 @@ var gPrivacyPane = {
|
|||
* Update the health report preference with state from checkbox.
|
||||
*/
|
||||
updateSubmitHealthReport() {
|
||||
if (!AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
return;
|
||||
}
|
||||
let checkbox = document.getElementById("submitHealthReportBox");
|
||||
Services.prefs.setBoolPref(PREF_UPLOAD_ENABLED, checkbox.checked);
|
||||
this.setTelemetrySectionEnabled(checkbox.checked);
|
||||
|
|
|
@ -782,9 +782,14 @@
|
|||
</groupbox>
|
||||
|
||||
<!-- Data Choices -->
|
||||
#ifdef MOZ_TELEMETRY_REPORTING
|
||||
<groupbox id="historyGroup" data-category="panePrivacy" data-subcategory="reports" hidden="true">
|
||||
#ifdef MOZ_DATA_REPORTING
|
||||
|
||||
<groupbox id="telemetryGroup" data-category="panePrivacy" data-subcategory="reports" hidden="true">
|
||||
<caption><label>&reports.label;</label></caption>
|
||||
#ifndef MOZ_TELEMETRY_REPORTING
|
||||
<description id="TelemetryDisabledDesc" control="telemetryGroup">&healthReportingDisabled.label;</description>
|
||||
#endif
|
||||
|
||||
<hbox align="center">
|
||||
<checkbox id="submitHealthReportBox" label="&enableHealthReport.label;"
|
||||
accesskey="&enableHealthReport.accesskey;"/>
|
||||
|
@ -804,14 +809,9 @@
|
|||
class="indent">&telemetryDesc.label;</description>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_DATA_REPORTING
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
<groupbox id="crashReporterGroup" data-category="panePrivacy" data-subcategory="reports" hidden="true">
|
||||
#ifndef MOZ_TELEMETRY_REPORTING
|
||||
<caption><label>&reports.label;</label></caption>
|
||||
#endif
|
||||
<hbox align="center">
|
||||
<checkbox id="automaticallySubmitCrashesBox"
|
||||
preference="browser.crashReports.unsubmittedCheck.autoSubmit"
|
||||
|
|
|
@ -46,9 +46,7 @@ var gAdvancedPane = {
|
|||
this.initSubmitCrashes();
|
||||
}
|
||||
this.initTelemetry();
|
||||
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
this.initSubmitHealthReport();
|
||||
}
|
||||
this.initSubmitHealthReport();
|
||||
this.updateOnScreenKeyboardVisibility();
|
||||
this.updateCacheSizeInputField();
|
||||
this.updateActualCacheSize();
|
||||
|
@ -78,10 +76,8 @@ var gAdvancedPane = {
|
|||
gAdvancedPane.updateHardwareAcceleration);
|
||||
setEventListener("advancedPrefs", "select",
|
||||
gAdvancedPane.tabSelectionChanged);
|
||||
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
setEventListener("submitHealthReportBox", "command",
|
||||
gAdvancedPane.updateSubmitHealthReport);
|
||||
}
|
||||
setEventListener("submitHealthReportBox", "command",
|
||||
gAdvancedPane.updateSubmitHealthReport);
|
||||
|
||||
setEventListener("connectionSettings", "command",
|
||||
gAdvancedPane.showConnections);
|
||||
|
@ -293,8 +289,10 @@ var gAdvancedPane = {
|
|||
* In all cases, set up the Learn More link sanely.
|
||||
*/
|
||||
initTelemetry() {
|
||||
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
|
||||
this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
|
||||
// If we're not sending any Telemetry, disable the telemetry upload checkbox as well.
|
||||
if (!AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
document.getElementById("submitTelemetryBox").setAttribute("disabled", "true");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -303,46 +301,45 @@ var gAdvancedPane = {
|
|||
* @param {Boolean} aEnabled False disables the controls, true enables them.
|
||||
*/
|
||||
setTelemetrySectionEnabled(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;
|
||||
// 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() {
|
||||
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
|
||||
this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
|
||||
|
||||
let checkbox = document.getElementById("submitHealthReportBox");
|
||||
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);
|
||||
// Telemetry is only sending data if MOZ_TELEMETRY_REPORTING is defined.
|
||||
// We still want to display the preferences panel if that's not the case, but
|
||||
// we want it to be disabled and unchecked.
|
||||
if (Services.prefs.prefIsLocked(PREF_UPLOAD_ENABLED) ||
|
||||
!AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
checkbox.setAttribute("disabled", "true");
|
||||
return;
|
||||
}
|
||||
|
||||
checkbox.checked = Services.prefs.getBoolPref(PREF_UPLOAD_ENABLED) &&
|
||||
AppConstants.MOZ_TELEMETRY_REPORTING;
|
||||
this.setTelemetrySectionEnabled(checkbox.checked);
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the health report preference with state from checkbox.
|
||||
*/
|
||||
updateSubmitHealthReport() {
|
||||
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
let checkbox = document.getElementById("submitHealthReportBox");
|
||||
Services.prefs.setBoolPref(PREF_UPLOAD_ENABLED, checkbox.checked);
|
||||
this.setTelemetrySectionEnabled(checkbox.checked);
|
||||
}
|
||||
let checkbox = document.getElementById("submitHealthReportBox");
|
||||
Services.prefs.setBoolPref(PREF_UPLOAD_ENABLED, checkbox.checked);
|
||||
this.setTelemetrySectionEnabled(checkbox.checked);
|
||||
},
|
||||
|
||||
updateOnScreenKeyboardVisibility() {
|
||||
|
|
|
@ -37,12 +37,9 @@
|
|||
<preference id="layout.spellcheckDefault"
|
||||
name="layout.spellcheckDefault"
|
||||
type="int"/>
|
||||
|
||||
#ifdef MOZ_TELEMETRY_REPORTING
|
||||
<preference id="toolkit.telemetry.enabled"
|
||||
name="toolkit.telemetry.enabled"
|
||||
type="bool"/>
|
||||
#endif
|
||||
|
||||
<!-- Data Choices tab -->
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
|
@ -189,6 +186,9 @@
|
|||
<!-- Data Choices -->
|
||||
<tabpanel id="dataChoicesPanel" orient="vertical">
|
||||
#ifdef MOZ_TELEMETRY_REPORTING
|
||||
<description>&healthReportingDisabled.label;</description>
|
||||
<separator class="thin"/>
|
||||
#endif
|
||||
<groupbox>
|
||||
<caption>
|
||||
<checkbox id="submitHealthReportBox" label="&enableHealthReport.label;"
|
||||
|
@ -216,7 +216,6 @@
|
|||
</hbox>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
#endif
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
<groupbox>
|
||||
<caption>
|
||||
|
|
|
@ -28,6 +28,11 @@
|
|||
|
||||
<!ENTITY dataChoicesTab.label "Data Choices">
|
||||
|
||||
<!-- LOCALIZATION NOTE (healthReportingDisabled.label): This message is displayed above
|
||||
disabled data sharing options in developer builds or builds with no Telemetry support
|
||||
available. -->
|
||||
<!ENTITY healthReportingDisabled.label "Data reporting is disabled for this build configuration">
|
||||
|
||||
<!ENTITY healthReportDesc.label "Helps you understand your browser performance and shares data with &vendorShortName; about your browser health">
|
||||
<!ENTITY enableHealthReport.label "Enable &brandShortName; Health Report">
|
||||
<!ENTITY enableHealthReport.accesskey "R">
|
||||
|
|
|
@ -28,6 +28,11 @@
|
|||
|
||||
<!ENTITY dataChoicesTab.label "Data Choices">
|
||||
|
||||
<!-- LOCALIZATION NOTE (healthReportingDisabled.label): This message is displayed above
|
||||
disabled data sharing options in developer builds or builds with no Telemetry support
|
||||
available. -->
|
||||
<!ENTITY healthReportingDisabled.label "Data reporting is disabled for this build configuration">
|
||||
|
||||
<!ENTITY healthReportDesc.label "Helps you understand your browser performance and shares data with &vendorShortName; about your browser health">
|
||||
<!ENTITY enableHealthReport.label "Enable &brandShortName; Health Report">
|
||||
<!ENTITY enableHealthReport.accesskey "R">
|
||||
|
|
Загрузка…
Ссылка в новой задаче