diff --git a/browser/modules/ContentCrashHandlers.jsm b/browser/modules/ContentCrashHandlers.jsm index a1e33dd1a3e9..36e60ede4f03 100644 --- a/browser/modules/ContentCrashHandlers.jsm +++ b/browser/modules/ContentCrashHandlers.jsm @@ -660,6 +660,10 @@ this.UnsubmittedCrashHandler = { * If a notification cannot be shown, will resolve with null. */ async checkForUnsubmittedCrashReports() { + if (!this.enabled || this.suppressed) { + return null; + } + let dateLimit = new Date(); dateLimit.setDate(dateLimit.getDate() - PENDING_CRASH_REPORT_DAYS); diff --git a/browser/modules/test/browser/browser_UnsubmittedCrashHandler.js b/browser/modules/test/browser/browser_UnsubmittedCrashHandler.js index fcaae8d90322..1f216c991a71 100644 --- a/browser/modules/test/browser/browser_UnsubmittedCrashHandler.js +++ b/browser/modules/test/browser/browser_UnsubmittedCrashHandler.js @@ -206,6 +206,25 @@ add_task(async function setup() { // disabled is an intentional choice, as this allows for easier // simulation of startup and shutdown. UnsubmittedCrashHandler.uninit(); + + // While we're here, let's test that we don't show the notification + // if we're disabled and something happens to check for unsubmitted + // crash reports. + await SpecialPowers.pushPrefEnv({ + set: [ + ["browser.crashReports.unsubmittedCheck.enabled", false], + ], + }); + + await createPendingCrashReports(1); + + notification = + await UnsubmittedCrashHandler.checkForUnsubmittedCrashReports(); + Assert.ok(!notification, "There should not be a notification"); + + clearPendingCrashReports(); + await SpecialPowers.popPrefEnv(); + await SpecialPowers.pushPrefEnv({ set: [ ["browser.crashReports.unsubmittedCheck.enabled", true],