From 77b64d365c24d261f4841520435e442e5e6f9383 Mon Sep 17 00:00:00 2001 From: Kirk Steuber Date: Thu, 8 Feb 2018 09:41:54 -0800 Subject: [PATCH] Bug 1429150 - Change nsIApplicationUpdateService::canCheckForUpdates implementation to respect new enterprise policy preventing app update r=Felipe,mhowell MozReview-Commit-ID: 7vPaDbONcRr --HG-- extra : rebase_source : 9c9f75dd72c9acdc2f70311e0fed31366f51bc13 --- browser/base/content/aboutDialog-appUpdater.js | 6 ++++-- toolkit/mozapps/update/nsUpdateService.js | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/browser/base/content/aboutDialog-appUpdater.js b/browser/base/content/aboutDialog-appUpdater.js index adf2293ce150..a543fd3ee2fb 100644 --- a/browser/base/content/aboutDialog-appUpdater.js +++ b/browser/base/content/aboutDialog-appUpdater.js @@ -137,8 +137,10 @@ appUpdater.prototype = // 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. diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js index 6d29dabeeb45..d221073f7664 100644 --- a/toolkit/mozapps/update/nsUpdateService.js +++ b/toolkit/mozapps/update/nsUpdateService.js @@ -538,6 +538,12 @@ XPCOMUtils.defineLazyGetter(this, "gCanCheckForUpdates", function aus_gCanCheckF 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");