Bug 1486901: Part 1 - Allow RunAsLauncherProcess to fall back to environment and command line if the parent process check does not return true; r=mhowell!
authorAaron Klotz <aklotz@mozilla.com>
Tue, 28 Aug 2018 22:30:30 +0000
changeset 491413 6f6c28eb6041a8d18caf5cead0562c271449b75f
parent 491412 33c06c93406863777cedffacc04e78caab6d1e8d
child 491414 511ad3e51be353f40f5f0a56ac953f39e7beba32
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhowell
bugs1486901
milestone63.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 1486901: Part 1 - Allow RunAsLauncherProcess to fall back to environment and command line if the parent process check does not return true; r=mhowell! Differential Revision: https://phabricator.services.mozilla.com/D4496
browser/app/winlauncher/LauncherProcessWin.cpp
--- a/browser/app/winlauncher/LauncherProcessWin.cpp
+++ b/browser/app/winlauncher/LauncherProcessWin.cpp
@@ -147,22 +147,29 @@ bool
 RunAsLauncherProcess(int& argc, wchar_t** argv)
 {
 #if defined(MOZ_LAUNCHER_PROCESS)
   Maybe<bool> isChildOfFirefox = IsSameBinaryAsParentProcess();
   if (!isChildOfFirefox) {
     return true;
   }
 
-  return !isChildOfFirefox.value();
-#else
+  if (!isChildOfFirefox.value()) {
+    return true;
+  }
+#endif // defined(MOZ_LAUNCHER_PROCESS)
+
+  if (mozilla::EnvHasValue("MOZ_LAUNCHER_PROCESS")) {
+    mozilla::SaveToEnv("MOZ_LAUNCHER_PROCESS=");
+    return true;
+  }
+
   return CheckArg(argc, argv, L"launcher",
                   static_cast<const wchar_t**>(nullptr),
-                  CheckArgFlag::CheckOSInt | CheckArgFlag::RemoveArg) == ARG_FOUND;
-#endif // defined(MOZ_LAUNCHER_PROCESS)
+                  CheckArgFlag::RemoveArg) == ARG_FOUND;
 }
 
 int
 LauncherMain(int argc, wchar_t* argv[])
 {
   // Make sure that the launcher process itself has image load policies set
   if (IsWin10AnniversaryUpdateOrLater()) {
     const DynamicallyLinkedFunctionPtr<decltype(&SetProcessMitigationPolicy)>