Bug 1287178 - Make UnsubmittedCrashHandler pay attention to preference for automatically submitting un-submitted crash reports. r?felipe
MozReview-Commit-ID: ClXHYRLFGpu
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -715,19 +715,20 @@ certErrorDetailsCertChain.label = Certif
# LOCALIZATION NOTE (tabgroups.migration.anonGroup):
# %S is the group number/ID
tabgroups.migration.anonGroup = Group %S
tabgroups.migration.tabGroupBookmarkFolderName = Bookmarked Tab Groups
# LOCALIZATION NOTE (pendingCrashReports.label): Semi-colon list of plural forms
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# #1 is the number of pending crash reports
-pendingCrashReports.label = You have an unsubmitted crash report;You have #1 unsubmitted crash reports
+pendingCrashReports2.label = You have an unsent crash report;You have #1 unsent crash reports
pendingCrashReports.viewAll = View
-pendingCrashReports.submitAll = Submit
+pendingCrashReports.send = Send
+pendingCrashReports.alwaysSend = Always Send
decoder.noCodecs.button = Learn how
decoder.noCodecs.accesskey = L
decoder.noCodecs.message = To play video, you may need to install Microsoft’s Media Feature Pack.
decoder.noCodecsVista.message = To play video, you may need to install Microsoft’s Platform Update Supplement for Windows Vista.
decoder.noCodecsXP.message = To play video, you may need to enable Adobe’s Primetime Content Decryption Module.
decoder.noCodecsLinux.message = To play video, you may need to install the required video codecs.
decoder.noHWAcceleration.message = To improve video quality, you may need to install Microsoft’s Media Feature Pack.
--- a/browser/modules/ContentCrashHandlers.jsm
+++ b/browser/modules/ContentCrashHandlers.jsm
@@ -334,17 +334,19 @@ this.TabCrashHandler = {
return this.childMap.get(this.browserMap.get(browser.permanentKey));
},
}
/**
* This component is responsible for scanning the pending
* crash report directory for reports, and (if enabled), to
- * prompt the user to submit those reports.
+ * prompt the user to submit those reports. It might also
+ * submit those reports automatically without prompting if
+ * the user has opted in.
*/
this.UnsubmittedCrashHandler = {
init() {
if (this.initialized) {
return;
}
this.initialized = true;
@@ -386,17 +388,21 @@ this.UnsubmittedCrashHandler = {
try {
reportIDs = yield CrashSubmit.pendingIDsAsync(dateLimit);
} catch (e) {
Cu.reportError(e);
return;
}
if (reportIDs.length) {
- this.showPendingSubmissionsNotification(reportIDs);
+ if (CrashNotificationBar.autoSubmit) {
+ CrashNotificationBar.submitReports(reportIDs);
+ } else {
+ this.showPendingSubmissionsNotification(reportIDs);
+ }
}
}),
/**
* Given an array of unsubmitted crash report IDs, try to open
* up a notification asking the user to submit them.
*
* @param reportIDs (Array<string>)
@@ -404,17 +410,17 @@ this.UnsubmittedCrashHandler = {
*/
showPendingSubmissionsNotification(reportIDs) {
let count = reportIDs.length;
if (!count) {
return;
}
let messageTemplate =
- gNavigatorBundle.GetStringFromName("pendingCrashReports.label");
+ gNavigatorBundle.GetStringFromName("pendingCrashReports2.label");
let message = PluralForm.get(count, messageTemplate).replace("#1", count);
CrashNotificationBar.show({
notificationID: "pending-crash-reports",
message,
reportIDs,
});
@@ -456,22 +462,29 @@ this.CrashNotificationBar = {
let nb = chromeWin.document.getElementById("global-notificationbox");
let notification = nb.getNotificationWithValue(notificationID);
if (notification) {
return;
}
let buttons = [{
- label: gNavigatorBundle.GetStringFromName("pendingCrashReports.submitAll"),
+ label: gNavigatorBundle.GetStringFromName("pendingCrashReports.send"),
callback: () => {
this.submitReports(reportIDs);
},
},
{
+ label: gNavigatorBundle.GetStringFromName("pendingCrashReports.alwaysSend"),
+ callback: () => {
+ this.autoSubmit = true;
+ this.submitReports(reportIDs);
+ },
+ },
+ {
label: gNavigatorBundle.GetStringFromName("pendingCrashReports.viewAll"),
callback: function() {
chromeWin.openUILinkIn("about:crashes", "tab");
return true;
},
}];
let eventCallback = (eventType) => {
@@ -487,16 +500,26 @@ this.CrashNotificationBar = {
};
nb.appendNotification(message, notificationID,
"chrome://browser/skin/tab-crashed.svg",
nb.PRIORITY_INFO_HIGH, buttons,
eventCallback);
},
+ get autoSubmit() {
+ return Services.prefs
+ .getBoolPref("browser.crashReports.unsubmittedCheck.autoSubmit");
+ },
+
+ set autoSubmit(val) {
+ Services.prefs.setBoolPref("browser.crashReports.unsubmittedCheck.autoSubmit",
+ val);
+ },
+
/**
* Attempt to submit reports to the crash report server. Each
* report will have the "SubmittedFromInfobar" extra key set
* to true.
*
* @param reportIDs (Array<string>)
* The array of reportIDs to submit.
*/