Bug 950241 - Update nsUpdateDriver metro check to pick up new command line params. r=bbondy, a=lsblakk
authorJim Mathies <jmathies@mozilla.com>
Thu, 30 Jan 2014 13:32:49 -0600
changeset 176261 10bed2ab6575a5c902d604884966e475753328f2
parent 176260 5b3201c97b299af764c1654e93677e3c364934cd
child 176262 25dd5a9531d3734c12390d03eb857000f19d3fa6
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy, lsblakk
bugs950241
milestone28.0
Bug 950241 - Update nsUpdateDriver metro check to pick up new command line params. r=bbondy, a=lsblakk
toolkit/xre/nsUpdateDriver.cpp
--- a/toolkit/xre/nsUpdateDriver.cpp
+++ b/toolkit/xre/nsUpdateDriver.cpp
@@ -295,16 +295,29 @@ IsOlderVersion(nsIFile *versionFile, con
     return false;
 
   if (mozilla::Version(appVersion) > buf)
     return true;
 
   return false;
 }
 
+#if defined(XP_WIN) && defined(MOZ_METRO)
+static bool
+IsWindowsMetroUpdateRequest(int appArgc, char **appArgv)
+{
+  for (int index = 0; index < appArgc; index++) {
+    if (!strcmp(appArgv[index], "--metro-update")) {
+      return true;
+    }
+  }
+  return false;
+}
+#endif
+
 static bool
 CopyFileIntoUpdateDir(nsIFile *parentDir, const char *leafName, nsIFile *updateDir)
 {
   nsDependentCString leaf(leafName);
   nsCOMPtr<nsIFile> file;
 
   // Make sure there is not an existing file in the target location.
   nsresult rv = updateDir->Clone(getter_AddRefs(file));
@@ -530,18 +543,18 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIF
   pid.AppendInt((int32_t) getpid());
 #endif
 
   // Append a special token to the PID in order to let the updater know that it
   // just needs to replace the update directory.
   pid.AppendLiteral("/replace");
 
   int immersiveArgc = 0;
-#ifdef XP_WIN
-  if (IsRunningInWindowsMetro()) {
+#if defined(XP_WIN) && defined(MOZ_METRO)
+  if (IsWindowsMetroUpdateRequest(appArgc, appArgv)) {
     immersiveArgc = 1;
   }
 #endif
   int argc = appArgc + 5 + immersiveArgc;
   char **argv = new char*[argc + 1];
   if (!argv)
     return;
   argv[0] = (char*) updaterPath.get();
@@ -817,18 +830,18 @@ ApplyUpdate(nsIFile *greDir, nsIFile *up
 #if defined(USE_EXECV)
     pid.AssignASCII("0");
 #else
     pid.AppendInt((int32_t) getpid());
 #endif
   }
 
   int immersiveArgc = 0;
-#ifdef XP_WIN
-  if (IsRunningInWindowsMetro()) {
+#if defined(XP_WIN) && defined(MOZ_METRO)
+  if (IsWindowsMetroUpdateRequest(appArgc, appArgv)) {
     immersiveArgc = 1;
   }
 #endif
   int argc = appArgc + 5 + immersiveArgc;
   char **argv = new char*[argc + 1 ];
   if (!argv)
     return;
   argv[0] = (char*) updaterPath.get();