1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
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">
|