Bug 1326245 - Tell the child processes when we're in safe mode. r=smaug, a=jcristau
authorDave Townsend <dtownsend@oxymoronical.com>
Mon, 13 Feb 2017 15:06:00 -0500
changeset 354313 4c610461220556dec23dfc2344226e89cb15c3e8
parent 354312 ce5e991a8c21a07aae4728954da8ce7b89f35d4a
child 354314 23b17b9d6a4e3344ec1e15966a5f35b619db84ff
push id6895
push userryanvm@gmail.com
push dateFri, 17 Feb 2017 14:19:07 +0000
treeherdermozilla-esr52@41c9d8ee2649 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, jcristau
bugs1326245
milestone52.0
Bug 1326245 - Tell the child processes when we're in safe mode. r=smaug, a=jcristau
dom/ipc/ContentParent.cpp
toolkit/xre/nsEmbedFunctions.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2074,16 +2074,21 @@ ContentParent::InitializeMembers()
 }
 
 bool
 ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PRIORITY_FOREGROUND */)
 {
   PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
 
   std::vector<std::string> extraArgs;
+
+  if (gSafeMode) {
+    extraArgs.push_back("-safeMode");
+  }
+
   if (!mSubprocess->LaunchAndWaitForProcessHandle(extraArgs)) {
     MarkAsDead();
     return false;
   }
 
   Open(mSubprocess->GetChannel(),
      base::GetProcId(mSubprocess->GetChildProcessHandle()));
 
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -618,34 +618,31 @@ XRE_InitChildProcess(int aArgc,
                   continue;
               }
               nsCString appDir;
               appDir.Assign(nsDependentCString(aArgv[idx+1]));
               static_cast<ContentProcess*>(process.get())->SetAppDir(appDir);
               foundAppdir = true;
             }
 
+            if (aArgv[idx] && !strcmp(aArgv[idx], "-safeMode")) {
+              gSafeMode = true;
+            }
+
 #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
             if (aArgv[idx] && !strcmp(aArgv[idx], "-profile")) {
               MOZ_ASSERT(!foundProfile);
               if (foundProfile) {
                 continue;
               }
               nsCString profile;
               profile.Assign(nsDependentCString(aArgv[idx+1]));
               static_cast<ContentProcess*>(process.get())->SetProfile(profile);
               foundProfile = true;
             }
-            if (foundProfile && foundAppdir) {
-              break;
-            }
-#else
-            if (foundAppdir) {
-              break;
-            }
 #endif /* XP_MACOSX && MOZ_CONTENT_SANDBOX */
           }
         }
         break;
 
       case GeckoProcessType_IPDLUnitTest:
 #ifdef MOZ_IPDL_TESTS
         process = new IPDLUnitTestProcessChild(parentPID);