summaryrefslogtreecommitdiff
path: root/www/firefox/files/patch-bug1312182
diff options
context:
space:
mode:
Diffstat (limited to 'www/firefox/files/patch-bug1312182')
-rw-r--r--www/firefox/files/patch-bug1312182376
1 files changed, 376 insertions, 0 deletions
diff --git a/www/firefox/files/patch-bug1312182 b/www/firefox/files/patch-bug1312182
new file mode 100644
index 000000000000..9c2b65f06d65
--- /dev/null
+++ b/www/firefox/files/patch-bug1312182
@@ -0,0 +1,376 @@
+commit 0d02dac1638ad
+Author: Alessio Placitelli <alessio.placitelli@gmail.com>
+Date: Tue May 30 10:42:42 2017 +0200
+
+ 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
+---
+ browser/base/content/baseMenuOverlay.xul | 2 +-
+ browser/components/nsBrowserGlue.js | 8 +--
+ .../components/preferences/in-content-new/main.xul | 2 -
+ .../preferences/in-content-new/privacy.js | 32 +++++------
+ .../preferences/in-content-new/privacy.xul | 14 ++---
+ .../components/preferences/in-content/advanced.js | 63 +++++++++++-----------
+ .../components/preferences/in-content/advanced.xul | 7 ++-
+ .../chrome/browser/preferences-old/advanced.dtd | 5 ++
+ .../en-US/chrome/browser/preferences/advanced.dtd | 5 ++
+ 9 files changed, 67 insertions(+), 71 deletions(-)
+
+diff --git browser/base/content/baseMenuOverlay.xul browser/base/content/baseMenuOverlay.xul
+index 1befa2bb66cc..804bbdebb797 100644
+--- browser/base/content/baseMenuOverlay.xul
++++ browser/base/content/baseMenuOverlay.xul
+@@ -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;"
+diff --git browser/components/nsBrowserGlue.js browser/components/nsBrowserGlue.js
+index 554c279356b9..1c21bf4c4323 100644
+--- browser/components/nsBrowserGlue.js
++++ browser/components/nsBrowserGlue.js
+@@ -528,9 +528,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");
+@@ -583,9 +581,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");
+diff --git browser/components/preferences/in-content-new/main.xul browser/components/preferences/in-content-new/main.xul
+index e89ee1891c91..8672557bede2 100644
+--- browser/components/preferences/in-content-new/main.xul
++++ browser/components/preferences/in-content-new/main.xul
+@@ -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"
+diff --git browser/components/preferences/in-content-new/privacy.js browser/components/preferences/in-content-new/privacy.js
+index be057bfad611..73f72391b991 100644
+--- browser/components/preferences/in-content-new/privacy.js
++++ browser/components/preferences/in-content-new/privacy.js
+@@ -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);
+diff --git browser/components/preferences/in-content-new/privacy.xul browser/components/preferences/in-content-new/privacy.xul
+index 9d531bd8274b..8030567573f8 100644
+--- browser/components/preferences/in-content-new/privacy.xul
++++ browser/components/preferences/in-content-new/privacy.xul
+@@ -760,9 +760,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;"/>
+@@ -782,14 +787,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"
+diff --git browser/components/preferences/in-content/advanced.js browser/components/preferences/in-content/advanced.js
+index a6a2abaad9cf..9c7a2e716403 100644
+--- browser/components/preferences/in-content/advanced.js
++++ browser/components/preferences/in-content/advanced.js
+@@ -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");
+-
+- let checkbox = document.getElementById("submitHealthReportBox");
++ this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
+
+- if (Services.prefs.prefIsLocked(PREF_UPLOAD_ENABLED)) {
+- checkbox.setAttribute("disabled", "true");
+- return;
+- }
++ let checkbox = document.getElementById("submitHealthReportBox");
+
+- 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() {
+diff --git browser/components/preferences/in-content/advanced.xul browser/components/preferences/in-content/advanced.xul
+index f2330223fb18..1b2c62168a59 100644
+--- browser/components/preferences/in-content/advanced.xul
++++ browser/components/preferences/in-content/advanced.xul
+@@ -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>
+diff --git browser/locales/en-US/chrome/browser/preferences-old/advanced.dtd browser/locales/en-US/chrome/browser/preferences-old/advanced.dtd
+index 215b800d3385..bf23c4fd251f 100644
+--- browser/locales/en-US/chrome/browser/preferences-old/advanced.dtd
++++ browser/locales/en-US/chrome/browser/preferences-old/advanced.dtd
+@@ -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">
+diff --git browser/locales/en-US/chrome/browser/preferences/advanced.dtd browser/locales/en-US/chrome/browser/preferences/advanced.dtd
+index 58a6b38630cf..6c478e48244a 100644
+--- browser/locales/en-US/chrome/browser/preferences/advanced.dtd
++++ browser/locales/en-US/chrome/browser/preferences/advanced.dtd
+@@ -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">