Bug 947078 - Make the "Include URLs" option for the crash reporter into a checkbox instead of a toggle.r=mbrubeck

This commit is contained in:
Allison Naaktgeboren 2014-01-15 11:32:22 -08:00
parent a4d4756db2
commit f9f90ae8ab
3 changed files with 36 additions and 25 deletions

View File

@ -974,6 +974,7 @@ var BrowserUI = {
case "cmd_undoCloseTab":
case "cmd_actions":
case "cmd_panel":
case "cmd_reportingCrashesSubmitURLs":
case "cmd_flyout_back":
case "cmd_sanitize":
case "cmd_volumeLeft":
@ -1081,6 +1082,10 @@ var BrowserUI = {
case "cmd_flyout_back":
FlyoutPanelsUI.onBackButton();
break;
case "cmd_reportingCrashesSubmitURLs":
let urlCheckbox = document.getElementById("prefs-reporting-submitURLs");
Services.prefs.setBoolPref('app.crashreporter.submitURLs', urlCheckbox.checked);
break;
case "cmd_panel":
PanelUI.toggle();
break;

View File

@ -97,6 +97,7 @@
<command id="cmd_history" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_sanitize" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_contextUI" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_reportingCrashesSubmitURLs" oncommand="CommandUpdater.doCommand(this.id);"/>
<!-- scrolling -->
<command id="cmd_scrollPageUp" oncommand="CommandUpdater.doCommand(this.id);"/>
@ -678,10 +679,10 @@ Desktop browser's sync prefs.
<setting pref="app.crashreporter.autosubmit"
type="bool"
title="&optionsHeader.reporting.crashes.label;" />
<setting pref="app.crashreporter.submitURLs"
id="prefs-reporting-submitURLs"
type="bool"
title="&optionsHeader.reporting.crashes.submitURLs;" />
<checkbox id="prefs-reporting-submitURLs"
cropped="end"
label="&optionsHeader.reporting.crashes.submitURLs;"
command="cmd_reportingCrashesSubmitURLs"/>
</settings>
<settings id="prefs-telemetry" label="&optionsHeader.telemetry.title;">
<setting pref="toolkit.telemetry.enabled" type="bool" title="&optionsHeader.telemetry.label;"/>

View File

@ -29,7 +29,8 @@ let PrefsFlyoutPanel = {
});
});
this._prefObserver(null, null, "privacy.donottrackheader.value");
this.observe(null, null, "privacy.donottrackheader.value");
this._updateSubmitURLs();
this._topmostElement = this._elements.PrefsFlyoutPanel;
},
@ -39,23 +40,23 @@ let PrefsFlyoutPanel = {
this._hasShown = true;
Services.prefs.addObserver("privacy.donottrackheader.value",
this._prefObserver,
this,
false);
Services.prefs.addObserver("privacy.donottrackheader.enabled",
this._prefObserver,
this,
false);
Services.prefs.addObserver("app.crashreporter.autosubmit",
this._prefObserver,
this,
false);
Services.prefs.addObserver("app.crashreporter.submitURLs",
this._prefObserver,
this,
false);
}
this._topmostElement.show();
},
_prefObserver: function(subject, topic, data) {
observe: function(subject, topic, data) {
let value = -1;
try {
value = Services.prefs.getIntPref("privacy.donottrackheader.value");
@ -90,26 +91,30 @@ let PrefsFlyoutPanel = {
case "app.crashreporter.autosubmit":
let autosubmit = Services.prefs.getBoolPref("app.crashreporter.autosubmit");
let urlCheckbox = document.getElementById("prefs-reporting-submitURLs");
if (!autosubmit) {
// If the user has selected not to submit crash reports, the UI
// should reflect also that URLs will not be included.
// TODO: Ideally we would grey out the text and the toggle for
// the "include URLs" pref, but the |setting| binding doesn't
// appear to support enabling/disabling. In the meantime, we just
// set the "include URLs" pref to false if the "send crash reports"
// pref has been set to false.
Services.prefs.setBoolPref('app.crashreporter.submitURLs', false);
// disables the submitURLs ui if no crashreports will be submited, but doesn't change the pref
urlCheckbox.setAttribute("disabled", true);
}
else {
urlCheckbox.setAttribute("disabled", false);
}
break;
case "app.crashreporter.submitURLs":
let submitURLs = Services.prefs.getBoolPref("app.crashreporter.submitURLs");
if (submitURLs) {
// If the user has selected to submit URLs, they are implicitly also
// selecting to submit crash reports. Let's update the autosubmit pref
Services.prefs.setBoolPref('app.crashreporter.autosubmit', true);
}
break;
this._updateSubmitURLs();
break;
}
},
_updateSubmitURLs: function() {
let submitURLs = Services.prefs.getBoolPref("app.crashreporter.submitURLs");
let urlCheckbox = document.getElementById("prefs-reporting-submitURLs");
if (submitURLs) {
urlCheckbox.checked = true;
}
else {
urlCheckbox.checked = false;
}
},
};