Bug 1059467: Updater changes.
authorStephen Pohl <spohl.mozilla.bugs@gmail.com>
Fri, 12 Sep 2014 16:00:24 -0400
changeset 491224 64f576a29aced251295315cae9a4c21ea6713d1c
parent 491223 bb8f033a3ff360ea9c944a4043e5fc20b162bfb8
child 491225 90d5b0381b0e27c0181328b61ee5d2f3e9915695
push id47343
push userbmo:dothayer@mozilla.com
push dateWed, 01 Mar 2017 22:58:58 +0000
bugs1059467
milestone35.0a1
Bug 1059467: Updater changes.
toolkit/mozapps/update/updater/updater.cpp
--- a/toolkit/mozapps/update/updater/updater.cpp
+++ b/toolkit/mozapps/update/updater/updater.cpp
@@ -2086,53 +2086,18 @@ ProcessReplaceRequest()
       }
     }
 
     NS_tclosedir(dir);
   } else {
     LOG(("Updated.app dir can't be found: " LOG_S ", err: %d",
          updatedAppDir, errno));
   }
+
   ensure_remove_recursive(updatedAppDir);
-
-  LOG(("Moving the precomplete file"));
-
-  // We also need to move the precomplete file too.
-  NS_tchar precompleteSource[MAXPATHLEN];
-  NS_tsnprintf(precompleteSource, sizeof(precompleteSource)/sizeof(precompleteSource[0]),
-               NS_T("%s/precomplete"), installDir);
-
-  NS_tchar precompleteTmp[MAXPATHLEN];
-  NS_tsnprintf(precompleteTmp, sizeof(precompleteTmp)/sizeof(precompleteTmp[0]),
-               NS_T("%s/precomplete.bak"), installDir);
-
-  NS_tchar precompleteNew[MAXPATHLEN];
-  NS_tsnprintf(precompleteNew, sizeof(precompleteNew)/sizeof(precompleteNew[0]),
-               NS_T("%s/Updated.app/precomplete"), installDir);
-
-  ensure_remove(precompleteTmp);
-  LOG(("Begin moving precompleteSrc to precompleteTmp"));
-  rv = rename_file(precompleteSource, precompleteTmp);
-  LOG(("Moved precompleteSrc to precompleteTmp, err: %d", rv));
-  LOG(("Begin moving precompleteNew to precompleteSrc"));
-  int rv2 = rename_file(precompleteNew, precompleteSource);
-  LOG(("Moved precompleteNew to precompleteSrc, err: %d", rv2));
-
-  // If new could not be moved to source, we only want to restore tmp to source
-  // if the first step succeeded.  Note that it is possible for the first
-  // rename to have failed as well, for example if the tmpFile exists and we
-  // race between the ensure_remove call and the first rename call, but there
-  // isn't too much that we can do about that, unfortunately.
-  if (!rv && rv2) {
-    LOG(("Begin trying to recover precompleteSrc"));
-    rv = rename_file(precompleteTmp, precompleteSource);
-    LOG(("Moved precompleteTmp to precompleteSrc, err: %d", rv));
-  }
-
-  LOG(("Finished moving the precomplete file"));
 #endif
 
   gSucceeded = true;
 
   return 0;
 }
 
 #ifdef XP_WIN
@@ -3752,21 +3717,25 @@ GetManifestContents(const NS_tchar *mani
 int AddPreCompleteActions(ActionList *list)
 {
   if (sIsOSUpdate) {
     return OK;
   }
 
   NS_tchar *rb = GetManifestContents(NS_T("precomplete"));
   if (rb == nullptr) {
-    LOG(("AddPreCompleteActions: error getting contents of precomplete " \
-         "manifest"));
-    // Applications aren't required to have a precomplete manifest. The mar
-    // generation scripts enforce the presence of a precomplete manifest.
-    return OK;
+    //XXX Temporary since requiring this location on Mac OS X will require making new test mar files
+    rb = GetManifestContents(NS_T("Contents/Resources/precomplete"));
+    if (rb == nullptr) {
+      LOG(("AddPreCompleteActions: error getting contents of precomplete " \
+           "manifest"));
+      // Applications aren't required to have a precomplete manifest. The mar
+      // generation scripts enforce the presence of a precomplete manifest.
+      return OK;
+    }
   }
 
   int rv;
   NS_tchar *line;
   while((line = mstrtok(kNL, &rb)) != 0) {
     // skip comments
     if (*line == NS_T('#'))
       continue;