Bug 1498579 - Ensure the webcompat report addon is disabled upon load, if extensions.webcompat-reporter.enabled=false; r=aswan
authorThomas Wisniewski <twisniewski@mozilla.com>
Fri, 12 Oct 2018 21:23:52 +0000
changeset 489432 6beac5dc489916e57c24d79465c99085663f2cd0
parent 489431 4842c9240ccf7002a4139b85fab77af48b512571
child 489433 d545a48c1bfd7863036e179312f9fff45e335cff
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersaswan
bugs1498579
milestone64.0a1
Bug 1498579 - Ensure the webcompat report addon is disabled upon load, if extensions.webcompat-reporter.enabled=false; r=aswan Ensure the webcompat report addon is disabled upon load, if extensions.webcompat-reporter.enabled=false Differential Revision: https://phabricator.services.mozilla.com/D8613
browser/components/nsBrowserGlue.js
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -1446,25 +1446,27 @@ BrowserGlue.prototype = {
         await addon.enable({allowSystemAddons: true});
       }
     });
   },
 
   _monitorWebcompatReporterPref() {
     const PREF = "extensions.webcompat-reporter.enabled";
     const ID = "webcompat-reporter@mozilla.org";
-    Services.prefs.addObserver(PREF, async () => {
+    async function checkPref() {
       let addon = await AddonManager.getAddonByID(ID);
       let enabled = Services.prefs.getBoolPref(PREF, false);
       if (enabled && !addon.isActive) {
         await addon.enable({allowSystemAddons: true});
       } else if (!enabled && addon.isActive) {
         await addon.disable({allowSystemAddons: true});
       }
-    });
+    }
+    Services.prefs.addObserver(PREF, checkPref);
+    checkPref();
   },
 
   // All initial windows have opened.
   _onWindowsRestored: function BG__onWindowsRestored() {
     if (this._windowsWereRestored) {
       return;
     }
     this._windowsWereRestored = true;