Bug 1463560: Part 2: Re-add the -os-restarted arg when launching from profile manager. r=jimm
authorAdam Gashlin <agashlin@mozilla.com>
Sun, 27 May 2018 12:22:42 -0700
changeset 421544 06d152dae420825cfd78edf3fc094cdd16434945
parent 421543 d6ab9a83f57ce7664410de28a412df6eb2f24443
child 421545 9fdec651f1795337ce6170f9c6758b0b2c0e7e32
push id104056
push usernbeleuzu@mozilla.com
push dateWed, 06 Jun 2018 09:52:47 +0000
treeherdermozilla-inbound@072201279e41 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs1463560
milestone62.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 1463560: Part 2: Re-add the -os-restarted arg when launching from profile manager. r=jimm MozReview-Commit-ID: 85dQpYT5I9M
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -2178,16 +2178,24 @@ ShowProfileManager(nsIToolkitProfileServ
   SaveFileToEnv("XRE_PROFILE_LOCAL_PATH", profLD);
   SaveWordToEnv("XRE_PROFILE_NAME", profileName);
 
   bool offline = false;
   aProfileSvc->GetStartOffline(&offline);
   if (offline) {
     SaveToEnv("XRE_START_OFFLINE=1");
   }
+  if (gRestartedByOS) {
+    // Re-add this argument when actually starting the application.
+    char** newArgv = (char**) realloc(gRestartArgv, sizeof(char*) * (gRestartArgc + 2));
+    NS_ENSURE_TRUE(newArgv, NS_ERROR_OUT_OF_MEMORY);
+    gRestartArgv = newArgv;
+    gRestartArgv[gRestartArgc++] = const_cast<char*>("-os-restarted");
+    gRestartArgv[gRestartArgc] = nullptr;
+  }
 
   return LaunchChild(aNative);
 }
 
 /**
  * Get the currently running profile using its root directory.
  *
  * @param aProfileSvc         The profile service