From 7052fb0db7838a9670101211e029d3d9058234b2 Mon Sep 17 00:00:00 2001 From: Alessio Placitelli Date: Thu, 19 Feb 2015 12:06:00 -0800 Subject: [PATCH] Bug 1075055 - Make it impossible to turn on telemetry unless FHR is also turned on. r=jaws --HG-- extra : rebase_source : 6a4afae0a221d4b2dd8770834a080869770802f4 --- browser/components/preferences/advanced.js | 20 ++++++ browser/components/preferences/advanced.xul | 69 +++++++++---------- .../preferences/in-content/advanced.js | 20 ++++++ .../preferences/in-content/advanced.xul | 65 ++++++++--------- .../themes/shared/in-content/common.inc.css | 1 + 5 files changed, 109 insertions(+), 66 deletions(-) diff --git a/browser/components/preferences/advanced.js b/browser/components/preferences/advanced.js index 98dc8860a05d..fc4df4dad685 100644 --- a/browser/components/preferences/advanced.js +++ b/browser/components/preferences/advanced.js @@ -234,6 +234,24 @@ var gAdvancedPane = { #endif }, + /** + * 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) + { +#ifdef 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. + document.getElementById("submitTelemetryBox").checked = false; + } + document.getElementById("telemetryDataDesc").disabled = disabled; +#endif + }, + #ifdef MOZ_SERVICES_HEALTHREPORT /** * Initialize the health report service reference and checkbox. @@ -254,6 +272,7 @@ var gAdvancedPane = { } checkbox.checked = policy.healthReportUploadEnabled; + this.setTelemetrySectionEnabled(checkbox.checked); }, /** @@ -272,6 +291,7 @@ var gAdvancedPane = { let checkbox = document.getElementById("submitHealthReportBox"); policy.recordHealthReportUploadEnabled(checkbox.checked, "Checkbox from preferences pane"); + this.setTelemetrySectionEnabled(checkbox.checked); }, #endif diff --git a/browser/components/preferences/advanced.xul b/browser/components/preferences/advanced.xul index 7f09ee8d3f29..8880c54aca6e 100644 --- a/browser/components/preferences/advanced.xul +++ b/browser/components/preferences/advanced.xul @@ -167,51 +167,50 @@ #ifdef MOZ_DATA_REPORTING -#ifdef MOZ_TELEMETRY_REPORTING - - - &telemetryDesc.label; - - - - - -#endif #ifdef MOZ_SERVICES_HEALTHREPORT - - &healthReportDesc.label; - - + - - + + + + + + +#ifdef MOZ_TELEMETRY_REPORTING + + + + + + + + + +#endif + #endif #ifdef MOZ_CRASHREPORTER - - &crashReporterDesc.label; - - + - - + + + +