Bug 1075055 - Make it impossible to turn on telemetry unless FHR is also turned on. r=jaws

This commit is contained in:
Alessio Placitelli 2015-02-19 12:06:00 -08:00
parent f4feb92a6e
commit 7dfb061f84
5 changed files with 109 additions and 66 deletions

View File

@ -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

View File

@ -167,51 +167,50 @@
#ifdef MOZ_DATA_REPORTING
<!-- Data Choices -->
<tabpanel id="dataChoicesPanel" orient="vertical">
#ifdef MOZ_TELEMETRY_REPORTING
<groupbox>
<caption label="&telemetrySection.label;"/>
<description>&telemetryDesc.label;</description>
<hbox>
<checkbox id="submitTelemetryBox"
preference="toolkit.telemetry.enabled"
label="&enableTelemetry.label;"
accesskey="&enableTelemetry.accesskey;"/>
<spacer flex="1"/>
<label id="telemetryLearnMore"
class="text-link"
value="&telemetryLearnMore.label;"
onclick="gAdvancedPane.openTextLink(event)"/>
</hbox>
</groupbox>
#endif
#ifdef MOZ_SERVICES_HEALTHREPORT
<groupbox>
<caption label="&healthReportSection.label;"/>
<description>&healthReportDesc.label;</description>
<hbox>
<checkbox id="submitHealthReportBox"
<caption>
<checkbox id="submitHealthReportBox" label="&enableHealthReport.label;"
oncommand="gAdvancedPane.updateSubmitHealthReport();"
label="&enableHealthReport.label;"
accesskey="&enableHealthReport.accesskey;"/>
<spacer flex="1"/>
<label id="FHRLearnMore"
class="text-link"
</caption>
<vbox>
<hbox class="indent">
<label flex="1">&healthReportDesc.label;</label>
<spacer flex="10"/>
<label id="FHRLearnMore" class="text-link"
value="&healthReportLearnMore.label;"
onclick="gAdvancedPane.openTextLink(event)"/>
</hbox>
#ifdef MOZ_TELEMETRY_REPORTING
<hbox class="indent">
<vbox flex="1">
<checkbox id="submitTelemetryBox" label="&enableTelemetryData.label;"
preference="toolkit.telemetry.enabled"
accesskey="&enableTelemetryData.accesskey;"/>
<hbox class="indent">
<label id="telemetryDataDesc" flex="1">&telemetryDesc.label;</label>
<spacer flex="10"/>
<label id="telemetryLearnMore" class="text-link"
value="&telemetryLearnMore.label;"
onclick="gAdvancedPane.openTextLink(event)"/>
</hbox>
</vbox>
</hbox>
#endif
</vbox>
</groupbox>
#endif
#ifdef MOZ_CRASHREPORTER
<groupbox>
<caption label="&crashReporterSection.label;"/>
<description>&crashReporterDesc.label;</description>
<hbox>
<checkbox id="submitCrashesBox"
<caption>
<checkbox id="submitCrashesBox" label="&enableCrashReporter.label;"
oncommand="gAdvancedPane.updateSubmitCrashes();"
label="&enableCrashReporter.label;"
accesskey="&enableCrashReporter.accesskey;"/>
<spacer flex="1"/>
</caption>
<hbox class="indent">
<label flex="1">&crashReporterDesc.label;</label>
<spacer flex="10"/>
<label id="crashReporterLearnMore"
class="text-link"
value="&crashReporterLearnMore.label;"

View File

@ -263,6 +263,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.
@ -283,6 +301,7 @@ var gAdvancedPane = {
}
checkbox.checked = policy.healthReportUploadEnabled;
this.setTelemetrySectionEnabled(checkbox.checked);
},
/**
@ -301,6 +320,7 @@ var gAdvancedPane = {
let checkbox = document.getElementById("submitHealthReportBox");
policy.recordHealthReportUploadEnabled(checkbox.checked,
"Checkbox from preferences pane");
this.setTelemetrySectionEnabled(checkbox.checked);
},
#endif

View File

@ -192,45 +192,48 @@
#ifdef MOZ_DATA_REPORTING
<!-- Data Choices -->
<tabpanel id="dataChoicesPanel" orient="vertical">
#ifdef MOZ_TELEMETRY_REPORTING
#ifdef MOZ_SERVICES_HEALTHREPORT
<groupbox>
<caption><label>&telemetrySection.label;</label></caption>
<description>&telemetryDesc.label;</description>
<hbox>
<checkbox id="submitTelemetryBox"
preference="toolkit.telemetry.enabled"
label="&enableTelemetry.label;"
accesskey="&enableTelemetry.accesskey;"/>
<spacer flex="1"/>
<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>
#ifdef MOZ_TELEMETRY_REPORTING
<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>
#endif
#ifdef MOZ_SERVICES_HEALTHREPORT
<groupbox>
<caption><label>&healthReportSection.label;</label></caption>
<description>&healthReportDesc.label;</description>
<hbox>
<checkbox id="submitHealthReportBox"
label="&enableHealthReport.label;"
accesskey="&enableHealthReport.accesskey;"/>
<spacer flex="1"/>
<label id="FHRLearnMore"
class="text-link">&healthReportLearnMore.label;</label>
</hbox>
#endif
</vbox>
</groupbox>
#endif
#ifdef MOZ_CRASHREPORTER
<groupbox>
<caption><label>&crashReporterSection.label;</label></caption>
<description>&crashReporterDesc.label;</description>
<hbox>
<checkbox id="submitCrashesBox"
label="&enableCrashReporter.label;"
<caption>
<checkbox id="submitCrashesBox" label="&enableCrashReporter.label;"
accesskey="&enableCrashReporter.accesskey;"/>
<spacer flex="1"/>
</caption>
<hbox class="indent">
<label flex="1">&crashReporterDesc.label;</label>
<spacer flex="10"/>
<label id="crashReporterLearnMore"
class="text-link">&crashReporterLearnMore.label;</label>
</hbox>

View File

@ -40,6 +40,7 @@ xul|caption {
margin: 0;
}
xul|caption > xul|checkbox,
xul|caption > xul|label {
font-size: 1.3rem;
font-weight: bold;