Bug 1458308 - Change lookups of app.update.auto to use nsIApplicationUpdateService::(get|set)AutoUpdateIsEnabled r=rstrong
authorKirk Steuber <ksteuber@mozilla.com>
Tue, 06 Nov 2018 21:18:21 +0000
changeset 444731 1b57a28b1e90c3d3c53c575090f4f98b493e452c
parent 444730 c6a1aa25f4fda10ef6f95a3d6d74285c2dbd74ea
child 444732 663e1f142dd49d3bc7912a4e7661bdf7d02cda89
push id35001
push userncsoregi@mozilla.com
push dateWed, 07 Nov 2018 09:52:11 +0000
treeherdermozilla-central@bc83ec5a338d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrstrong
bugs1458308
milestone65.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 1458308 - Change lookups of app.update.auto to use nsIApplicationUpdateService::(get|set)AutoUpdateIsEnabled r=rstrong This patch also contains a few additional minor changes: - Clears the user value set to the pref app.update.auto after the value is migrated. - Fixes the app.update.auto pref migration test - Makes a number of functions asynchronous to allow them to wait for app.update.auto setting changes - TestAUSHelper's create-update-dir command no longer tries to set the permissions on all files in the update directory. Fixes a potential race condition when creating the update directory. Depends on D4594 Differential Revision: https://phabricator.services.mozilla.com/D10315
browser/components/enterprisepolicies/tests/browser/browser_policy_app_update.js
browser/components/enterprisepolicies/tests/browser/disable_app_update/browser.ini
toolkit/components/telemetry/Histograms.json
toolkit/mozapps/update/common/commonupdatedir.cpp
toolkit/mozapps/update/content/updates.js
toolkit/mozapps/update/nsUpdateService.js
toolkit/mozapps/update/tests/TestAUSHelper.cpp
toolkit/mozapps/update/tests/browser/browser_TelemetryUpdatePing.js
toolkit/mozapps/update/tests/browser/browser_updateAutoPrefUI.js
toolkit/mozapps/update/tests/browser/browser_updatesBackgroundWindow.js
toolkit/mozapps/update/tests/browser/browser_updatesBasicPrompt.js
toolkit/mozapps/update/tests/browser/browser_updatesBasicPromptNoStaging.js
toolkit/mozapps/update/tests/browser/head.js
toolkit/mozapps/update/tests/chrome/test_0010_background_basic.xul
toolkit/mozapps/update/tests/chrome/test_0152_notify_backgroundCheckOfflineRetry.xul
toolkit/mozapps/update/tests/chrome/utils.js
toolkit/mozapps/update/tests/data/shared.js
toolkit/mozapps/update/tests/unit_aus_update/uiAutoPref.js
toolkit/mozapps/update/tests/unit_aus_update/updateAutoPrefMigrate.js
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_app_update.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_app_update.js
@@ -6,16 +6,24 @@ var updateService = Cc["@mozilla.org/upd
                     getService(Ci.nsIApplicationUpdateService);
 
 // This test is intended to ensure that nsIUpdateService::canCheckForUpdates
 // is true before the "DisableAppUpdate" policy is applied. Testing that
 // nsIUpdateService::canCheckForUpdates is false after the "DisableAppUpdate"
 // policy is applied needs to occur in a different test since the policy does
 // not properly take effect unless it is applied during application startup.
 add_task(async function test_updates_pre_policy() {
+  // Turn off automatic update before we set app.update.disabledForTesting to
+  // false so that we don't cause an actual update.
+  let originalUpdateAutoValue = await updateService.getAutoUpdateIsEnabled();
+  await updateService.setAutoUpdateIsEnabled(false);
+  registerCleanupFunction(async () => {
+    await updateService.setAutoUpdateIsEnabled(originalUpdateAutoValue);
+  });
+
   await SpecialPowers.pushPrefEnv({"set": [["app.update.disabledForTesting", false]]});
 
   is(Services.policies.isAllowed("appUpdate"), true,
      "Since no policies have been set, appUpdate should be allowed by default");
 
   is(updateService.canCheckForUpdates, true,
      "Should be able to check for updates before any policies are in effect.");
 });
--- a/browser/components/enterprisepolicies/tests/browser/disable_app_update/browser.ini
+++ b/browser/components/enterprisepolicies/tests/browser/disable_app_update/browser.ini
@@ -1,9 +1,8 @@
 [DEFAULT]
 prefs =
   app.update.disabledForTesting=false
-  app.update.auto=true
   browser.policies.alternatePath='<test-root>/browser/components/enterprisepolicies/tests/browser/disable_app_update/config_disable_app_update.json'
 support-files =
   config_disable_app_update.json
 
 [browser_policy_disable_app_update.js]
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -5659,26 +5659,26 @@
   },
   "UPDATE_NOT_PREF_UPDATE_AUTO_EXTERNAL": {
     "record_in_processes": ["main"],
     "alert_emails": ["application-update-telemetry-alerts@mozilla.com"],
     "expires_in_version": "never",
     "kind": "count",
     "releaseChannelCollection": "opt-out",
     "bug_numbers": [1137447],
-    "description": "Update: count of when the app.update.auto boolean preference is not the default value of true (true values are not submitted)"
+    "description": "Update: count of when nsIApplicationUpdateService::getAutoUpdateIsEnabled does not return the default value of true (true values are not submitted)"
   },
   "UPDATE_NOT_PREF_UPDATE_AUTO_NOTIFY": {
     "record_in_processes": ["main"],
     "alert_emails": ["application-update-telemetry-alerts@mozilla.com"],
     "expires_in_version": "never",
     "kind": "count",
     "releaseChannelCollection": "opt-out",
     "bug_numbers": [1137447],
-    "description": "Update: count of when the app.update.auto boolean preference is not the default value of true (true values are not submitted)"
+    "description": "Update: count of when nsIApplicationUpdateService::getAutoUpdateIsEnabled does not return the default value of true (true values are not submitted)"
   },
   "UPDATE_NOT_PREF_UPDATE_STAGING_ENABLED_EXTERNAL": {
     "record_in_processes": ["main"],
     "alert_emails": ["application-update-telemetry-alerts@mozilla.com"],
     "expires_in_version": "never",
     "kind": "count",
     "releaseChannelCollection": "opt-out",
     "bug_numbers": [1137447],
--- a/toolkit/mozapps/update/common/commonupdatedir.cpp
+++ b/toolkit/mozapps/update/common/commonupdatedir.cpp
@@ -756,18 +756,41 @@ SetUpdateDirectoryPermissions(const Simp
     // Now that there is nothing in the way of our base directory, create it.
     BOOL success = CreateDirectoryW(basePath.String(),
                                     &perms.securityAttributes);
     if (success) {
       // We successfully created a directory. It is safe to assume that it is
       // empty, so there is no reason to check the permissions of its contents.
       return returnValue;
     } else {
-      returnValue = FAILED(returnValue) ? returnValue
-                                        : HRESULT_FROM_WIN32(GetLastError());
+      DWORD error = GetLastError();
+      if (error != ERROR_ALREADY_EXISTS) {
+        returnValue = FAILED(returnValue) ? returnValue
+                                          : HRESULT_FROM_WIN32(error);
+      } else {
+        // There is a bit of a race condition here that needs to be resolved.
+        // Make sure no one else created the directory just before this process
+        // tried to.
+        attributes = GetFileAttributesW(basePath.String());
+        if (attributes == INVALID_FILE_ATTRIBUTES ||
+            !(attributes & FILE_ATTRIBUTE_DIRECTORY)) {
+          returnValue = FAILED(returnValue) ? returnValue
+                                            : HRESULT_FROM_WIN32(error);
+        } else if (permsToSet != SetPermissionsOf::BaseDirIfNotExists) {
+          // Great! The update directory seems to exist and is a directory. Now,
+          // if the caller requested it, set the permissions of the directory.
+          mutableBasePath.CopyFrom(basePath);
+          if (mutableBasePath.Length() == 0) {
+            returnValue = FAILED(returnValue) ? returnValue : E_OUTOFMEMORY;
+          } else {
+            hrv = SetPathPerms(mutableBasePath, perms);
+            returnValue = FAILED(returnValue) ? returnValue : hrv;
+          }
+        }
+      }
     }
   }
 
   // We have now done our best to ensure that the base directory exists and has
   // the right permissions set. We only need to continue if we are setting the
   // permissions on all contained files.
   if (permsToSet != SetPermissionsOf::AllFilesAndDirs) {
     return returnValue;
--- a/toolkit/mozapps/update/content/updates.js
+++ b/toolkit/mozapps/update/content/updates.js
@@ -7,19 +7,22 @@
 
 /* import-globals-from ../../../content/contentAreaUtils.js */
 
 /* globals DownloadUtils, Services, AUSTLMY */
 ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm", this);
 ChromeUtils.import("resource://gre/modules/Services.jsm", this);
 ChromeUtils.import("resource://gre/modules/UpdateTelemetry.jsm", this);
 
+XPCOMUtils.defineLazyServiceGetter(this, "gAUS",
+                                   "@mozilla.org/updates/update-service;1",
+                                   "nsIApplicationUpdateService");
+
 const XMLNS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 
-const PREF_APP_UPDATE_AUTO                = "app.update.auto";
 const PREF_APP_UPDATE_BACKGROUNDERRORS    = "app.update.backgroundErrors";
 const PREF_APP_UPDATE_CERT_ERRORS         = "app.update.cert.errors";
 const PREF_APP_UPDATE_ELEVATE_NEVER       = "app.update.elevate.never";
 const PREF_APP_UPDATE_LOG                 = "app.update.log";
 const PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED = "app.update.notifiedUnsupported";
 const PREF_APP_UPDATE_URL_MANUAL          = "app.update.url.manual";
 
 const URI_UPDATES_PROPERTIES  = "chrome://mozapps/locale/update/updates.properties";
@@ -199,19 +202,17 @@ var gUpdates = {
       return this.strings.getFormattedString(key, strings);
     return this.strings.getString(key);
   },
 
   never() {
     // If the user clicks "No Thanks", we should not prompt them to update to
     // this version again unless they manually select "Check for Updates..."
     // which will clear app.update.elevate.never preference.
-    let aus = Cc["@mozilla.org/updates/update-service;1"].
-              getService(Ci.nsIApplicationUpdateService);
-    if (aus.elevationRequired) {
+    if (gAUS.elevationRequired) {
       Services.prefs.setCharPref(PREF_APP_UPDATE_ELEVATE_NEVER,
                                  this.update.appVersion);
     }
   },
 
   /**
    * A hash of |pageid| attribute to page object. Can be used to dispatch
    * function calls to the appropriate page.
@@ -258,17 +259,19 @@ var gUpdates = {
   /**
    * The checking process that spawned this update UI. There are two types:
    * SRCEVT_FOREGROUND:
    *   Some user-generated event caused this UI to appear, e.g. the Help
    *   menu item or the button in preferences. When in this mode, the UI
    *   should remain active for the duration of the download.
    * SRCEVT_BACKGROUND:
    *   A background update check caused this UI to appear, probably because
-   *   the user has the app.update.auto preference set to false.
+   *   nsIApplicationUpdateService::getAutoUpdateIsEnabled returned false,
+   *   indicating that the user has selected the setting "Check for updates but
+   *   let you choose to install them".
    */
   sourceEvent: SRCEVT_FOREGROUND,
 
   /**
    * Helper function for onLoad
    * Saves default button label & accesskey for use by _setButton
    */
   _cacheButtonStrings(buttonName) {
@@ -396,19 +399,17 @@ var gUpdates = {
               return;
             case STATE_DOWNLOAD_FAILED:
             case STATE_APPLYING:
               aCallback("errors");
               return;
           }
         }
 
-        let aus = Cc["@mozilla.org/updates/update-service;1"].
-                  getService(Ci.nsIApplicationUpdateService);
-        if (!aus.canApplyUpdates) {
+        if (!gAUS.canApplyUpdates) {
           aCallback("manualUpdate");
           return;
         }
 
         aCallback(this.updatesFoundPageId);
         return;
       }
     } else {
@@ -499,35 +500,33 @@ var gCheckingPage = {
    * An object implementing nsIUpdateCheckListener that is notified as the
    * update check commences.
    */
   updateListener: {
     /**
      * See nsIUpdateCheckListener
      */
     onCheckComplete(request, updates, updateCount) {
-      var aus = Cc["@mozilla.org/updates/update-service;1"].
-                getService(Ci.nsIApplicationUpdateService);
-      gUpdates.setUpdate(aus.selectUpdate(updates, updates.length));
+      gUpdates.setUpdate(gAUS.selectUpdate(updates, updates.length));
       if (gUpdates.update) {
         LOG("gCheckingPage", "onCheckComplete - update found");
         if (gUpdates.update.unsupported) {
           gUpdates.wiz.goTo("unsupported");
           return;
         }
 
         if (gUpdates.update.elevationFailure) {
           // Prevent multiple notifications for the same update when the client
           // has had an elevation failure.
           gUpdates.never();
           gUpdates.wiz.goTo("manualUpdate");
           return;
         }
 
-        if (!aus.canApplyUpdates) {
+        if (!gAUS.canApplyUpdates) {
           gUpdates.wiz.goTo("manualUpdate");
           return;
         }
 
         gUpdates.wiz.goTo(gUpdates.updatesFoundPageId);
         return;
       }
 
@@ -553,26 +552,27 @@ var gCheckingPage = {
 
 /**
  * The "No Updates Are Available" page
  */
 var gNoUpdatesPage = {
   /**
    * Initialize
    */
-  onPageShow() {
+  async onPageShow() {
     LOG("gNoUpdatesPage", "onPageShow - could not select an appropriate " +
         "update. Either there were no updates or |selectUpdate| failed");
-    if (Services.prefs.getBoolPref(PREF_APP_UPDATE_AUTO, true))
+    gUpdates.setButtons(null, null, "okButton", true);
+    gUpdates.wiz.getButton("finish").focus();
+
+    let autoUpdateEnabled = await gAUS.getAutoUpdateIsEnabled();
+    if (autoUpdateEnabled)
       document.getElementById("noUpdatesAutoEnabled").hidden = false;
     else
       document.getElementById("noUpdatesAutoDisabled").hidden = false;
-
-    gUpdates.setButtons(null, null, "okButton", true);
-    gUpdates.wiz.getButton("finish").focus();
   },
 };
 
 /**
  * The "Unable to Update" page. Provides the user information about why they
  * were unable to update and a manual download url.
  */
 var gManualUpdatePage = {
@@ -699,19 +699,16 @@ var gDownloadingPage = {
 
     this._pauseButton.setAttribute("tooltiptext",
                                    gUpdates.getAUSString("pauseButtonPause"));
 
     // move focus to the pause/resume button and then disable it (bug #353177)
     this._pauseButton.focus();
     this._pauseButton.disabled = true;
 
-    var aus = Cc["@mozilla.org/updates/update-service;1"].
-              getService(Ci.nsIApplicationUpdateService);
-
     var um = Cc["@mozilla.org/updates/update-manager;1"].
              getService(Ci.nsIUpdateManager);
     var activeUpdate = um.activeUpdate;
     if (activeUpdate) {
       gUpdates.setUpdate(activeUpdate);
 
       // It's possible the update has already been downloaded and is being
       // applied by the time this page is shown, depending on how fast the
@@ -742,32 +739,32 @@ var gDownloadingPage = {
     try {
       // Say that this was a foreground download, not a background download,
       // since the user cared enough to look in on this process.
       gUpdates.update.QueryInterface(Ci.nsIWritablePropertyBag);
       gUpdates.update.setProperty("foregroundDownload", "true");
 
       // Pause any active background download and restart it as a foreground
       // download.
-      aus.pauseDownload();
-      var state = aus.downloadUpdate(gUpdates.update, false);
+      gAUS.pauseDownload();
+      var state = gAUS.downloadUpdate(gUpdates.update, false);
       if (state == "failed") {
         // We've tried as hard as we could to download a valid update -
         // we fell back from a partial patch to a complete patch and even
         // then we couldn't validate. Show a validation error with instructions
         // on how to manually update.
         this.cleanUp();
         gUpdates.wiz.goTo("errors");
         return;
       }
       // Add this UI as a listener for active downloads
-      aus.addDownloadListener(this);
+      gAUS.addDownloadListener(this);
 
       if (activeUpdate)
-        this._setUIState(!aus.isDownloading);
+        this._setUIState(!gAUS.isDownloading);
     } catch (e) {
       LOG("gDownloadingPage", "onPageShow - error: " + e);
     }
 
     gUpdates.setButtons("hideButton", null, null, false);
     gUpdates.wiz.getButton("extra1").focus();
   },
 
@@ -848,39 +845,35 @@ var gDownloadingPage = {
     Services.obs.addObserver(this, "update-staged");
     this._updateApplyingObserver = true;
   },
 
   /**
    * Clean up the listener and observer registered for the wizard.
    */
   cleanUp() {
-    var aus = Cc["@mozilla.org/updates/update-service;1"].
-              getService(Ci.nsIApplicationUpdateService);
-    aus.removeDownloadListener(this);
+    gAUS.removeDownloadListener(this);
 
     if (this._updateApplyingObserver) {
       Services.obs.removeObserver(this, "update-staged");
       this._updateApplyingObserver = false;
     }
   },
 
   /**
    * When the user clicks the Pause/Resume button
    */
   onPause() {
-    var aus = Cc["@mozilla.org/updates/update-service;1"].
-              getService(Ci.nsIApplicationUpdateService);
     if (this._paused)
-      aus.downloadUpdate(gUpdates.update, false);
+      gAUS.downloadUpdate(gUpdates.update, false);
     else {
       var patch = gUpdates.update.selectedPatch;
       patch.QueryInterface(Ci.nsIWritablePropertyBag);
       patch.setProperty("status", this._pausedStatus);
-      aus.pauseDownload();
+      gAUS.pauseDownload();
     }
     this._paused = !this._paused;
 
     // Update the UI
     this._setUIState(this._paused);
   },
 
   /**
@@ -902,18 +895,16 @@ var gDownloadingPage = {
     // that is in progress.
     this._hiding = true;
 
     // Remove ourself as a download listener so that we don't continue to be
     // fed progress and state notifications after the UI we're updating has
     // gone away.
     this.cleanUp();
 
-    var aus = Cc["@mozilla.org/updates/update-service;1"].
-              getService(Ci.nsIApplicationUpdateService);
     var um = Cc["@mozilla.org/updates/update-manager;1"].
              getService(Ci.nsIUpdateManager);
     um.activeUpdate = gUpdates.update;
 
     // If the download was paused by the user, ask the user if they want to
     // have the update resume in the background.
     var downloadInBackground = true;
     if (this._paused) {
@@ -931,17 +922,17 @@ var gDownloadingPage = {
                             null, { });
       if (rv == Ci.nsIPromptService.BUTTON_POS_0)
         downloadInBackground = false;
     }
     if (downloadInBackground) {
       // Continue download in the background at full speed.
       LOG("gDownloadingPage", "onHide - continuing download in background " +
           "at full speed");
-      aus.downloadUpdate(gUpdates.update, false);
+      gAUS.downloadUpdate(gUpdates.update, false);
     }
     gUpdates.wiz.cancel();
   },
 
   /**
    * When the data transfer begins
    * @param   request
    *          The nsIRequest object for the transfer
@@ -1050,19 +1041,17 @@ var gDownloadingPage = {
       case Cr.NS_BINDING_ABORTED:
         LOG("gDownloadingPage", "onStopRequest - pausing download");
         // Do not remove UI listener since the user may resume downloading again.
         break;
       case Cr.NS_OK:
         LOG("gDownloadingPage", "onStopRequest - patch verification succeeded");
         // If the background update pref is set, we should wait until the update
         // is actually staged in the background.
-        let aus = Cc["@mozilla.org/updates/update-service;1"].
-                  getService(Ci.nsIApplicationUpdateService);
-        if (aus.canStageUpdates) {
+        if (gAUS.canStageUpdates) {
           this._setUpdateApplying();
         } else {
           this.cleanUp();
           gUpdates.wiz.goTo("finished");
         }
         break;
       default:
         LOG("gDownloadingPage", "onStopRequest - transfer failed");
@@ -1166,19 +1155,17 @@ var gErrorPatchingPage = {
   onWizardNext() {
     switch (gUpdates.update.selectedPatch.state) {
       case STATE_APPLIED:
       case STATE_APPLIED_SERVICE:
         gUpdates.wiz.goTo("finished");
         break;
       case STATE_PENDING:
       case STATE_PENDING_SERVICE:
-        let aus = Cc["@mozilla.org/updates/update-service;1"].
-                  getService(Ci.nsIApplicationUpdateService);
-        if (!aus.canStageUpdates) {
+        if (!gAUS.canStageUpdates) {
           gUpdates.wiz.goTo("finished");
           break;
         }
       // intentional fallthrough
       case STATE_DOWNLOADING:
         gUpdates.wiz.goTo("downloading");
         break;
       case STATE_DOWNLOAD_FAILED:
@@ -1192,19 +1179,17 @@ var gErrorPatchingPage = {
  * The "Update has been downloaded" page. Shows information about what
  * was downloaded.
  */
 var gFinishedPage = {
   /**
    * Initialize
    */
   onPageShow() {
-    let aus = Cc["@mozilla.org/updates/update-service;1"].
-              getService(Ci.nsIApplicationUpdateService);
-    if (aus.elevationRequired) {
+    if (gAUS.elevationRequired) {
       LOG("gFinishedPage", "elevationRequired");
       gUpdates.setButtons("restartLaterButton", "noThanksButton",
                           "restartNowButton", true);
     } else {
       LOG("gFinishedPage", "not elevationRequired");
       gUpdates.setButtons("restartLaterButton", null, "restartNowButton",
                           true);
     }
@@ -1223,19 +1208,17 @@ var gFinishedPage = {
     if (gUpdates.update.detailsURL) {
       link.setAttribute("url", gUpdates.update.detailsURL);
       // The details link is stealing focus so it is disabled by default and
       // should only be enabled after onPageShow has been called.
       link.disabled = false;
     } else {
       link.hidden = true;
     }
-    let aus = Cc["@mozilla.org/updates/update-service;1"].
-              getService(Ci.nsIApplicationUpdateService);
-    if (aus.elevationRequired) {
+    if (gAUS.elevationRequired) {
       let more = document.getElementById("finishedBackgroundMore");
       more.setAttribute("hidden", "true");
       let moreElevated =
         document.getElementById("finishedBackgroundMoreElevated");
       moreElevated.setAttribute("hidden", "false");
       let moreElevatedLink =
         document.getElementById("finishedBackgroundMoreElevatedLink");
       moreElevatedLink.setAttribute("hidden", "false");
@@ -1251,19 +1234,17 @@ var gFinishedPage = {
   /**
    * Called when the wizard finishes, i.e. the "Restart Now" button is
    * clicked.
    */
   onWizardFinish() {
     // Do the restart
     LOG("gFinishedPage", "onWizardFinish - restarting the application");
 
-    let aus = Cc["@mozilla.org/updates/update-service;1"].
-              getService(Ci.nsIApplicationUpdateService);
-    if (aus.elevationRequired) {
+    if (gAUS.elevationRequired) {
       let um = Cc["@mozilla.org/updates/update-manager;1"].
                getService(Ci.nsIUpdateManager);
       if (um) {
         um.elevationOptedIn();
       }
     }
 
     // disable the "finish" (Restart) and "extra1" (Later) buttons
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -2533,17 +2533,19 @@ UpdateService.prototype = {
                               PREF_APP_UPDATE_AUTO_MIGRATED,
                               false);
         if (!valueMigrated) {
           LOG("UpdateService.getAutoUpdateIsEnabled - Attempting migration.");
           Services.prefs.setBoolPref(PREF_APP_UPDATE_AUTO_MIGRATED, true);
           let prefValue = Services.prefs.getBoolPref(PREF_APP_UPDATE_AUTO,
                                                      DEFAULT_APP_UPDATE_AUTO);
           try {
-            return await this._writeUpdateAutoConfig(prefValue);
+            let writtenValue = await this._writeUpdateAutoConfig(prefValue);
+            Services.prefs.clearUserPref(PREF_APP_UPDATE_AUTO);
+            return writtenValue;
           } catch (e) {
             LOG("UpdateService.getAutoUpdateIsEnabled - Migration failed. " +
                 "Exception: " + e);
           }
         }
       }
       // Fallthrough for if the value could not be read or migrated.
       return DEFAULT_APP_UPDATE_AUTO;
--- a/toolkit/mozapps/update/tests/TestAUSHelper.cpp
+++ b/toolkit/mozapps/update/tests/TestAUSHelper.cpp
@@ -357,17 +357,17 @@ int NS_main(int argc, NS_tchar **argv)
     return 1;
 #endif
   }
 
   if (!NS_tstrcmp(argv[1], NS_T("create-update-dir"))) {
 #ifdef XP_WIN
     mozilla::UniquePtr<wchar_t[]> updateDir;
     HRESULT result = GetCommonUpdateDirectory(argv[2],
-                                              SetPermissionsOf::AllFilesAndDirs,
+                                              SetPermissionsOf::BaseDirIfNotExists,
                                               updateDir);
     return SUCCEEDED(result) ? 0 : 1;
 #else
     // Not implemented on non-Windows platforms
     return 1;
 #endif
   }
 
--- a/toolkit/mozapps/update/tests/browser/browser_TelemetryUpdatePing.js
+++ b/toolkit/mozapps/update/tests/browser/browser_TelemetryUpdatePing.js
@@ -10,18 +10,18 @@ ChromeUtils.import("resource://testing-c
  * This test does not live in toolkit/components/telemetry/tests to prevent
  * duplicating the code for all the test dependencies. Unfortunately, due
  * to a limitation in the build system, we were not able to simply reference
  * the dependencies as "support-files" in the test manifest.
  */
 add_task(async function testUpdatePingReady() {
   SpecialPowers.pushPrefEnv({set: [
     [PREF_APP_UPDATE_STAGING_ENABLED, false],
-    [PREF_APP_UPDATE_AUTO, false],
   ]});
+  await setAutoUpdateIsEnabled(false);
 
   let updateParams = "promptWaitTime=0";
 
   let archiveChecker = new TelemetryArchiveTesting.Checker();
   await archiveChecker.promiseInit();
 
   // Trigger an "update" ping by downloading and applying an update.
   await runUpdateTest(updateParams, 1, [
--- a/toolkit/mozapps/update/tests/browser/browser_updateAutoPrefUI.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updateAutoPrefUI.js
@@ -37,19 +37,17 @@ async function changeAndVerifyPref(tab, 
   await ContentTask.spawn(tab.linkedBrowser, {newConfigValue}, async function({newConfigValue}) {
     let updateRadioGroup = content.document.getElementById("updateRadioGroup");
     is(updateRadioGroup.value, `${newConfigValue}`,
        "Update preference should match expected");
   });
 }
 
 add_task(async function testUpdateAutoPrefUI() {
-  let originalPrefValue = await gAUS.getAutoUpdateIsEnabled();
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences");
 
   await changeAndVerifyPref(tab, true);
   await changeAndVerifyPref(tab, false);
   await changeAndVerifyPref(tab, false);
   await changeAndVerifyPref(tab, true);
 
   await BrowserTestUtils.removeTab(tab);
-  await gAUS.setAutoUpdateIsEnabled(originalPrefValue);
 });
--- a/toolkit/mozapps/update/tests/browser/browser_updatesBackgroundWindow.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updatesBackgroundWindow.js
@@ -1,13 +1,13 @@
 add_task(async function testUpdatesBackgroundWindow() {
   SpecialPowers.pushPrefEnv({set: [
     [PREF_APP_UPDATE_STAGING_ENABLED, false],
-    [PREF_APP_UPDATE_AUTO, false],
   ]});
+  await setAutoUpdateIsEnabled(false);
 
   let updateParams = "promptWaitTime=0";
   let extraWindow = await BrowserTestUtils.openNewBrowserWindow();
   await SimpleTest.promiseFocus(extraWindow);
 
   await runUpdateTest(updateParams, 1, [
     async function() {
       await BrowserTestUtils.waitForCondition(() => PanelUI.menuButton.hasAttribute("badge-status"),
--- a/toolkit/mozapps/update/tests/browser/browser_updatesBasicPrompt.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updatesBasicPrompt.js
@@ -1,13 +1,13 @@
 add_task(async function testBasicPrompt() {
   SpecialPowers.pushPrefEnv({set: [
     [PREF_APP_UPDATE_STAGING_ENABLED, true],
-    [PREF_APP_UPDATE_AUTO, false],
   ]});
+  await setAutoUpdateIsEnabled(false);
 
   let updateParams = "promptWaitTime=0";
   gUseTestUpdater = true;
 
   await runUpdateTest(updateParams, 1, [
     {
       notificationId: "update-available",
       button: "button",
--- a/toolkit/mozapps/update/tests/browser/browser_updatesBasicPromptNoStaging.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updatesBasicPromptNoStaging.js
@@ -1,13 +1,13 @@
 add_task(async function testBasicPromptNoStaging() {
   SpecialPowers.pushPrefEnv({set: [
     [PREF_APP_UPDATE_STAGING_ENABLED, false],
-    [PREF_APP_UPDATE_AUTO, false],
   ]});
+  await setAutoUpdateIsEnabled(false);
 
   let updateParams = "promptWaitTime=0";
 
   await runUpdateTest(updateParams, 1, [
     {
       notificationId: "update-available",
       button: "button",
       beforeClick() {
--- a/toolkit/mozapps/update/tests/browser/head.js
+++ b/toolkit/mozapps/update/tests/browser/head.js
@@ -39,16 +39,18 @@ const gEnv = Cc["@mozilla.org/process/en
              getService(Ci.nsIEnvironment);
 
 const NOTIFICATIONS = [
   "update-available",
   "update-manual",
   "update-restart",
 ];
 
+let gOriginalUpdateAutoValue = null;
+
 /**
  * Delay for a very short period. Useful for moving the code after this
  * to the back of the event loop.
  *
  * @return A promise which will resolve after a very short period.
  */
 function delay() {
   return new Promise(resolve => executeSoon(resolve));
@@ -86,16 +88,37 @@ function cleanUpUpdates() {
  * in seconds.
  */
 function setUpdateTimerPrefs() {
   let now = Math.round(Date.now() / 1000) - 60;
   Services.prefs.setIntPref(PREF_APP_UPDATE_LASTUPDATETIME, now);
   Services.prefs.setIntPref(PREF_APP_UPDATE_INTERVAL, 43200);
 }
 
+/*
+ * In addition to changing the value of the Auto Update setting, this function
+ * also takes care of cleaning up after itself.
+ */
+async function setAutoUpdateIsEnabled(enabled) {
+  if (gOriginalUpdateAutoValue == null) {
+    gOriginalUpdateAutoValue = await gAUS.getAutoUpdateIsEnabled();
+    registerCleanupFunction(async () => {
+      await gAUS.setAutoUpdateIsEnabled(gOriginalUpdateAutoValue);
+    });
+  }
+  await gAUS.setAutoUpdateIsEnabled(enabled);
+}
+
+
+add_task(async function setDefaults() {
+  // Most tests in this directory expect auto update to be enabled. Those that
+  // don't will explicitly change this.
+  await setAutoUpdateIsEnabled(true);
+});
+
 /**
  * Runs a typical update test. Will set various common prefs for using the
  * updater doorhanger, runs the provided list of steps, and makes sure
  * everything is cleaned up afterwards.
  *
  * @param  updateParams
  *         URL-encoded params which will be sent to update.sjs.
  * @param  checkAttempts
--- a/toolkit/mozapps/update/tests/chrome/test_0010_background_basic.xul
+++ b/toolkit/mozapps/update/tests/chrome/test_0010_background_basic.xul
@@ -24,20 +24,20 @@ const TESTS = [ {
   buttonClick: "next"
 }, {
   pageid: PAGEID_DOWNLOADING
 }, {
   pageid: PAGEID_FINISHED,
   buttonClick: "extra1"
 } ];
 
-function runTest() {
+async function runTest() {
   debugDump("entering");
 
-  Services.prefs.setBoolPref(PREF_APP_UPDATE_AUTO, false);
+  await gAUS.setAutoUpdateIsEnabled(false);
   let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams();
   setUpdateURL(url);
 
   gAUS.checkForBackgroundUpdates();
 }
 
 ]]>
 </script>
--- a/toolkit/mozapps/update/tests/chrome/test_0152_notify_backgroundCheckOfflineRetry.xul
+++ b/toolkit/mozapps/update/tests/chrome/test_0152_notify_backgroundCheckOfflineRetry.xul
@@ -22,24 +22,24 @@
 const TESTS = [ {
   pageid: PAGEID_FOUND_BASIC,
   buttonClick: "extra1"
 } ];
 
 const NETWORK_ERROR_OFFLINE = 111;
 var gProxyPrefValue;
 
-function runTest() {
+async function runTest() {
   debugDump("entering");
 
   let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams();
   setUpdateURL(url);
 
+  await gAUS.setAutoUpdateIsEnabled(false);
   Services.prefs.setBoolPref(PREF_APP_UPDATE_DISABLEDFORTESTING, false);
-  Services.prefs.setBoolPref(PREF_APP_UPDATE_AUTO, false);
 
   Services.io.offline = true;
   gProxyPrefValue = Services.prefs.getIntPref("network.proxy.type");
   Services.prefs.setIntPref("network.proxy.type", 0);
 
   gUpdateChecker.checkForUpdates(updateCheckListener, true);
 }
 
--- a/toolkit/mozapps/update/tests/chrome/utils.js
+++ b/toolkit/mozapps/update/tests/chrome/utils.js
@@ -121,16 +121,17 @@ var gTimeoutTimer;
 // update window to close before giving up.
 const CLOSE_WINDOW_TIMEOUT_MAXCOUNT = 10;
 // Counter for the SimpleTest.executeSoon when waiting on an update window to
 // close before giving up.
 var gCloseWindowTimeoutCounter = 0;
 
 // The following vars are for restoring previous preference values (if present)
 // when the test finishes.
+var gAppUpdateAuto;
 var gAppUpdateDisabled; // app.update.disabledForTesting
 var gAppUpdateServiceEnabled; // app.update.service.enabled
 var gAppUpdateStagingEnabled; // app.update.staging.enabled
 var gAppUpdateURLDefault; // app.update.url (default prefbranch)
 
 var gTestCounter = -1;
 var gWin;
 var gDocElem;
@@ -162,31 +163,31 @@ this.__defineGetter__("gCallback", funct
   return gTest.overrideCallback ? gTest.overrideCallback
                                 : defaultCallback;
 });
 
 /**
  * nsIObserver for receiving window open and close notifications.
  */
 const gWindowObserver = {
-  observe: function WO_observe(aSubject, aTopic, aData) {
+  observe: async function WO_observe(aSubject, aTopic, aData) {
     let win = aSubject;
 
     if (aTopic == "domwindowclosed") {
       if (win.location != URI_UPDATE_PROMPT_DIALOG) {
         debugDump("domwindowclosed event for window not being tested - " +
                   "location: " + win.location + "... returning early");
         return;
       }
       // Allow tests the ability to provide their own function (it must be
       // named finishTest) for finishing the test.
       try {
         finishTest();
       } catch (e) {
-        finishTestDefault();
+        await finishTestDefault();
       }
       return;
     }
 
     win.addEventListener("load", function() {
       // Ignore windows other than the update UI window.
       if (win.location != URI_UPDATE_PROMPT_DIALOG) {
         debugDump("load event for window not being tested - location: " +
@@ -212,82 +213,82 @@ const gWindowObserver = {
 };
 
 /**
  * Default test run function that can be used by most tests. This function uses
  * protective measures to prevent the test from failing provided by
  * |runTestDefaultWaitForWindowClosed| helper functions to prevent failure due
  * to a previous test failure.
  */
-function runTestDefault() {
+async function runTestDefault() {
   debugDump("entering");
 
   SimpleTest.waitForExplicitFinish();
 
-  runTestDefaultWaitForWindowClosed();
+  await runTestDefaultWaitForWindowClosed();
 }
 
 /**
  * If an update window is found SimpleTest.executeSoon can callback before the
  * update window is fully closed especially with debug builds. If an update
  * window is found this function will call itself using SimpleTest.executeSoon
  * up to the amount declared in CLOSE_WINDOW_TIMEOUT_MAXCOUNT until the update
  * window has closed before continuing the test.
  */
-function runTestDefaultWaitForWindowClosed() {
+async function runTestDefaultWaitForWindowClosed() {
   gCloseWindowTimeoutCounter++;
   if (gCloseWindowTimeoutCounter > CLOSE_WINDOW_TIMEOUT_MAXCOUNT) {
     try {
       finishTest();
     } catch (e) {
-      finishTestDefault();
+      await finishTestDefault();
     }
     return;
   }
 
   // The update window should not be open at this time. If it is the call to
   // |closeUpdateWindow| will close it and cause the test to fail.
   if (closeUpdateWindow()) {
     SimpleTest.executeSoon(runTestDefaultWaitForWindowClosed);
   } else {
     Services.ww.registerNotification(gWindowObserver);
 
     gCloseWindowTimeoutCounter = 0;
 
     setupFiles();
-    setupPrefs();
+    await setupPrefs();
     gEnv.set("MOZ_TEST_SKIP_UPDATE_STAGE", "1");
     removeUpdateDirsAndFiles();
     setupTimer(gTestTimeout);
     SimpleTest.executeSoon(setupTestUpdater);
   }
 }
 
 /**
  * Default test finish function that can be used by most tests. This function
  * uses protective measures to prevent the next test from failing provided by
  * |finishTestDefaultWaitForWindowClosed| helper functions to prevent failure
  * due to an update window being left open.
  */
-function finishTestDefault() {
+async function finishTestDefault() {
   debugDump("entering");
   if (gTimeoutTimer) {
     gTimeoutTimer.cancel();
     gTimeoutTimer = null;
   }
 
   if (gChannel) {
     debugDump("channel = " + gChannel);
     gChannel = null;
     gPrefRoot.removeObserver(PREF_APP_UPDATE_CHANNEL, observer);
   }
 
   verifyTestsRan();
 
-  resetPrefs();
+  await resetPrefs();
   gEnv.set("MOZ_TEST_SKIP_UPDATE_STAGE", "");
   resetFiles();
   removeUpdateDirsAndFiles();
   reloadUpdateManagerData();
 
   Services.ww.unregisterNotification(gWindowObserver);
   if (gDocElem) {
     gDocElem.removeEventListener("pageshow", onPageShowDefault);
@@ -299,24 +300,24 @@ function finishTestDefault() {
 /**
  * nsITimerCallback for the timeout timer to cleanly finish a test if the Update
  * Window doesn't close for a test. This allows the next test to run properly if
  * a previous test fails.
  *
  * @param  aTimer
  *         The nsITimer that fired.
  */
-function finishTestTimeout(aTimer) {
+async function finishTestTimeout(aTimer) {
   ok(false, "Test timed out. Maximum time allowed is " + (gTestTimeout / 1000) +
      " seconds");
 
   try {
     finishTest();
   } catch (e) {
-    finishTestDefault();
+    await finishTestDefault();
   }
 }
 
 /**
  * When a test finishes this will repeatedly attempt to restore the real updater
  * for tests that use the test updater and then call
  * finishTestDefaultWaitForWindowClosed after the restore is successful.
  */
@@ -765,17 +766,17 @@ function restoreUpdaterBackup() {
 }
 
 /**
  * Sets the most common preferences used by tests to values used by the majority
  * of the tests and when necessary saves the preference's original values if
  * present so they can be set back to the original values when the test has
  * finished.
  */
-function setupPrefs() {
+async function setupPrefs() {
   if (DEBUG_AUS_TEST) {
     Services.prefs.setBoolPref(PREF_APP_UPDATE_LOG, true);
   }
 
   // Prevent nsIUpdateTimerManager from notifying nsIApplicationUpdateService
   // to check for updates by setting the app update last update time to the
   // current time minus one minute in seconds and the interval time to 12 hours
   // in seconds.
@@ -783,19 +784,18 @@ function setupPrefs() {
   Services.prefs.setIntPref(PREF_APP_UPDATE_LASTUPDATETIME, now);
   Services.prefs.setIntPref(PREF_APP_UPDATE_INTERVAL, 43200);
 
   if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_DISABLEDFORTESTING)) {
     gAppUpdateDisabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_DISABLEDFORTESTING);
   }
   Services.prefs.setBoolPref(PREF_APP_UPDATE_DISABLEDFORTESTING, false);
 
-  if (!Services.prefs.getBoolPref(PREF_APP_UPDATE_AUTO, false)) {
-    Services.prefs.setBoolPref(PREF_APP_UPDATE_AUTO, true);
-  }
+  gAppUpdateAuto = await gAUS.getAutoUpdateIsEnabled();
+  await gAUS.setAutoUpdateIsEnabled(true);
 
   if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_SERVICE_ENABLED)) {
     gAppUpdateServiceEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED);
   }
   Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, false);
 
   if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_STAGING_ENABLED)) {
     gAppUpdateStagingEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_STAGING_ENABLED);
@@ -840,30 +840,28 @@ function resetFiles() {
                   ", Exception: " + e);
     }
   }
 }
 
 /**
  * Resets the most common preferences used by tests to their original values.
  */
-function resetPrefs() {
+async function resetPrefs() {
   if (gAppUpdateURLDefault) {
     gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_URL, gAppUpdateURLDefault);
   }
 
   if (gAppUpdateDisabled !== undefined) {
     Services.prefs.setBoolPref(PREF_APP_UPDATE_DISABLEDFORTESTING, gAppUpdateDisabled);
   } else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_DISABLEDFORTESTING)) {
     Services.prefs.clearUserPref(PREF_APP_UPDATE_DISABLEDFORTESTING);
   }
 
-  if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_AUTO)) {
-    Services.prefs.clearUserPref(PREF_APP_UPDATE_AUTO);
-  }
+  await gAUS.setAutoUpdateIsEnabled(gAppUpdateAuto);
 
   if (gAppUpdateServiceEnabled !== undefined) {
     Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, gAppUpdateServiceEnabled);
   } else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_SERVICE_ENABLED)) {
     Services.prefs.clearUserPref(PREF_APP_UPDATE_SERVICE_ENABLED);
   }
 
   if (gAppUpdateStagingEnabled !== undefined) {
--- a/toolkit/mozapps/update/tests/data/shared.js
+++ b/toolkit/mozapps/update/tests/data/shared.js
@@ -3,17 +3,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Shared code for xpcshell and mochitests-chrome */
 /* eslint-disable no-undef */
 
 ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
-const PREF_APP_UPDATE_AUTO                       = "app.update.auto";
 const PREF_APP_UPDATE_BACKGROUNDERRORS           = "app.update.backgroundErrors";
 const PREF_APP_UPDATE_BACKGROUNDMAXERRORS        = "app.update.backgroundMaxErrors";
 const PREF_APP_UPDATE_CANCELATIONS               = "app.update.cancelations";
 const PREF_APP_UPDATE_CHANNEL                    = "app.update.channel";
 const PREF_APP_UPDATE_DOORHANGER                 = "app.update.doorhanger";
 const PREF_APP_UPDATE_DOWNLOADPROMPTATTEMPTS     = "app.update.download.attempts";
 const PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS  = "app.update.download.maxAttempts";
 const PREF_APP_UPDATE_DOWNLOADBACKGROUNDINTERVAL = "app.update.download.backgroundInterval";
--- a/toolkit/mozapps/update/tests/unit_aus_update/uiAutoPref.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/uiAutoPref.js
@@ -8,31 +8,31 @@ const WindowWatcher = {
   },
 
   QueryInterface: ChromeUtils.generateQI([Ci.nsIWindowWatcher]),
 };
 
 const WindowMediator = {
   getMostRecentWindow(aWindowType) {
     executeSoon(check_status);
-    return { getInterface: ChromeUtils.generateQI([Ci.nsIDOMWindow]) };
+    return null;
   },
 
   QueryInterface: ChromeUtils.generateQI([Ci.nsIWindowMediator]),
 };
 
-function run_test() {
+async function run_test() {
   setupTestCommon();
   // Calling do_get_profile prevents an error from being logged
   do_get_profile();
 
-  debugDump("testing that an update download doesn't start when the " +
-            PREF_APP_UPDATE_AUTO + " preference is false");
+  debugDump("testing that an update download doesn't start when the \"update " +
+            "auto\" value is false");
 
-  Services.prefs.setBoolPref(PREF_APP_UPDATE_AUTO, false);
+  await gAUS.setAutoUpdateIsEnabled(false);
   Services.prefs.setBoolPref(PREF_APP_UPDATE_SILENT, false);
 
   start_httpserver();
   setUpdateURL(gURLData + gHTTPHandlerPath);
   standardInit();
 
   let windowWatcherCID =
     MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1",
--- a/toolkit/mozapps/update/tests/unit_aus_update/updateAutoPrefMigrate.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/updateAutoPrefMigrate.js
@@ -6,40 +6,34 @@
 ChromeUtils.import("resource://gre/modules/osfile.jsm", this);
 
 // Checks both the value returned by the update service and the one written to
 // the app update config file.
 async function verifyPref(configFile, expectedValue) {
   let decoder = new TextDecoder();
   let configValue = await gAUS.getAutoUpdateIsEnabled();
   Assert.equal(configValue, expectedValue,
-               "Value returned should have matched the expected value");
+               "Value returned by getAutoUpdateIsEnabled should have matched " +
+               "the expected value");
   let fileContents = await OS.File.read(configFile.path);
   let saveObject = JSON.parse(decoder.decode(fileContents));
   Assert.equal(saveObject["app.update.auto"], expectedValue,
-               "Value in file should match expected");
+               "Value in update config file should match expected");
 }
 
 async function run_test() {
   setupTestCommon();
   standardInit();
 
   let configFile = getUpdateConfigFile();
 
-  let originalFileValue = await gAUS.getAutoUpdateIsEnabled();
-  let originalConfigValue = Services.prefs.getBoolPref("app.update.auto", null);
-  let originalMigrationValue =
-    Services.prefs.getBoolPref("app.update.auto.migrated", null);
-
   // Test migration of a |false| value
   Services.prefs.setBoolPref("app.update.auto.migrated", false);
   Services.prefs.setBoolPref("app.update.auto", false);
-  debugDump(`about to remove config file`);
-  configFile.remove(false);
-  Assert.ok(!configFile.exists(), "Pref file should have been removed");
+  Assert.ok(!configFile.exists(), "Config file should not exist yet");
   await verifyPref(configFile, false);
 
   // Test that migration doesn't happen twice
   Services.prefs.setBoolPref("app.update.auto", true);
   await verifyPref(configFile, false);
 
   // If the file is deleted after migration, the default value should be
   // returned, regardless of the pref value.
@@ -61,23 +55,10 @@ async function run_test() {
   Assert.ok(!configFile.exists(), "App update config file should have been " +
                                   "removed");
   await verifyPref(configFile, true);
 
   // Test that setting app.update.auto without migrating also works
   await gAUS.setAutoUpdateIsEnabled(false);
   await verifyPref(configFile, false);
 
-  // Restore original state
-  await gAUS.setAutoUpdateIsEnabled(originalFileValue);
-  if (originalConfigValue == null) {
-    Services.prefs.clearUserPref("app.update.auto");
-  } else {
-    Services.prefs.setBoolPref("app.update.auto", originalConfigValue);
-  }
-  if (originalMigrationValue == null) {
-    Services.prefs.clearUserPref("app.update.auto.migrated");
-  } else {
-    Services.prefs.setBoolPref("app.update.auto.migrated",
-                               originalMigrationValue);
-  }
   doTestFinish();
 }