Bug 1429150 - Change nsIApplicationUpdateService::canCheckForUpdates implementation to respect new enterprise policy preventing app update
MozReview-Commit-ID: 7vPaDbONcRr
--- a/browser/base/content/aboutDialog-appUpdater.js
+++ b/browser/base/content/aboutDialog-appUpdater.js
@@ -132,18 +132,20 @@ 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 &&
+ !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 && !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) {