Bug 1154591 - getCanStageUpdates has incorrect checks for Windows and B2G. r=bbondy, r=spohl
authorRobert Strong <robert.bugzilla@gmail.com>
Wed, 15 Apr 2015 08:44:48 -0700
changeset 239343 3cb6adf9dc710c9c4efd9701972ef4a82209e1c0
parent 239342 bcca2f834b76e2f88c1b069081f9edfa34c1c0d3
child 239344 404ab03433dbead90ba33be2c81b07263ace51b9
push id28589
push userryanvm@gmail.com
push dateWed, 15 Apr 2015 19:13:10 +0000
treeherdermozilla-central@24ccca4707eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy, spohl
bugs1154591
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1154591 - getCanStageUpdates has incorrect checks for Windows and B2G. r=bbondy, r=spohl
toolkit/mozapps/update/nsUpdateService.js
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -603,26 +603,30 @@ XPCOMUtils.defineLazyGetter(this, "gCanA
 function getCanStageUpdates() {
   // If background updates are disabled, then just bail out!
   if (!getPref("getBoolPref", PREF_APP_UPDATE_STAGING_ENABLED, false)) {
     LOG("getCanStageUpdates - staging updates is disabled by preference " +
         PREF_APP_UPDATE_STAGING_ENABLED);
     return false;
   }
 
+
+  if (AppConstants.platform == "win" && isServiceInstalled() &&
+      shouldUseService()) {
+    // No need to perform directory write checks, the maintenance service will
+    // be able to write to all directories.
+    LOG("getCanStageUpdates - able to stage updates because we'll use the service");
+    return true;
+  }
+
   // For Gonk, the updater will remount the /system partition to move staged
-  // files into place and it uses the app.update.service.enabled preference for
-  // this purpose.
-  if (AppConstants.platform == "win" || AppConstants.platform == "gonk") {
-    if (getPref("getBoolPref", PREF_APP_UPDATE_SERVICE_ENABLED, false)) {
-      // No need to perform directory write checks, the maintenance service will
-      // be able to write to all directories.
-      LOG("getCanStageUpdates - able to stage updates because we'll use the service");
-      return true;
-    }
+  // files into place.
+  if (AppConstants.platform == "gonk") {
+    LOG("getCanStageUpdates - able to stage updates because this is gonk");
+    return true;
   }
 
   if (!hasUpdateMutex()) {
     LOG("getCanStageUpdates - unable to apply updates because another " +
         "instance of the application is already handling updates for this " +
         "installation.");
     return false;
   }