Bug 1332522 - Part 1 - Send the remote type to the child before enabling the content sandbox; r=bobowen draft
authorHaik Aftandilian <haftandilian@mozilla.com>
Tue, 24 Jan 2017 14:26:21 -0800
changeset 467540 534354e67a4f46f99be157ed468fc466e96fd0e9
parent 467243 07d7ecbf77e3be59797f16234d357a02bb38ed8b
child 467541 7c80335c28dbdb7146d2ad0b447959db5e06cf0f
push id43209
push userhaftandilian@mozilla.com
push dateFri, 27 Jan 2017 23:23:30 +0000
reviewersbobowen
bugs1332522
milestone54.0a1
Bug 1332522 - Part 1 - Send the remote type to the child before enabling the content sandbox; r=bobowen Call SendRemoteType() before calling SendSetProcessSandbox() so the child can use the remote type value when setting up the sandbox. MozReview-Commit-ID: 28Xeyn9cqDf
dom/ipc/ContentParent.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1047,18 +1047,16 @@ ContentParent::Init()
   }
   Preferences::AddStrongObserver(this, "");
   if (obs) {
     nsAutoString cpId;
     cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
     obs->NotifyObservers(static_cast<nsIObserver*>(this), "ipc:content-created", cpId.get());
   }
 
-  Unused << SendRemoteType(mRemoteType);
-
 #ifdef ACCESSIBILITY
   // If accessibility is running in chrome process then start it in content
   // process.
   if (nsIPresShell::IsAccessibilityActive()) {
 #if defined(XP_WIN)
     if (IsVistaOrLater()) {
       Unused <<
         SendActivateA11y(a11y::AccessibleWrap::GetContentProcessIdFor(ChildID()));
@@ -1818,16 +1816,21 @@ ContentParent::InitInternal(ProcessPrior
     // Sending all information to content process.
     Unused << SendAppInfo(version, buildID, name, UAName, ID, vendor);
   }
 
   // Initialize the message manager (and load delayed scripts) now that we
   // have established communications with the child.
   mMessageManager->InitWithCallback(this);
 
+  // Send the child its remote type. On Mac, this needs to be sent prior
+  // to the message we send to enable the Sandbox (SendStartProcessSandbox)
+  // because different remote types require different sandbox privileges.
+  Unused << SendRemoteType(mRemoteType);
+
   // Set the subprocess's priority.  We do this early on because we're likely
   // /lowering/ the process's CPU and memory priority, which it has inherited
   // from this process.
   //
   // This call can cause us to send IPC messages to the child process, so it
   // must come after the Open() call above.
   ProcessPriorityManager::SetProcessPriority(this, aInitialPriority);