Backed out changesets d59774690fc8, 26e323cbbfc0, and 1864afbb3bd4 (bug 1236108) for test_content_exception_time_annotation.js failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Sun, 13 Mar 2016 21:02:58 -0400
changeset 323419 34a219cbd67d2bf0c555321ef8308a6aefcef23d
parent 323418 d05a61ed142b13dad72593a3a3ce860f301df669
child 323420 3b30da6eac70f43aeac3e0c226451d70f4ef14d4
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1236108
milestone47.0a2
backs outd59774690fc8154b24ba6ac4a37118350cdc7cfd
26e323cbbfc0fe521895f474a1b468a1e10724f1
1864afbb3bd4405c84978bd9c080931e3ad235d8
Backed out changesets d59774690fc8, 26e323cbbfc0, and 1864afbb3bd4 (bug 1236108) for test_content_exception_time_annotation.js failures.
dom/ipc/ContentProcess.cpp
toolkit/crashreporter/nsExceptionHandler.cpp
toolkit/crashreporter/test/unit_ipc/test_content_annotation.js
toolkit/crashreporter/test/unit_ipc/test_content_exception_time_annotation.js
toolkit/crashreporter/test/unit_ipc/xpcshell.ini
toolkit/xre/nsAppRunner.cpp
toolkit/xre/nsXREDirProvider.cpp
toolkit/xre/nsXREDirProvider.h
xpcom/io/nsAppDirectoryServiceDefs.h
--- a/dom/ipc/ContentProcess.cpp
+++ b/dom/ipc/ContentProcess.cpp
@@ -7,23 +7,18 @@
 #include "mozilla/ipc/IOThreadChild.h"
 
 #include "ContentProcess.h"
 
 #if defined(XP_WIN) && defined(MOZ_CONTENT_SANDBOX)
 #include "mozilla/WindowsVersion.h"
 #endif
 
-#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
-#include <stdlib.h>
-#endif
-
 #if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
 #include "mozilla/Preferences.h"
-#include "nsAppDirectoryServiceDefs.h"
 #include "nsDirectoryService.h"
 #include "nsDirectoryServiceDefs.h"
 #endif
 
 using mozilla::ipc::IOThreadChild;
 
 namespace mozilla {
 namespace dom {
@@ -33,83 +28,80 @@ static bool
 IsSandboxTempDirRequired()
 {
   // On Windows, a sandbox-writable temp directory is only used
   // for Vista or later with sandbox pref level >= 1.
   return (IsVistaOrLater() &&
     (Preferences::GetInt("security.sandbox.content.level") >= 1));
 }
 
-static void
-SetTmpEnvironmentVariable(nsIFile* aValue)
+static const char*
+SandboxTempDirParent()
 {
-  // Save the TMP environment variable so that is is picked up by GetTempPath().
-  // Note that we specifically write to the TMP variable, as that is the first
-  // variable that is checked by GetTempPath() to determine its output.
-  nsAutoString fullTmpPath;
-  nsresult rv = aValue->GetPath(fullTmpPath);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return;
-  }
-  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.
-  NS_WARN_IF(!SetEnvironmentVariableW(L"TEMP", fullTmpPath.get()));
+  // On Windows, the sandbox-writable temp directory resides in the
+  // low integrity sandbox base directory.
+  return NS_WIN_LOW_INTEGRITY_TEMP_BASE;
 }
 #endif
 
 #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
 static bool
 IsSandboxTempDirRequired()
 {
   // On OSX, use the sandbox-writable temp when the pref level >= 1.
   return (Preferences::GetInt("security.sandbox.content.level") >= 1);
 }
 
-static void
-SetTmpEnvironmentVariable(nsIFile* aValue)
+static const char*
+SandboxTempDirParent()
 {
-  nsAutoCString fullTmpPath;
-  nsresult rv = aValue->GetNativePath(fullTmpPath);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return;
-  }
-  NS_WARN_IF(setenv("TMPDIR", fullTmpPath.get(), 1) != 0);
+  return NS_OS_TEMP_DIR;
 }
 #endif
 
 #if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
 static void
 SetUpSandboxEnvironment()
 {
   MOZ_ASSERT(nsDirectoryService::gService,
     "SetUpSandboxEnvironment relies on nsDirectoryService being initialized");
 
   if (!IsSandboxTempDirRequired()) {
     return;
   }
 
-  nsCOMPtr<nsIFile> sandboxedContentTemp;
-  nsresult rv =
-    nsDirectoryService::gService->Get(NS_APP_CONTENT_PROCESS_TEMP_DIR,
-                                      NS_GET_IID(nsIFile),
-                                      getter_AddRefs(sandboxedContentTemp));
+  nsAdoptingString tempDirSuffix =
+    Preferences::GetString("security.sandbox.content.tempDirSuffix");
+  if (tempDirSuffix.IsEmpty()) {
+    NS_WARNING("Sandbox-writable temp directory suffix pref not set.");
+    return;
+  }
+
+  // Get the parent of our sandbox writable temp directory.
+  nsCOMPtr<nsIFile> lowIntegrityTemp;
+  nsresult rv = nsDirectoryService::gService->Get(SandboxTempDirParent(),
+                                                  NS_GET_IID(nsIFile),
+                                                  getter_AddRefs(lowIntegrityTemp));
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return;
+  }
+
+  // Append our profile specific temp name.
+  rv = lowIntegrityTemp->Append(NS_LITERAL_STRING("Temp-") + tempDirSuffix);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return;
   }
 
   // Change the gecko defined temp directory to our sandbox-writable one.
   // Undefine returns a failure if the property is not already set.
   Unused << nsDirectoryService::gService->Undefine(NS_OS_TEMP_DIR);
-  rv = nsDirectoryService::gService->Set(NS_OS_TEMP_DIR, sandboxedContentTemp);
+  rv = nsDirectoryService::gService->Set(NS_OS_TEMP_DIR, lowIntegrityTemp);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return;
   }
-
-  SetTmpEnvironmentVariable(sandboxedContentTemp);
 }
 #endif
 
 void
 ContentProcess::SetAppDir(const nsACString& aPath)
 {
   mXREEmbed.SetAppDir(aPath);
 }
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -1,18 +1,15 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsExceptionHandler.h"
-
-#include "nsAppDirectoryServiceDefs.h"
-#include "nsDirectoryServiceDefs.h"
 #include "nsDataHashtable.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/dom/CrashReporterChild.h"
 #include "mozilla/Services.h"
 #include "nsIObserverService.h"
 #include "mozilla/unused.h"
 #include "mozilla/Snprintf.h"
 #include "mozilla/SyncRunnable.h"
@@ -119,17 +116,18 @@ typedef wchar_t XP_CHAR;
 typedef std::wstring xpstring;
 #define XP_TEXT(x) L##x
 #define CONVERT_XP_CHAR_TO_UTF16(x) x
 #define XP_STRLEN(x) wcslen(x)
 #define my_strlen strlen
 #define CRASH_REPORTER_FILENAME "crashreporter.exe"
 #define PATH_SEPARATOR "\\"
 #define XP_PATH_SEPARATOR L"\\"
-#define XP_PATH_MAX (MAX_PATH + 1)
+// sort of arbitrary, but MAX_PATH is kinda small
+#define XP_PATH_MAX 4096
 // "<reporter path>" "<minidump path>"
 #define CMDLINE_SIZE ((XP_PATH_MAX * 2) + 6)
 #ifdef _USE_32BIT_TIME_T
 #define XP_TTOA(time, buffer, base) ltoa(time, buffer, base)
 #else
 #define XP_TTOA(time, buffer, base) _i64toa(time, buffer, base)
 #endif
 #define XP_STOA(size, buffer, base) _ui64toa(size, buffer, base)
@@ -154,27 +152,20 @@ typedef std::string xpstring;
 #define sys_close close
 #define sys_fork fork
 #define sys_open open
 #define sys_read read
 #define sys_write write
 #endif
 #endif // XP_WIN32
 
-#if defined(__GNUC__)
-#define MAYBE_UNUSED __attribute__((unused))
-#else
-#define MAYBE_UNUSED
-#endif // defined(__GNUC__)
-
 #ifndef XP_LINUX
 static const XP_CHAR dumpFileExtension[] = XP_TEXT(".dmp");
 #endif
 
-static const XP_CHAR childCrashAnnotationBaseName[] = XP_TEXT("GeckoChildCrash");
 static const XP_CHAR extraFileExtension[] = XP_TEXT(".extra");
 static const XP_CHAR memoryReportExtension[] = XP_TEXT(".memory.json.gz");
 
 // A whitelist of crash annotations which do not contain sensitive data
 // and are saved in the crash record and sent with Firefox Health Report.
 static char const * const kCrashEventAnnotations[] = {
   "AsyncShutdownTimeout",
   "BuildID",
@@ -259,21 +250,16 @@ static uint32_t eventloopNestingLevel = 
 
 // Avoid a race during application termination.
 static Mutex* dumpSafetyLock;
 static bool isSafeToDump = false;
 
 // OOP crash reporting
 static CrashGenerationServer* crashServer; // chrome process has this
 
-#if (defined(XP_MACOSX) || defined(XP_WIN)) && defined(MOZ_CONTENT_SANDBOX)
-// This field is only valid in the chrome process, not content.
-static xpstring* contentProcessTmpDir = nullptr;
-#endif
-
 #  if defined(XP_WIN) || defined(XP_MACOSX)
 // If crash reporting is disabled, we hand out this "null" pipe to the
 // child process and don't attempt to connect to a parent server.
 static const char kNullNotifyPipe[] = "-";
 static char* childCrashNotifyPipe;
 
 #  elif defined(XP_LINUX)
 static int serverSocketFd = -1;
@@ -495,44 +481,22 @@ CreateFileFromPath(const xpstring& path,
   NS_NewLocalFile(nsDependentString(path.c_str()), false, file);
 }
 
 static void
 CreateFileFromPath(const wchar_t* path, nsIFile** file)
 {
   CreateFileFromPath(std::wstring(path), file);
 }
-
-static xpstring*
-CreatePathFromFile(nsIFile* file)
-{
-  nsAutoString path;
-  nsresult rv = file->GetPath(path);
-  if (NS_FAILED(rv)) {
-    return nullptr;
-  }
-  return new xpstring(path.get(), path.Length());
-}
 #else
 static void
 CreateFileFromPath(const xpstring& path, nsIFile** file)
 {
   NS_NewNativeLocalFile(nsDependentCString(path.c_str()), false, file);
 }
-
-MAYBE_UNUSED static xpstring*
-CreatePathFromFile(nsIFile* file)
-{
-  nsAutoCString path;
-  nsresult rv = file->GetNativePath(path);
-  if (NS_FAILED(rv)) {
-    return nullptr;
-  }
-  return new xpstring(path.get(), path.Length());
-}
 #endif
 
 static XP_CHAR*
 Concat(XP_CHAR* str, const XP_CHAR* toAppend, int* size)
 {
   int appendLen = XP_STRLEN(toAppend);
   if (appendLen >= *size) appendLen = *size - 1;
 
@@ -611,17 +575,16 @@ bool copy_file(const char* from, const c
   sys_close(fdfrom);
   sys_close(fdto);
 
   return ok;
 }
 #endif
 
 #ifdef XP_WIN
-
 class PlatformWriter
 {
 public:
   PlatformWriter()
     : mHandle(INVALID_HANDLE_VALUE)
   { }
 
   explicit PlatformWriter(const wchar_t* path)
@@ -730,44 +693,16 @@ static void
 WriteAnnotation(PlatformWriter& pw, const char (&name)[N],
                 const char* value) {
   WriteLiteral(pw, name);
   WriteLiteral(pw, "=");
   WriteString(pw, value);
   WriteLiteral(pw, "\n");
 };
 
-/**
- * If minidump_id is null, we assume that dump_path contains the full
- * dump file path.
- */
-static void
-OpenAPIData(PlatformWriter& aWriter,
-            const XP_CHAR* dump_path, const XP_CHAR* minidump_id = nullptr
-           )
-{
-  static XP_CHAR extraDataPath[XP_PATH_MAX];
-  int size = XP_PATH_MAX;
-  XP_CHAR* p;
-  if (minidump_id) {
-    p = Concat(extraDataPath, dump_path, &size);
-    p = Concat(p, XP_PATH_SEPARATOR, &size);
-    p = Concat(p, minidump_id, &size);
-  } else {
-    p = Concat(extraDataPath, dump_path, &size);
-    // Skip back past the .dmp extension, if any.
-    if (*(p - 4) == XP_TEXT('.')) {
-      p -= 4;
-      size += 4;
-    }
-  }
-  Concat(p, extraFileExtension, &size);
-  aWriter.Open(extraDataPath);
-}
-
 bool MinidumpCallback(
 #ifdef XP_LINUX
                       const MinidumpDescriptor& descriptor,
 #else
                       const XP_CHAR* dump_path,
                       const XP_CHAR* minidump_id,
 #endif
                       void* context,
@@ -786,16 +721,29 @@ bool MinidumpCallback(
   p = Concat(minidumpPath, dump_path, &size);
   p = Concat(p, XP_PATH_SEPARATOR, &size);
   p = Concat(p, minidump_id, &size);
   Concat(p, dumpFileExtension, &size);
 #else
   Concat(minidumpPath, descriptor.path(), &size);
 #endif
 
+  static XP_CHAR extraDataPath[XP_PATH_MAX];
+  size = XP_PATH_MAX;
+#ifndef XP_LINUX
+  p = Concat(extraDataPath, dump_path, &size);
+  p = Concat(p, XP_PATH_SEPARATOR, &size);
+  p = Concat(p, minidump_id, &size);
+#else
+  p = Concat(extraDataPath, descriptor.path(), &size);
+  // Skip back past the .dmp extension.
+  p -= 4;
+#endif
+  Concat(p, extraFileExtension, &size);
+
   static XP_CHAR memoryReportLocalPath[XP_PATH_MAX];
   size = XP_PATH_MAX;
 #ifndef XP_LINUX
   p = Concat(memoryReportLocalPath, dump_path, &size);
   p = Concat(p, XP_PATH_SEPARATOR, &size);
   p = Concat(p, minidump_id, &size);
 #else
   p = Concat(memoryReportLocalPath, descriptor.path(), &size);
@@ -907,21 +855,17 @@ bool MinidumpCallback(
       WriteLiteral(eventFile, "\n");
       if (crashEventAPIData) {
         eventFile.WriteBuffer(crashEventAPIData->get(), crashEventAPIData->Length());
       }
     }
 
     if (!crashReporterAPIData->IsEmpty()) {
       // write out API data
-#ifdef XP_LINUX
-      OpenAPIData(apiData, descriptor.path());
-#else
-      OpenAPIData(apiData, dump_path, minidump_id);
-#endif
+      apiData.Open(extraDataPath);
       apiData.WriteBuffer(crashReporterAPIData->get(), crashReporterAPIData->Length());
     }
     WriteAnnotation(apiData, "CrashTime", crashTimeString);
     WriteAnnotation(apiData, "UptimeTS", uptimeTSString);
 
     if (timeSinceLastCrash != 0) {
       WriteAnnotation(apiData, "SecondsSinceLastCrash",
                       timeSinceLastCrashString);
@@ -1100,164 +1044,16 @@ bool MinidumpCallback(
 #endif
   }
 #endif // XP_MACOSX
 #endif // XP_UNIX
 
   return returnValue;
 }
 
-#if defined(XP_MACOSX) || defined(__ANDROID__)
-static size_t
-EnsureTrailingSlash(char* aBuf, size_t aBufLen)
-{
-  size_t len = XP_STRLEN(aBuf);
-  if ((len + 2) < aBufLen && aBuf[len - 1] != '/') {
-    aBuf[len] = '/';
-    ++len;
-    aBuf[len] = 0;
-  }
-  return len;
-}
-#endif
-
-#if defined(XP_WIN32)
-
-static size_t
-BuildTempPath(wchar_t* aBuf, size_t aBufLen)
-{
-  // first figure out buffer size
-  DWORD pathLen = GetTempPath(0, nullptr);
-  if (pathLen == 0 || pathLen >= aBufLen) {
-    return 0;
-  }
-
-  return GetTempPath(pathLen, aBuf);
-}
-
-#elif defined(XP_MACOSX)
-
-static size_t
-BuildTempPath(char* aBuf, size_t aBufLen)
-{
-  if (aBufLen < PATH_MAX) {
-    return 0;
-  }
-
-  FSRef fsRef;
-  OSErr err = FSFindFolder(kUserDomain, kTemporaryFolderType,
-                           kCreateFolder, &fsRef);
-  if (err != noErr) {
-    return 0;
-  }
-
-  OSStatus status = FSRefMakePath(&fsRef, (UInt8*)aBuf, PATH_MAX);
-  if (status != noErr) {
-    return 0;
-  }
-
-  return EnsureTrailingSlash(aBuf, aBufLen);
-}
-
-#elif defined(__ANDROID__)
-
-static size_t
-BuildTempPath(char* aBuf, size_t aBufLen)
-{
-  // GeckoAppShell or Gonk's init.rc sets this in the environment
-  const char *tempenv = PR_GetEnv("TMPDIR");
-  if (!tempenv) {
-    return false;
-  }
-  int size = (int)aBufLen;
-  Concat(aBuf, tempenv, &size);
-  return EnsureTrailingSlash(aBuf, aBufLen);
-}
-
-#elif defined(XP_UNIX)
-
-static size_t
-BuildTempPath(char* aBuf, size_t aBufLen)
-{
-  // we assume it's always /tmp on unix systems
-  NS_NAMED_LITERAL_CSTRING(tmpPath, "/tmp/");
-  int size = (int)aBufLen;
-  Concat(aBuf, tmpPath.get(), &size);
-  return tmpPath.Length();
-}
-
-#else
-#error "Implement this for your platform"
-#endif
-
-template <typename CharT, size_t N>
-static size_t
-BuildTempPath(CharT (&aBuf)[N])
-{
-  static_assert(N >= XP_PATH_MAX, "char array length is too small");
-  return BuildTempPath(&aBuf[0], N);
-}
-
-template <typename PathStringT>
-static bool
-BuildTempPath(PathStringT& aResult)
-{
-  aResult.SetLength(XP_PATH_MAX);
-  size_t actualLen = BuildTempPath(aResult.BeginWriting(), XP_PATH_MAX);
-  if (!actualLen) {
-    return false;
-  }
-  aResult.SetLength(actualLen);
-  return true;
-}
-
-static void
-PrepareChildExceptionTimeAnnotations()
-{
-  MOZ_ASSERT(!XRE_IsParentProcess());
-  static XP_CHAR tempPath[XP_PATH_MAX] = {0};
-
-  // Get the temp path
-  size_t tempPathLen = BuildTempPath(tempPath);
-  if (!tempPathLen) {
-    return;
-  }
-
-  // Generate and append the file name
-  int size = XP_PATH_MAX - tempPathLen;
-  XP_CHAR* p = tempPath + tempPathLen;
-  p = Concat(p, childCrashAnnotationBaseName, &size);
-  XP_CHAR pidBuffer[32] = XP_TEXT("");
-#if defined(XP_WIN32)
-  _ui64tow(GetCurrentProcessId(), pidBuffer, 10);
-#else
-  XP_STOA(getpid(), pidBuffer, 10);
-#endif
-  p = Concat(p, pidBuffer, &size);
-
-  // Now open the file...
-  PlatformWriter apiData;
-  OpenAPIData(apiData, tempPath);
-
-  // ...and write out any annotations. These should be escaped if necessary
-  // (but don't call EscapeAnnotation here, because it touches the heap).
-  char oomAllocationSizeBuffer[32] = "";
-  if (gOOMAllocationSize) {
-    XP_STOA(gOOMAllocationSize, oomAllocationSizeBuffer, 10);
-  }
-
-  if (oomAllocationSizeBuffer[0]) {
-    WriteAnnotation(apiData, "OOMAllocationSize", oomAllocationSizeBuffer);
-  }
-
-  if (gMozCrashReason) {
-    WriteAnnotation(apiData, "MozCrashReason", gMozCrashReason);
-  }
-}
-
 #ifdef XP_WIN
 static void
 ReserveBreakpadVM()
 {
   if (!gBreakpadReservedVM) {
     gBreakpadReservedVM = VirtualAlloc(nullptr, kReserveSize, MEM_RESERVE,
                                        PAGE_NOACCESS);
   }
@@ -1298,28 +1094,16 @@ static bool FPEFilter(void* context, EXC
     case STATUS_FLOAT_MULTIPLE_FAULTS:
     case STATUS_FLOAT_MULTIPLE_TRAPS:
       return false; // Don't write minidump, continue exception search
   }
   mozilla::IOInterposer::Disable();
   FreeBreakpadVM();
   return true;
 }
-
-static bool
-ChildFPEFilter(void* context, EXCEPTION_POINTERS* exinfo,
-               MDRawAssertionInfo* assertion)
-{
-  bool result = FPEFilter(context, exinfo, assertion);
-  if (result) {
-    PrepareChildExceptionTimeAnnotations();
-  }
-  return result;
-}
-
 #endif // XP_WIN
 
 static bool ShouldReport()
 {
   // this environment variable prevents us from launching
   // the crash reporter client
   const char *envvar = PR_GetEnv("MOZ_CRASHREPORTER_NO_REPORT");
   if (envvar && *envvar) {
@@ -1329,32 +1113,23 @@ static bool ShouldReport()
   envvar = PR_GetEnv("MOZ_CRASHREPORTER_FULLDUMP");
   if (envvar && *envvar) {
     return false;
   }
 
   return true;
 }
 
-static bool
-Filter(void* context)
-{
-  mozilla::IOInterposer::Disable();
-  return true;
+namespace {
+  bool Filter(void* context) {
+    mozilla::IOInterposer::Disable();
+    return true;
+  }
 }
 
-static bool
-ChildFilter(void* context)
-{
-  bool result = Filter(context);
-  if (result) {
-    PrepareChildExceptionTimeAnnotations();
-  }
-  return result;
-}
 
 nsresult SetExceptionHandler(nsIFile* aXREDirectory,
                              bool force/*=false*/)
 {
   if (gExceptionHandler)
     return NS_ERROR_ALREADY_INITIALIZED;
 
 #if !defined(DEBUG) || defined(MOZ_WIDGET_GONK)
@@ -1439,22 +1214,51 @@ nsresult SetExceptionHandler(nsIFile* aX
       crashReporterPath = ToNewCString(package);
     }
 #endif
   }
 
   // get temp path to use for minidump path
 #if defined(XP_WIN32)
   nsString tempPath;
+
+  // first figure out buffer size
+  int pathLen = GetTempPath(0, nullptr);
+  if (pathLen == 0)
+    return NS_ERROR_FAILURE;
+
+  tempPath.SetLength(pathLen);
+  GetTempPath(pathLen, (LPWSTR)tempPath.BeginWriting());
+#elif defined(XP_MACOSX)
+  nsCString tempPath;
+  FSRef fsRef;
+  OSErr err = FSFindFolder(kUserDomain, kTemporaryFolderType,
+                           kCreateFolder, &fsRef);
+  if (err != noErr)
+    return NS_ERROR_FAILURE;
+
+  char path[PATH_MAX];
+  OSStatus status = FSRefMakePath(&fsRef, (UInt8*)path, PATH_MAX);
+  if (status != noErr)
+    return NS_ERROR_FAILURE;
+
+  tempPath = path;
+
+#elif defined(__ANDROID__)
+  // GeckoAppShell or Gonk's init.rc sets this in the environment
+  const char *tempenv = PR_GetEnv("TMPDIR");
+  if (!tempenv)
+    return NS_ERROR_FAILURE;
+  nsCString tempPath(tempenv);
+#elif defined(XP_UNIX)
+  // we assume it's always /tmp on unix systems
+  nsCString tempPath = NS_LITERAL_CSTRING("/tmp/");
 #else
-  nsCString tempPath;
+#error "Implement this for your platform"
 #endif
-  if (!BuildTempPath(tempPath)) {
-    return NS_ERROR_FAILURE;
-  }
 
 #ifdef XP_MACOSX
   // Initialize spawn attributes, since this calls malloc.
   if (posix_spawnattr_init(&spawnattr) != 0) {
     return NS_ERROR_FAILURE;
   }
 
   // Set spawn attributes.
@@ -2868,174 +2672,34 @@ WriteExtraData(nsIFile* extraFile,
 }
 
 bool
 AppendExtraData(nsIFile* extraFile, const AnnotationTable& data)
 {
   return WriteExtraData(extraFile, data, Blacklist());
 }
 
-static bool
-GetExtraFileForChildPid(nsIFile* aMinidump, uint32_t aPid, nsIFile** aExtraFile)
-{
-  MOZ_ASSERT(XRE_IsParentProcess());
-
-  nsCOMPtr<nsIFile> extraFile;
-  nsresult rv;
-
-#if defined(XP_WIN) || defined(XP_MACOSX)
-#  if defined(MOZ_CONTENT_SANDBOX)
-  if (!contentProcessTmpDir) {
-    return false;
-  }
-  CreateFileFromPath(*contentProcessTmpDir, getter_AddRefs(extraFile));
-  if (!extraFile) {
-    return false;
-  }
-#  else
-  rv = aMinidump->Clone(getter_AddRefs(extraFile));
-  if (NS_FAILED(rv)) {
-    return false;
-  }
-#  endif // defined(MOZ_CONTENT_SANDBOX)
-#elif defined(XP_UNIX)
-  rv = NS_NewLocalFile(NS_LITERAL_STRING("/tmp"), false,
-                       getter_AddRefs(extraFile));
-  if (NS_FAILED(rv)) {
-    return false;
-  }
-#else
-#error "Implement this for your platform"
-#endif
-
-  nsAutoString leafName;
-#if defined(XP_WIN)
-  leafName.AppendPrintf("%S%u%S", childCrashAnnotationBaseName, aPid,
-                        extraFileExtension);
-#else
-  leafName.AppendPrintf("%s%u%s", childCrashAnnotationBaseName, aPid,
-                        extraFileExtension);
-#endif
-
-#if defined(XP_WIN) || defined(XP_MACOSX)
-#  if defined(MOZ_CONTENT_SANDBOX)
-  rv = extraFile->Append(leafName);
-  if (NS_FAILED(rv)) {
-    return false;
-  }
-#  else
-  rv = extraFile->SetLeafName(leafName);
-  if (NS_FAILED(rv)) {
-    return false;
-  }
-#  endif // defined(MOZ_CONTENT_SANDBOX)
-#elif defined(XP_UNIX)
-  rv = extraFile->Append(leafName);
-  if (NS_FAILED(rv)) {
-    return false;
-  }
-#else
-#error "Implement this for your platform"
-#endif
-
-  extraFile.forget(aExtraFile);
-  return true;
-}
 
 static bool
-IsDataEscaped(char* aData)
-{
-  if (strchr(aData, '\n')) {
-    // There should not be any newlines
-    return false;
-  }
-  char* pos = aData;
-  while ((pos = strchr(pos, '\\'))) {
-    if (*(pos + 1) != '\\') {
-      return false;
-    }
-    // Add 2 to account for the second pos
-    pos += 2;
-  }
-  return true;
-}
-
-static void
-ReadAndValidateExceptionTimeAnnotations(FILE*& aFd,
-                                        AnnotationTable& aAnnotations)
-{
-  char line[0x1000];
-  while (fgets(line, sizeof(line), aFd)) {
-    char* data = strchr(line, '=');
-    if (!data) {
-      // bad data? Abort!
-      break;
-    }
-    // Move past the '='
-    *data = 0;
-    ++data;
-    size_t dataLen = strlen(data);
-    // Chop off any trailing newline
-    if (dataLen > 0 && data[dataLen - 1] == '\n') {
-      data[dataLen - 1] = 0;
-      --dataLen;
-    }
-    // There should not be any newlines in the key
-    if (strchr(line, '\n')) {
-      break;
-    }
-    // Data should have been escaped by the child
-    if (!IsDataEscaped(data)) {
-      break;
-    }
-    // Looks good, save the (line,data) pair
-    aAnnotations.Put(nsDependentCString(line),
-                     nsDependentCString(data, dataLen));
-  }
-}
-
-/**
- * NOTE: One side effect of this function is that it deletes the
- * GeckoChildCrash<pid>.extra file if it exists, once processed.
- */
-static bool
 WriteExtraForMinidump(nsIFile* minidump,
-                      uint32_t pid,
                       const Blacklist& blacklist,
                       nsIFile** extraFile)
 {
   nsCOMPtr<nsIFile> extra;
-  if (!GetExtraFileForMinidump(minidump, getter_AddRefs(extra))) {
+  if (!GetExtraFileForMinidump(minidump, getter_AddRefs(extra)))
     return false;
-  }
 
   if (!WriteExtraData(extra, *crashReporterAPIData_Hash,
                       blacklist,
                       true /*write crash time*/,
-                      true /*truncate*/)) {
+                      true /*truncate*/))
     return false;
-  }
-
-  nsCOMPtr<nsIFile> exceptionTimeExtra;
-  FILE* fd;
-  if (pid && GetExtraFileForChildPid(minidump, pid,
-                                     getter_AddRefs(exceptionTimeExtra)) &&
-      NS_SUCCEEDED(exceptionTimeExtra->OpenANSIFileDesc("r", &fd))) {
-    AnnotationTable exceptionTimeAnnotations;
-    ReadAndValidateExceptionTimeAnnotations(fd, exceptionTimeAnnotations);
-    fclose(fd);
-    if (!AppendExtraData(extra, exceptionTimeAnnotations)) {
-      return false;
-    }
-  }
-  if (exceptionTimeExtra) {
-    exceptionTimeExtra->Remove(false);
-  }
-
-  extra.forget(extraFile);
+
+  *extraFile = nullptr;
+  extra.swap(*extraFile);
 
   return true;
 }
 
 // It really only makes sense to call this function when
 // ShouldReport() is true.
 static bool
 MoveToPending(nsIFile* dumpFile, nsIFile* extraFile)
@@ -3079,33 +2743,32 @@ OnChildProcessDumpRequested(void* aConte
   CreateFileFromPath(
 #ifdef XP_MACOSX
                      aFilePath,
 #else
                      *aFilePath,
 #endif
                      getter_AddRefs(minidump));
 
-  uint32_t pid =
-#ifdef XP_MACOSX
-    aClientInfo.pid();
-#else
-    aClientInfo->pid();
-#endif
-
-  if (!WriteExtraForMinidump(minidump, pid,
+  if (!WriteExtraForMinidump(minidump,
                              Blacklist(kSubprocessBlacklist,
                                        ArrayLength(kSubprocessBlacklist)),
                              getter_AddRefs(extraFile)))
     return;
 
   if (ShouldReport())
     MoveToPending(minidump, extraFile);
 
   {
+    uint32_t pid =
+#ifdef XP_MACOSX
+      aClientInfo.pid();
+#else
+      aClientInfo->pid();
+#endif
 
 #ifdef MOZ_CRASHREPORTER_INJECTOR
     bool runCallback;
 #endif
     {
       MutexAutoLock lock(*dumpMapLock);
       ChildProcessData* pd = pidToMinidump->PutEntry(pid);
       MOZ_ASSERT(!pd->minidump);
@@ -3123,16 +2786,23 @@ OnChildProcessDumpRequested(void* aConte
 }
 
 static bool
 OOPInitialized()
 {
   return pidToMinidump != nullptr;
 }
 
+#ifdef XP_MACOSX
+static bool ChildFilter(void *context) {
+  mozilla::IOInterposer::Disable();
+  return true;
+}
+#endif
+
 void
 OOPInit()
 {
   class ProxyToMainThread : public nsRunnable
   {
   public:
     NS_IMETHOD Run() {
       OOPInit();
@@ -3149,24 +2819,16 @@ OOPInit()
   if (OOPInitialized())
     return;
 
   MOZ_ASSERT(NS_IsMainThread());
 
   MOZ_ASSERT(gExceptionHandler != nullptr,
              "attempt to initialize OOP crash reporter before in-process crashreporter!");
 
-#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
-  nsCOMPtr<nsIFile> tmpDir;
-  nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tmpDir));
-  if (NS_SUCCEEDED(rv)) {
-    contentProcessTmpDir = CreatePathFromFile(tmpDir);
-  }
-#endif
-
 #if defined(XP_WIN)
   childCrashNotifyPipe =
     PR_smprintf("\\\\.\\pipe\\gecko-crash-server-pipe.%i",
                 static_cast<int>(::GetCurrentProcessId()));
 
   const std::wstring dumpPath = gExceptionHandler->dump_path();
   crashServer = new CrashGenerationServer(
     std::wstring(NS_ConvertASCIItoUTF16(childCrashNotifyPipe).get()),
@@ -3195,17 +2857,17 @@ OOPInit()
 #elif defined(XP_MACOSX)
   childCrashNotifyPipe =
     PR_smprintf("gecko-crash-server-pipe.%i",
                 static_cast<int>(getpid()));
   const std::string dumpPath = gExceptionHandler->dump_path();
 
   crashServer = new CrashGenerationServer(
     childCrashNotifyPipe,
-    nullptr,
+    ChildFilter,
     nullptr,
     OnChildProcessDumpRequested, nullptr,
     nullptr, nullptr,
     true, // automatically generate dumps
     dumpPath);
 #endif
 
   if (!crashServer->Start())
@@ -3403,26 +3065,26 @@ SetRemoteExceptionHandler(const nsACStri
   // crash reporting is disabled
   if (crashPipe.Equals(kNullNotifyPipe))
     return true;
 
   MOZ_ASSERT(!gExceptionHandler, "crash client already init'd");
 
   gExceptionHandler = new google_breakpad::
     ExceptionHandler(L"",
-                     ChildFPEFilter,
+                     FPEFilter,
                      nullptr,    // no minidump callback
                      nullptr,    // no callback context
                      google_breakpad::ExceptionHandler::HANDLER_ALL,
                      MiniDumpNormal,
                      NS_ConvertASCIItoUTF16(crashPipe).get(),
                      nullptr);
+#ifdef XP_WIN
   gExceptionHandler->set_handle_debug_exceptions(true);
-
-  mozalloc_set_oom_abort_handler(AnnotateOOMAllocationSize);
+#endif
 
   // we either do remote or nothing, no fallback to regular crash reporting
   return gExceptionHandler->IsOutOfProcess();
 }
 
 //--------------------------------------------------
 #elif defined(XP_LINUX)
 
@@ -3445,36 +3107,37 @@ CreateNotificationPipeForChild(int* chil
 }
 
 // Child-side API
 bool
 SetRemoteExceptionHandler()
 {
   MOZ_ASSERT(!gExceptionHandler, "crash client already init'd");
 
+#ifndef XP_LINUX
+  xpstring path = "";
+#else
   // MinidumpDescriptor requires a non-empty path.
   google_breakpad::MinidumpDescriptor path(".");
-
+#endif
   gExceptionHandler = new google_breakpad::
     ExceptionHandler(path,
-                     ChildFilter,
+                     nullptr,    // no filter callback
                      nullptr,    // no minidump callback
                      nullptr,    // no callback context
                      true,       // install signal handlers
                      kMagicChildCrashReportFd);
 
   if (gDelayedAnnotations) {
     for (uint32_t i = 0; i < gDelayedAnnotations->Length(); i++) {
       gDelayedAnnotations->ElementAt(i)->Run();
     }
     delete gDelayedAnnotations;
   }
 
-  mozalloc_set_oom_abort_handler(AnnotateOOMAllocationSize);
-
   // we either do remote or nothing, no fallback to regular crash reporting
   return gExceptionHandler->IsOutOfProcess();
 }
 
 //--------------------------------------------------
 #elif defined(XP_MACOSX)
 // Child-side API
 bool
@@ -3483,24 +3146,22 @@ SetRemoteExceptionHandler(const nsACStri
   // crash reporting is disabled
   if (crashPipe.Equals(kNullNotifyPipe))
     return true;
 
   MOZ_ASSERT(!gExceptionHandler, "crash client already init'd");
 
   gExceptionHandler = new google_breakpad::
     ExceptionHandler("",
-                     ChildFilter,
+                     Filter,
                      nullptr,    // no minidump callback
                      nullptr,    // no callback context
                      true,       // install signal handlers
                      crashPipe.BeginReading());
 
-  mozalloc_set_oom_abort_handler(AnnotateOOMAllocationSize);
-
   // we either do remote or nothing, no fallback to regular crash reporting
   return gExceptionHandler->IsOutOfProcess();
 }
 #endif  // XP_WIN
 
 
 bool
 TakeMinidumpForChild(uint32_t childPid, nsIFile** dump, uint32_t* aSequence)
@@ -3604,17 +3265,17 @@ PairedDumpCallbackExtra(
 #ifdef XP_WIN32
                      nullptr, nullptr,
 #endif
                      succeeded);
 
   nsCOMPtr<nsIFile>& minidump = *static_cast< nsCOMPtr<nsIFile>* >(context);
 
   nsCOMPtr<nsIFile> extra;
-  return WriteExtraForMinidump(minidump, 0, Blacklist(), getter_AddRefs(extra));
+  return WriteExtraForMinidump(minidump, Blacklist(), getter_AddRefs(extra));
 }
 
 ThreadId
 CurrentThreadId()
 {
 #if defined(XP_WIN)
   return ::GetCurrentThreadId();
 #elif defined(XP_LINUX)
--- a/toolkit/crashreporter/test/unit_ipc/test_content_annotation.js
+++ b/toolkit/crashreporter/test/unit_ipc/test_content_annotation.js
@@ -2,21 +2,21 @@ load("../unit/head_crashreporter.js");
 
 function run_test()
 {
   if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
     dump("INFO | test_content_annotation.js | Can't test crashreporter in a non-libxul build.\n");
     return;
   }
 
-  // Try crashing with a runtime abort
+  // Try crashing with a pure virtual call
   do_content_crash(function() {
                      crashType = CrashTestUtils.CRASH_RUNTIMEABORT;
                      crashReporter.annotateCrashReport("TestKey", "TestValue");
                      crashReporter.appendAppNotesToCrashReport("!!!foo!!!");
-                   },
+		   },
                    function(mdump, extra) {
                      do_check_eq(extra.TestKey, "TestValue");
                      do_check_true('StartupTime' in extra);
                      do_check_true('ProcessType' in extra);
                      do_check_neq(extra.Notes.indexOf("!!!foo!!!"), -1);
                    });
 }
deleted file mode 100644
--- a/toolkit/crashreporter/test/unit_ipc/test_content_exception_time_annotation.js
+++ /dev/null
@@ -1,17 +0,0 @@
-load("../unit/head_crashreporter.js");
-
-function run_test()
-{
-  if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
-    dump("INFO | test_content_annotation.js | Can't test crashreporter in a non-libxul build.\n");
-    return;
-  }
-
-  // Try crashing with an OOM
-  do_content_crash(function() {
-                     crashType = CrashTestUtils.CRASH_OOM;
-                   },
-                   function(mdump, extra) {
-                     do_check_true('OOMAllocationSize' in extra);
-                   });
-}
--- a/toolkit/crashreporter/test/unit_ipc/xpcshell.ini
+++ b/toolkit/crashreporter/test/unit_ipc/xpcshell.ini
@@ -1,7 +1,6 @@
 [DEFAULT]
 head =
 tail =
 skip-if = toolkit == 'android' || toolkit == 'gonk'
 
 [test_content_annotation.js]
-[test_content_exception_time_annotation.js]
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -598,25 +598,47 @@ ProcessDDE(nsINativeAppSupport* aNative,
  * @return true in all environments
 */
 static bool
 CanShowProfileManager()
 {
   return true;
 }
 
+#if defined(XP_WIN) && defined(MOZ_CONTENT_SANDBOX)
+static const char*
+SandboxTempDirParent()
+{
+  return NS_WIN_LOW_INTEGRITY_TEMP_BASE;
+}
+#endif
+
+#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
+static const char*
+SandboxTempDirParent()
+{
+  return NS_OS_TEMP_DIR;
+}
+#endif
+
 #if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
 static already_AddRefed<nsIFile>
-GetAndCleanTempDir()
+GetAndCleanTempDir(const nsAString& aTempDirSuffix)
 {
   // Get the directory within which we'll place the
   // sandbox-writable temp directory
   nsCOMPtr<nsIFile> tempDir;
-  nsresult rv = NS_GetSpecialDirectory(NS_APP_CONTENT_PROCESS_TEMP_DIR,
-                                       getter_AddRefs(tempDir));
+  nsresult rv = NS_GetSpecialDirectory(SandboxTempDirParent(),
+      getter_AddRefs(tempDir));
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return nullptr;
+  }
+
+  // Append our profile specific temp name.
+  rv = tempDir->Append(NS_LITERAL_STRING("Temp-") + aTempDirSuffix);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return nullptr;
   }
 
   rv = tempDir->Remove(/* aRecursive */ true);
   if (NS_FAILED(rv) && rv != NS_ERROR_FILE_NOT_FOUND) {
     NS_WARNING("Failed to delete temp directory.");
     return nullptr;
@@ -687,17 +709,17 @@ SetUpSandboxEnvironment()
       // Again, if we fail to save the pref file we might not be able to clean
       // up the temp directory, so don't create one.
       NS_WARNING("Failed to save pref file, cannot create temp dir.");
       return;
     }
   }
 
   // Get (and clean up if still there) the sandbox-writable temp directory.
-  nsCOMPtr<nsIFile> tempDir = GetAndCleanTempDir();
+  nsCOMPtr<nsIFile> tempDir = GetAndCleanTempDir(tempDirSuffix);
   if (!tempDir) {
     NS_WARNING("Failed to get or clean sandboxed temp directory.");
     return;
   }
 
   rv = tempDir->Create(nsIFile::DIRECTORY_TYPE, 0700);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return;
@@ -709,19 +731,26 @@ CleanUpSandboxEnvironment()
 {
 #if defined(XP_WIN)
   // We can't have created the temp directory before Vista.
   if (!IsVistaOrLater()) {
     return;
   }
 #endif
 
+  // Get temp directory suffix pref.
+  nsAdoptingString tempDirSuffix =
+    Preferences::GetString("security.sandbox.content.tempDirSuffix");
+  if (tempDirSuffix.IsEmpty()) {
+    return;
+  }
+
   // Get and remove the sandbox-writable temp directory.
   // This function already warns if the deletion fails.
-  nsCOMPtr<nsIFile> tempDir = GetAndCleanTempDir();
+  nsCOMPtr<nsIFile> tempDir = GetAndCleanTempDir(tempDirSuffix);
 }
 #endif
 
 bool gSafeMode = false;
 
 /**
  * The nsXULAppInfo object implements nsIFactory so that it can be its own
  * singleton.
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -392,24 +392,16 @@ nsXREDirProvider::GetFile(const char* aP
   }
   else if (!strcmp(aProperty, XRE_ADDON_APP_DIR)) {
     nsCOMPtr<nsIDirectoryServiceProvider> dirsvc(do_GetService("@mozilla.org/file/directory_service;1", &rv));
     if (NS_FAILED(rv))
       return rv;
     bool unused;
     rv = dirsvc->GetFile("XCurProcD", &unused, getter_AddRefs(file));
   }
-#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
-  else if (!strcmp(aProperty, NS_APP_CONTENT_PROCESS_TEMP_DIR)) {
-    if (!mContentTempDir && NS_FAILED((rv = LoadContentProcessTempDir()))) {
-      return rv;
-    }
-    rv = mContentTempDir->Clone(getter_AddRefs(file));
-  }
-#endif // defined(XP_WIN) && defined(MOZ_CONTENT_SANDBOX)
   else if (NS_SUCCEEDED(GetProfileStartupDir(getter_AddRefs(file)))) {
     // We need to allow component, xpt, and chrome registration to
     // occur prior to the profile-after-change notification.
     if (!strcmp(aProperty, NS_APP_USER_CHROME_DIR)) {
       rv = file->AppendNative(NS_LITERAL_CSTRING("chrome"));
     }
   }
 
@@ -623,60 +615,16 @@ LoadExtensionDirectories(nsINIParser &pa
       nsCOMPtr<nsIFile> manifest =
         CloneAndAppend(dir, "chrome.manifest");
       XRE_AddManifestLocation(aType, manifest);
     }
   }
   while (true);
 }
 
-#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
-
-static const char*
-GetContentProcessTempBaseDirKey()
-{
-#if defined(XP_WIN)
-  return NS_WIN_LOW_INTEGRITY_TEMP_BASE;
-#else
-  return NS_OS_TEMP_DIR;
-#endif
-}
-
-nsresult
-nsXREDirProvider::LoadContentProcessTempDir()
-{
-  nsCOMPtr<nsIFile> localFile;
-
-  nsresult rv = NS_GetSpecialDirectory(GetContentProcessTempBaseDirKey(),
-                                       getter_AddRefs(localFile));
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  nsAutoString tempDirSuffix;
-  rv = Preferences::GetString("security.sandbox.content.tempDirSuffix",
-                              &tempDirSuffix);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-  if (tempDirSuffix.IsEmpty()) {
-    return NS_ERROR_NOT_AVAILABLE;
-  }
-
-  rv = localFile->Append(NS_LITERAL_STRING("Temp-") + tempDirSuffix);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  localFile.swap(mContentTempDir);
-  return NS_OK;
-}
-
-#endif // defined(XP_WIN) && defined(MOZ_CONTENT_SANDBOX)
-
 void
 nsXREDirProvider::LoadExtensionBundleDirectories()
 {
   if (!mozilla::Preferences::GetBool("extensions.defaultProviders.enabled", true))
     return;
 
   if (mProfileDir) {
     if (!gSafeMode) {
@@ -916,17 +864,16 @@ nsXREDirProvider::DoStartup()
       if (!gSafeMode && safeModeNecessary) {
         appStartup->RestartInSafeMode(nsIAppStartup::eForceQuit);
         return NS_OK;
       }
     }
 
     static const char16_t kStartup[] = {'s','t','a','r','t','u','p','\0'};
     obsSvc->NotifyObservers(nullptr, "profile-do-change", kStartup);
-
     // Init the Extension Manager
     nsCOMPtr<nsIObserver> em = do_GetService("@mozilla.org/addons/integration;1");
     if (em) {
       em->Observe(nullptr, "addons-startup", nullptr);
     } else {
       NS_WARNING("Failed to create Addons Manager.");
     }
 
--- a/toolkit/xre/nsXREDirProvider.h
+++ b/toolkit/xre/nsXREDirProvider.h
@@ -116,21 +116,16 @@ protected:
                                     bool aLocal);
 
   static nsresult AppendSysUserExtensionPath(nsIFile* aFile);
 
   // Internal helper that splits a path into components using the '/' and '\\'
   // delimiters.
   static inline nsresult AppendProfileString(nsIFile* aFile, const char* aPath);
 
-#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
-  // Load the temp directory for sandboxed content processes
-  nsresult LoadContentProcessTempDir();
-#endif
-
   // Calculate and register extension and theme bundle directories.
   void LoadExtensionBundleDirectories();
 
 #ifdef MOZ_B2G
   // Calculate and register app-bundled extension directories.
   void LoadAppBundleDirs();
 #endif
 
@@ -141,17 +136,14 @@ protected:
   nsCOMPtr<nsIFile>      mGREDir;
   // On OSX, mGREBinDir points to .app/Contents/MacOS
   nsCOMPtr<nsIFile>      mGREBinDir;
   // On OSX, mXULAppDir points to .app/Contents/Resources/browser
   nsCOMPtr<nsIFile>      mXULAppDir;
   nsCOMPtr<nsIFile>      mProfileDir;
   nsCOMPtr<nsIFile>      mProfileLocalDir;
   bool                   mProfileNotified;
-#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
-  nsCOMPtr<nsIFile>      mContentTempDir;
-#endif
   nsCOMArray<nsIFile>    mAppBundleDirectories;
   nsCOMArray<nsIFile>    mExtensionDirectories;
   nsCOMArray<nsIFile>    mThemeDirectories;
 };
 
 #endif
--- a/xpcom/io/nsAppDirectoryServiceDefs.h
+++ b/xpcom/io/nsAppDirectoryServiceDefs.h
@@ -78,14 +78,9 @@
 
 #define NS_APP_SEARCH_50_FILE                   "SrchF"
 
 #define NS_APP_INSTALL_CLEANUP_DIR              "XPIClnupD"  //location of xpicleanup.dat xpicleanup.exe 
 
 #define NS_APP_INDEXEDDB_PARENT_DIR             "indexedDBPDir"
 
 #define NS_APP_PERMISSION_PARENT_DIR            "permissionDBPDir"
-
-#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
-#define NS_APP_CONTENT_PROCESS_TEMP_DIR         "ContentTmpD"
-#endif // (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
-
-#endif // nsAppDirectoryServiceDefs_h___
+#endif