diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -102,16 +102,17 @@ using google_breakpad::ClientInfo;
 using mozilla::Mutex;
 using mozilla::MutexAutoLock;
 #endif
 
 namespace CrashReporter {
 
 #ifdef XP_WIN32
 typedef wchar_t XP_CHAR;
+typedef std::wstring xpstring;
 #define CONVERT_UTF16_TO_XP_CHAR(x) x
 #define CONVERT_XP_CHAR_TO_UTF16(x) x
 #define XP_STRLEN(x) wcslen(x)
 #define CRASH_REPORTER_FILENAME "crashreporter.exe"
 #define PATH_SEPARATOR "\\"
 #define XP_PATH_SEPARATOR L"\\"
 // sort of arbitrary, but MAX_PATH is kinda small
 #define XP_PATH_MAX 4096
@@ -119,16 +120,17 @@ typedef wchar_t XP_CHAR;
 #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
 #else
 typedef char XP_CHAR;
+typedef std::string xpstring;
 #define CONVERT_UTF16_TO_XP_CHAR(x) NS_ConvertUTF16toUTF8(x)
 #define CONVERT_XP_CHAR_TO_UTF16(x) NS_ConvertUTF8toUTF16(x)
 #define XP_STRLEN(x) strlen(x)
 #define CRASH_REPORTER_FILENAME "crashreporter"
 #define PATH_SEPARATOR "/"
 #define XP_PATH_SEPARATOR "/"
 #define XP_PATH_MAX PATH_MAX
 #define XP_TTOA(time, buffer, base) sprintf(buffer, "%ld", time)
@@ -185,16 +187,28 @@ static const int kMagicChildCrashReportF
 
 // |dumpMapLock| must protect all access to |pidToMinidump|.
 static Mutex* dumpMapLock;
 typedef nsInterfaceHashtable<nsUint32HashKey, nsIFile> ChildMinidumpMap;
 static ChildMinidumpMap* pidToMinidump;
 
 #endif  // MOZ_IPC
 
+static void
+NewLocalFile(const xpstring* aFilePath, nsILocalFile** aFile NS_OUTPARAM)
+{
+#ifdef XP_WIN
+  NS_NewLocalFile(nsDependentString(aFilePath->c_str()), PR_FALSE,
+                  aFile);
+#else
+  NS_NewNativeLocalFile(nsDependentCString(aFilePath->c_str()), PR_FALSE,
+                        aFile);
+#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;
 
   memcpy(str, toAppend, appendLen * sizeof(XP_CHAR));
   str += appendLen;
@@ -264,27 +278,19 @@ bool MinidumpCallback(const XP_CHAR* dum
     if (fd != -1) {
       ssize_t ignored = write(fd, crashTimeString, crashTimeStringLen);
       (void)ignored;
       close(fd);
     }
 #endif
   }
 
+  // write out API data
 #if defined(XP_WIN32)
-  XP_CHAR cmdLine[CMDLINE_SIZE];
-  size = CMDLINE_SIZE;
-  p = Concat(cmdLine, L"\"", &size);
-  p = Concat(p, crashReporterPath, &size);
-  p = Concat(p, L"\" \"", &size);
-  p = Concat(p, minidumpPath, &size);
-  Concat(p, L"\"", &size);
-
   if (!crashReporterAPIData->IsEmpty()) {
-    // write out API data
     HANDLE hFile = CreateFile(extraDataPath, GENERIC_WRITE, 0,
                               NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,
                               NULL);
     if(hFile != INVALID_HANDLE_VALUE) {
       DWORD nBytes;
       WriteFile(hFile, crashReporterAPIData->get(),
                 crashReporterAPIData->Length(), &nBytes, NULL);
       WriteFile(hFile, kCrashTimeParameter, kCrashTimeParameterLen,
@@ -296,40 +302,18 @@ bool MinidumpCallback(const XP_CHAR* dum
                   kTimeSinceLastCrashParameterLen, &nBytes, NULL);
         WriteFile(hFile, timeSinceLastCrashString, timeSinceLastCrashStringLen,
                   &nBytes, NULL);
         WriteFile(hFile, "\n", 1, &nBytes, NULL);
       }
       CloseHandle(hFile);
     }
   }
-
-  if (!doReport) {
-    return returnValue;
-  }
-
-  STARTUPINFO si;
-  PROCESS_INFORMATION pi;
-
-  ZeroMemory(&si, sizeof(si));
-  si.cb = sizeof(si);
-  si.dwFlags = STARTF_USESHOWWINDOW;
-  si.wShowWindow = SW_SHOWNORMAL;
-  ZeroMemory(&pi, sizeof(pi));
-
-  if (CreateProcess(NULL, (LPWSTR)cmdLine, NULL, NULL, FALSE, 0,
-                    NULL, NULL, &si, &pi)) {
-    CloseHandle( pi.hProcess );
-    CloseHandle( pi.hThread );
-  }
-  // we're not really in a position to do anything if the CreateProcess fails
-  TerminateProcess(GetCurrentProcess(), 1);
 #elif defined(XP_UNIX)
   if (!crashReporterAPIData->IsEmpty()) {
-    // write out API data
     int fd = open(extraDataPath,
                   O_WRONLY | O_CREAT | O_TRUNC,
                   0666);
 
     if (fd != -1) {
       // not much we can do in case of error
       ssize_t ignored = write(fd, crashReporterAPIData->get(),
                               crashReporterAPIData->Length());
@@ -341,35 +325,64 @@ bool MinidumpCallback(const XP_CHAR* dum
                         kTimeSinceLastCrashParameterLen);
         ignored = write(fd, timeSinceLastCrashString,
                         timeSinceLastCrashStringLen);
         ignored = write(fd, "\n", 1);
       }
       close (fd);
     }
   }
+#endif
 
   if (!doReport) {
     return returnValue;
   }
 
+  // launch the crashreporter application
+#if defined(XP_WIN32)
+  XP_CHAR cmdLine[CMDLINE_SIZE];
+  size = CMDLINE_SIZE;
+  p = Concat(cmdLine, L"\"", &size);
+  p = Concat(p, crashReporterPath, &size);
+  p = Concat(p, L"\" \"", &size);
+  p = Concat(p, minidumpPath, &size);
+  Concat(p, L"\"", &size);
+
+  STARTUPINFO si;
+  PROCESS_INFORMATION pi;
+
+  ZeroMemory(&si, sizeof(si));
+  si.cb = sizeof(si);
+  si.dwFlags = STARTF_USESHOWWINDOW;
+  si.wShowWindow = SW_SHOWNORMAL;
+  ZeroMemory(&pi, sizeof(pi));
+
+  if (CreateProcess(NULL, (LPWSTR)cmdLine, NULL, NULL, FALSE, 0,
+                    NULL, NULL, &si, &pi)) {
+    CloseHandle( pi.hProcess );
+    CloseHandle( pi.hThread );
+  }
+  // we're not really in a position to do anything if the CreateProcess fails
+  TerminateProcess(GetCurrentProcess(), 1);
+#elif defined(XP_UNIX)
   pid_t pid = fork();
 
   if (pid == -1)
     return false;
   else if (pid == 0) {
     // need to clobber this, as libcurl might load NSS,
     // and we want it to load the system NSS.
     unsetenv("LD_LIBRARY_PATH");
     (void) execl(crashReporterPath,
                  crashReporterPath, minidumpPath, (char*)0);
     _exit(1);
   }
 #endif
 
+  // not reached
  return returnValue;
 }
 
 #ifdef XP_WIN
 /**
  * Filters out floating point exceptions which are handled by nsSigHandlers.cpp
  * and should not be handled as crashes.
  */
@@ -1185,33 +1198,25 @@ MoveToPending(nsIFile* dumpFile, nsIFile
 
   return NS_FAILED(dumpFile->MoveTo(pendingDir, EmptyString())) ||
     NS_FAILED(extraFile->MoveTo(pendingDir, EmptyString()));
 }
 
 static void
 OnChildProcessDumpRequested(void* aContext,
                             const ClientInfo* aClientInfo,
-#if defined(XP_WIN)
-                            const std::wstring*
-#else
-                            const std::string*
-#endif
-                              aFilePath)
+                            const xpstring* aFilePath)
 {
   nsCOMPtr<nsILocalFile> lf;
   PRUint32 pid;
 
+  NewLocalFile(aFilePath, getter_AddRefs(lf));
 #ifdef XP_WIN
-  NS_NewLocalFile(nsDependentString(aFilePath->c_str()), PR_FALSE,
-                  getter_AddRefs(lf));
   pid = aClientInfo->pid();
 #else
-  NS_NewNativeLocalFile(nsDependentCString(aFilePath->c_str()), PR_FALSE,
-                        getter_AddRefs(lf));
   pid = aClientInfo->pid_;
 #endif
 
   // Get an .extra file with the same base name as the .dmp file
   nsCOMPtr<nsIFile> extraFile;
   nsresult rv = lf->Clone(getter_AddRefs(extraFile));
   if (NS_FAILED(rv))
     return;
