Bug 1405088 - Part 2 - Don't even setup the temp directory in content processes on macOS now that it is unused; r?haik draft
authorAlex Gaynor <agaynor@mozilla.com>
Tue, 13 Feb 2018 10:11:26 -0500
changeset 754534 2e480288bdb5a455e5b6c185365c7d8ffb096a71
parent 754533 b459a3e390fe2b71760113aded7907d96fd99605
push id98908
push userbmo:agaynor@mozilla.com
push dateTue, 13 Feb 2018 18:28:35 +0000
reviewershaik
bugs1405088
milestone60.0a1
Bug 1405088 - Part 2 - Don't even setup the temp directory in content processes on macOS now that it is unused; r?haik MozReview-Commit-ID: 3WLWmGkbSJO
dom/ipc/ContentProcess.cpp
--- a/dom/ipc/ContentProcess.cpp
+++ b/dom/ipc/ContentProcess.cpp
@@ -41,38 +41,26 @@ SetTmpEnvironmentVariable(nsIFile* aValu
   }
   Unused << NS_WARN_IF(!SetEnvironmentVariableW(L"TMP", fullTmpPath.get()));
   // We also set TEMP in case there is naughty third-party code that is
   // referencing the environment variable directly.
   Unused << NS_WARN_IF(!SetEnvironmentVariableW(L"TEMP", fullTmpPath.get()));
 }
 #endif
 
-#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
-static void
-SetTmpEnvironmentVariable(nsIFile* aValue)
-{
-  nsAutoCString fullTmpPath;
-  nsresult rv = aValue->GetNativePath(fullTmpPath);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return;
-  }
-  Unused << NS_WARN_IF(setenv("TMPDIR", fullTmpPath.get(), 1) != 0);
-}
-#endif
 
-#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
+#if defined(XP_WIN) && defined(MOZ_CONTENT_SANDBOX)
 static void
 SetUpSandboxEnvironment()
 {
   MOZ_ASSERT(nsDirectoryService::gService,
     "SetUpSandboxEnvironment relies on nsDirectoryService being initialized");
 
-  // On macOS and Windows, a sandbox-writable temp directory is used whenever
-  // the sandbox is enabled.
+  // On Windows, a sandbox-writable temp directory is used whenever the sandbox
+  // is enabled.
   if (!IsContentSandboxEnabled()) {
     return;
   }
 
   nsCOMPtr<nsIFile> sandboxedContentTemp;
   nsresult rv =
     nsDirectoryService::gService->Get(NS_APP_CONTENT_PROCESS_TEMP_DIR,
                                       NS_GET_IID(nsIFile),
@@ -242,17 +230,17 @@ ContentProcess::Init(int aArgc, char* aA
                 IOThreadChild::channel(),
                 childID,
                 isForBrowser);
   mXREEmbed.Start();
 #if (defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
   mContent.SetProfileDir(profileDir);
 #endif
 
-#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
+#if defined(XP_WIN) && defined(MOZ_CONTENT_SANDBOX)
   SetUpSandboxEnvironment();
 #endif
 
   return true;
 }
 
 // Note: CleanUp() never gets called in non-debug builds because we exit early
 // in ContentChild::ActorDestroy().