Bug 1287178 - Don't prompt to submit crash reports if user has disabled crash submission in preferences. r?mconley draft
authorSebastian Hengst <archaeopteryx@coole-files.de>
Thu, 28 Jul 2016 20:35:00 +0200
changeset 393913 329b3061001bbf3f66bcd9e440e04532dc4b655f
parent 393484 db3ed1fdbbeaf5ab1e8fe454780146e7499be3db
child 526692 afaa166c7d2ab0c4e61749ed30ec9af3d7314979
push id24439
push userarchaeopteryx@coole-files.de
push dateThu, 28 Jul 2016 18:36:22 +0000
reviewersmconley
bugs1287178
milestone50.0a1
Bug 1287178 - Don't prompt to submit crash reports if user has disabled crash submission in preferences. r?mconley MozReview-Commit-ID: F8w5NByt4H9
browser/components/nsBrowserGlue.js
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -127,16 +127,19 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource:///modules/ContentCrashHandlers.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
                                   "resource://gre/modules/PluralForm.jsm");
 if (AppConstants.MOZ_CRASHREPORTER) {
   XPCOMUtils.defineLazyModuleGetter(this, "PluginCrashReporter",
                                     "resource:///modules/ContentCrashHandlers.jsm");
   XPCOMUtils.defineLazyModuleGetter(this, "CrashSubmit",
                                     "resource://gre/modules/CrashSubmit.jsm");
+  XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter",
+                                     "@mozilla.org/xre/app-info;1",
+                                     "nsICrashReporter");
 }
 
 XPCOMUtils.defineLazyGetter(this, "gBrandBundle", function() {
   return Services.strings.createBundle('chrome://branding/locale/brand.properties');
 });
 
 XPCOMUtils.defineLazyGetter(this, "gBrowserBundle", function() {
   return Services.strings.createBundle('chrome://browser/locale/browser.properties');
@@ -846,16 +849,19 @@ BrowserGlue.prototype = {
       }
     }
   },
 
   checkForPendingCrashReports: function() {
     // We don't process crash reports older than 28 days, so don't bother submitting them
     const PENDING_CRASH_REPORT_DAYS = 28;
     if (AppConstants.MOZ_CRASHREPORTER) {
+      if (!CrashReporter.enabled || !CrashReporter.submitReports) {
+        return;
+      }
       let dateLimit = new Date();
       dateLimit.setDate(dateLimit.getDate() - PENDING_CRASH_REPORT_DAYS);
       CrashSubmit.pendingIDsAsync(dateLimit).then(
         function onSuccess(ids) {
           let count = ids.length;
           if (count) {
             let win = RecentWindow.getMostRecentBrowserWindow();
             let nb =  win.document.getElementById("global-notificationbox");