Bug 1503893 - Ensure Screenshots disable pref is checked at startup; r=aswan a=jcristau
authorJared Hirsch <ohai@6a68.net>
Sat, 10 Nov 2018 17:37:33 +0000
changeset 501231 4546853c31c18d5d886a76f13c6334656a2e8bbf
parent 501230 1633fd18c4b91b351c45c1dd3d9d60868c01779e
child 501232 501a272c7aad0d0f18fe0cc2499e7892280e1a8d
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan, jcristau
bugs1503893
milestone64.0
Bug 1503893 - Ensure Screenshots disable pref is checked at startup; r=aswan a=jcristau MozReview-Commit-ID: FGUaKbXhit2 Differential Revision: https://phabricator.services.mozilla.com/D11086
browser/components/nsBrowserGlue.js
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -1444,25 +1444,27 @@ BrowserGlue.prototype = {
     Normandy.uninit();
   },
 
   // Set up a listener to enable/disable the screenshots extension
   // based on its preference.
   _monitorScreenshotsPref() {
     const PREF = "extensions.screenshots.disabled";
     const ID = "screenshots@mozilla.org";
-    Services.prefs.addObserver(PREF, async () => {
+    const _checkScreenshotsPref = async () => {
       let addon = await AddonManager.getAddonByID(ID);
       let disabled = Services.prefs.getBoolPref(PREF, false);
       if (disabled) {
         await addon.disable({allowSystemAddons: true});
       } else {
         await addon.enable({allowSystemAddons: true});
       }
-    });
+    };
+    Services.prefs.addObserver(PREF, _checkScreenshotsPref);
+    _checkScreenshotsPref();
   },
 
   _monitorWebcompatReporterPref() {
     const PREF = "extensions.webcompat-reporter.enabled";
     const ID = "webcompat-reporter@mozilla.org";
     Services.prefs.addObserver(PREF, async () => {
       let addon = await AddonManager.getAddonByID(ID);
       let enabled = Services.prefs.getBoolPref(PREF, false);