Bug 1429150 - Change nsIApplicationUpdateService::canCheckForUpdates implementation to respect new enterprise policy preventing app update r=Felipe,mhowell
☠☠ backed out by 8ffd7252f4b9 ☠ ☠
authorKirk Steuber <ksteuber@mozilla.com>
Thu, 08 Feb 2018 09:41:54 -0800
changeset 752917 1f2d0e869605d682309d5d3c910a4a8e35ed2268
parent 752916 61eeb80f413cab34f9f7783a21259cb86517dad8
child 752918 23a86891fdaf2bb327dbad17d6dbb92bb8be81eb
push id98429
push usermak77@bonardo.net
push dateFri, 09 Feb 2018 10:14:12 +0000
reviewersFelipe, mhowell
bugs1429150
milestone60.0a1
Bug 1429150 - Change nsIApplicationUpdateService::canCheckForUpdates implementation to respect new enterprise policy preventing app update r=Felipe,mhowell MozReview-Commit-ID: 7vPaDbONcRr
browser/base/content/aboutDialog-appUpdater.js
toolkit/mozapps/update/nsUpdateService.js
--- a/browser/base/content/aboutDialog-appUpdater.js
+++ b/browser/base/content/aboutDialog-appUpdater.js
@@ -132,18 +132,19 @@ appUpdater.prototype =
     if (this.update)
       return this.update.state == "downloading";
     return this.um.activeUpdate &&
            this.um.activeUpdate.state == "downloading";
   },
 
   // true when updating is disabled by an administrator.
   get updateDisabledAndLocked() {
-    return !this.updateEnabled &&
-           Services.prefs.prefIsLocked("app.update.enabled");
+    return (!this.updateEnabled &&
+           Services.prefs.prefIsLocked("app.update.enabled")) ||
+           !Services.policies.isAllowed("appUpdate");
   },
 
   // true when updating is enabled.
   get updateEnabled() {
     try {
       return Services.prefs.getBoolPref("app.update.enabled");
     } catch (e) { }
     return true; // Firefox default is true
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -533,16 +533,22 @@ XPCOMUtils.defineLazyGetter(this, "gCanC
   // getter since locked prefs don't change until the application is restarted.
   var enabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED, true);
   if (!enabled && Services.prefs.prefIsLocked(PREF_APP_UPDATE_ENABLED)) {
     LOG("gCanCheckForUpdates - unable to automatically check for updates, " +
         "the preference is disabled and admistratively locked.");
     return false;
   }
 
+  if (!Services.policies.isAllowed("appUpdate")) {
+    LOG("gCanCheckForUpdates - unable to automatically check for updates. " +
+        "Functionality disabled by enterprise policy.");
+    return false;
+  }
+
   // If we don't know the binary platform we're updating, we can't update.
   if (!UpdateUtils.ABI) {
     LOG("gCanCheckForUpdates - unable to check for updates, unknown ABI");
     return false;
   }
 
   // If we don't know the OS version we're updating, we can't update.
   if (!UpdateUtils.OSVersion) {