Bug 1535226 - Remove uses of XP_WIN32 in Gecko. r=glandium
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 21 Mar 2019 01:28:50 +0000
changeset 465508 c36acc45cddcc9ddc89d4e84acf44c0c206eb341
parent 465507 494ebb6edf2a49f6d4f47fad9f00c156ea3d803f
child 465509 07074627ea715188c52537f05b8d1a103788e6a9
push id35741
push userapavel@mozilla.com
push dateFri, 22 Mar 2019 09:56:25 +0000
treeherdermozilla-central@6332e136b825 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1535226
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1535226 - Remove uses of XP_WIN32 in Gecko. r=glandium The definitions can't be entirely removed yet because NSS still needs them. Differential Revision: https://phabricator.services.mozilla.com/D23454
browser/installer/package-manifest.in
build/moz.configure/init.configure
dom/ipc/ContentParent.cpp
gfx/src/nsCoord.h
js/src/old-configure.in
js/src/vm/Printer.cpp
old-configure.in
security/moz.build
toolkit/components/commandlines/nsCommandLine.cpp
toolkit/crashreporter/client/crashreporter.h
toolkit/crashreporter/minidump-analyzer/minidump-analyzer.cpp
toolkit/crashreporter/nsDummyExceptionHandler.cpp
toolkit/crashreporter/nsExceptionHandler.cpp
toolkit/crashreporter/nsExceptionHandler.h
toolkit/crashreporter/test/nsTestCrasher.cpp
toolkit/xre/nsAppRunner.cpp
xpcom/build/PoisonIOInterposerBase.cpp
xpcom/build/nsXPCOMPrivate.h
xpcom/ds/nsMathUtils.h
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -82,17 +82,17 @@
 @BINPATH@/@DLL_PREFIX@xul@DLL_SUFFIX@
 #endif
 #ifdef XP_MACOSX
 @BINPATH@/@MOZ_CHILD_PROCESS_NAME@.app/
 @BINPATH@/@DLL_PREFIX@plugin_child_interpose@DLL_SUFFIX@
 #else
 @BINPATH@/@MOZ_CHILD_PROCESS_NAME@
 #endif
-#ifdef XP_WIN32
+#ifdef XP_WIN
 @BINPATH@/plugin-hang-ui@BIN_SUFFIX@
 #if MOZ_PACKAGE_MSVC_DLLS
 @BINPATH@/@MSVC_C_RUNTIME_DLL@
 @BINPATH@/@MSVC_CXX_RUNTIME_DLL@
 #endif
 #if MOZ_PACKAGE_WIN_UCRT_DLLS
 @BINPATH@/api-ms-win-*.dll
 @BINPATH@/ucrtbase.dll
@@ -146,17 +146,17 @@
 @BINPATH@/@DLL_PREFIX@qipcap64@DLL_SUFFIX@
 #else
 @BINPATH@/@DLL_PREFIX@qipcap@DLL_SUFFIX@
 #endif
 #endif
 
 ; [Components]
 #ifdef ACCESSIBILITY
-#ifdef XP_WIN32
+#ifdef XP_WIN
 @BINPATH@/Accessible.tlb
 @BINPATH@/AccessibleHandler.dll
 @BINPATH@/AccessibleMarshal.dll
 @BINPATH@/IA2Marshal.dll
 #endif
 #endif
 
 ; JavaScript components
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -984,17 +984,16 @@ add_old_configure_assignment('HOST_OS_AR
 def target_is_windows(target):
     if target.kernel == 'WINNT':
         return True
 
 
 set_define('_WINDOWS', target_is_windows)
 set_define('WIN32', target_is_windows)
 set_define('XP_WIN', target_is_windows)
-set_define('XP_WIN32', target_is_windows)
 
 
 @depends(target)
 def target_is_unix(target):
     if target.kernel != 'WINNT':
         return True
 
 
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1660,17 +1660,17 @@ void ContentParent::ActorDestroy(ActorDe
 
   // Unregister all the BlobURLs registered by the ContentChild.
   for (uint32_t i = 0; i < mBlobURLs.Length(); ++i) {
     BlobURLProtocolHandler::RemoveDataEntry(mBlobURLs[i]);
   }
 
   mBlobURLs.Clear();
 
-#if defined(XP_WIN32) && defined(ACCESSIBILITY)
+#if defined(XP_WIN) && defined(ACCESSIBILITY)
   a11y::AccessibleWrap::ReleaseContentProcessIdFor(ChildID());
 #endif
 
   nsTHashtable<nsRefPtrHashKey<BrowsingContextGroup>> groups;
   mGroups.SwapElements(groups);
 
   for (auto iter = groups.Iter(); !iter.Done(); iter.Next()) {
     iter.Get()->GetKey()->Unsubscribe(this);
@@ -5192,28 +5192,28 @@ ContentParent::RecvUnstoreAndBroadcastBl
   BroadcastBlobURLUnregistration(aURI, this);
   mBlobURLs.RemoveElement(aURI);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult ContentParent::RecvGetA11yContentId(
     uint32_t* aContentId) {
-#if defined(XP_WIN32) && defined(ACCESSIBILITY)
+#if defined(XP_WIN) && defined(ACCESSIBILITY)
   *aContentId = a11y::AccessibleWrap::GetContentProcessIdFor(ChildID());
   MOZ_ASSERT(*aContentId);
   return IPC_OK();
 #else
   return IPC_FAIL_NO_REASON(this);
 #endif
 }
 
 mozilla::ipc::IPCResult ContentParent::RecvA11yHandlerControl(
     const uint32_t& aPid, const IHandlerControlHolder& aHandlerControl) {
-#if defined(XP_WIN32) && defined(ACCESSIBILITY)
+#if defined(XP_WIN) && defined(ACCESSIBILITY)
   MOZ_ASSERT(!aHandlerControl.IsNull());
   RefPtr<IHandlerControl> proxy(aHandlerControl.Get());
   a11y::AccessibleWrap::SetHandlerControl(aPid, std::move(proxy));
   return IPC_OK();
 #else
   return IPC_FAIL_NO_REASON(this);
 #endif
 }
--- a/gfx/src/nsCoord.h
+++ b/gfx/src/nsCoord.h
@@ -67,31 +67,31 @@ inline nscoord NSCoordMulDiv(nscoord aMu
 #ifdef NS_COORD_IS_FLOAT
   return (aMult1 * aMult2 / aDiv);
 #else
   return (int64_t(aMult1) * int64_t(aMult2) / int64_t(aDiv));
 #endif
 }
 
 inline nscoord NSToCoordRound(float aValue) {
-#if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__) && \
+#if defined(XP_WIN) && defined(_M_IX86) && !defined(__GNUC__) && \
     !defined(__clang__)
   return NS_lroundup30(aValue);
 #else
   return nscoord(floorf(aValue + 0.5f));
-#endif /* XP_WIN32 && _M_IX86 && !__GNUC__ */
+#endif /* XP_WIN && _M_IX86 && !__GNUC__ */
 }
 
 inline nscoord NSToCoordRound(double aValue) {
-#if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__) && \
+#if defined(XP_WIN) && defined(_M_IX86) && !defined(__GNUC__) && \
     !defined(__clang__)
   return NS_lroundup30((float)aValue);
 #else
   return nscoord(floor(aValue + 0.5f));
-#endif /* XP_WIN32 && _M_IX86 && !__GNUC__ */
+#endif /* XP_WIN && _M_IX86 && !__GNUC__ */
 }
 
 inline nscoord NSToCoordRoundWithClamp(float aValue) {
 #ifndef NS_COORD_IS_FLOAT
   // Bounds-check before converting out of float, to avoid overflow
   if (aValue >= nscoord_MAX) {
     return nscoord_MAX;
   }
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -407,17 +407,17 @@ dnl System overrides of the defaults for
 dnl ========================================================
 case "$host" in
 *mingw*)
     if test -n "$_WIN32_MSVC"; then
         HOST_CFLAGS="$HOST_CFLAGS -nologo"
     else
         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
     fi
-    HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
+    HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
     HOST_BIN_SUFFIX=.exe
 
     case "${host_cpu}" in
     i*86)
         if test -n "$_WIN32_MSVC"; then
             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
         fi
--- a/js/src/vm/Printer.cpp
+++ b/js/src/vm/Printer.cpp
@@ -429,17 +429,17 @@ void Fprinter::finish() {
 
 bool Fprinter::put(const char* s, size_t len) {
   MOZ_ASSERT(file_);
   int i = fwrite(s, /*size=*/1, /*nitems=*/len, file_);
   if (size_t(i) != len) {
     reportOutOfMemory();
     return false;
   }
-#ifdef XP_WIN32
+#ifdef XP_WIN
   if ((file_ == stderr) && (IsDebuggerPresent())) {
     UniqueChars buf = DuplicateString(s, len);
     if (!buf) {
       reportOutOfMemory();
       return false;
     }
     OutputDebugStringA(buf.get());
   }
--- a/old-configure.in
+++ b/old-configure.in
@@ -500,17 +500,17 @@ dnl System overrides of the defaults for
 dnl ========================================================
 case "$host" in
 *mingw*)
     if test -n "$_WIN32_MSVC"; then
         HOST_CFLAGS="$HOST_CFLAGS -nologo"
     else
         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
     fi
-    HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
+    HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
     HOST_BIN_SUFFIX=.exe
 
     case "${host_cpu}" in
     i*86)
         if test -n "$_WIN32_MSVC"; then
             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
         fi
--- a/security/moz.build
+++ b/security/moz.build
@@ -127,21 +127,23 @@ sandbox_vars = {
         'WARNINGS_AS_ERRORS': [],
     },
     # NSS' build system doesn't currently build NSS with PGO.
     # We could probably do so, but not without a lot of
     # careful consideration.
     'NO_PGO': True,
 }
 if CONFIG['OS_TARGET'] == 'WINNT':
+    # We want to remove XP_WIN32 eventually. See bug 1535219 for details.
+    sandbox_vars['CFLAGS'] = ['-DXP_WIN32']
     if CONFIG['CPU_ARCH'] == 'x86':
         # This should really be the default.
         sandbox_vars['ASFLAGS'] = ['-safeseh']
     if CONFIG['MOZ_FOLD_LIBS_FLAGS']:
-        sandbox_vars['CFLAGS'] = CONFIG['MOZ_FOLD_LIBS_FLAGS']
+        sandbox_vars['CFLAGS'] += CONFIG['MOZ_FOLD_LIBS_FLAGS']
 if CONFIG['OS_TARGET'] == 'Android':
     sandbox_vars['CFLAGS'] = [
         '-include', TOPSRCDIR + '/security/manager/android_stub.h',
         # Setting sandbox_vars['DEFINES'] is broken currently.
         '-DCHECK_FORK_GETPID',
     ]
     if CONFIG['ANDROID_VERSION']:
         sandbox_vars['CFLAGS'] += ['-DANDROID_VERSION=' + CONFIG['ANDROID_VERSION']]
--- a/toolkit/components/commandlines/nsCommandLine.cpp
+++ b/toolkit/components/commandlines/nsCommandLine.cpp
@@ -249,17 +249,17 @@ nsCommandLine::ResolveFile(const nsAStri
   if (NS_FAILED(rv)) return rv;
 
   rv = lf->Normalize();
   if (NS_FAILED(rv)) return rv;
 
   lf.forget(aResult);
   return NS_OK;
 
-#elif defined(XP_WIN32)
+#elif defined(XP_WIN)
   nsCOMPtr<nsIFile> lf(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
   NS_ENSURE_TRUE(lf, NS_ERROR_OUT_OF_MEMORY);
 
   rv = lf->InitWithPath(aArgument);
   if (NS_FAILED(rv)) {
     // If it's a relative path, the Init is *going* to fail. We use string magic
     // and win32 _fullpath. Note that paths of the form "\Relative\To\CurDrive"
     // are going to fail, and I haven't figured out a way to work around this
--- a/toolkit/crashreporter/client/crashreporter.h
+++ b/toolkit/crashreporter/client/crashreporter.h
@@ -16,17 +16,17 @@
 #include <vector>
 #include <stdlib.h>
 #include <stdio.h>
 #include <iostream>
 #include <fstream>
 
 #define MAX_COMMENT_LENGTH 500
 
-#if defined(XP_WIN32)
+#if defined(XP_WIN)
 
 #  include <windows.h>
 
 #  define UI_SNPRINTF _snprintf
 #  define UI_DIR_SEPARATOR "\\"
 
 std::string WideToUTF8(const std::wstring& wide, bool* success = 0);
 
--- a/toolkit/crashreporter/minidump-analyzer/minidump-analyzer.cpp
+++ b/toolkit/crashreporter/minidump-analyzer/minidump-analyzer.cpp
@@ -19,17 +19,17 @@
 #include "google_breakpad/processor/minidump_processor.h"
 #include "google_breakpad/processor/process_state.h"
 #include "google_breakpad/processor/stack_frame.h"
 #include "processor/pathname_stripper.h"
 
 #include "mozilla/FStream.h"
 #include "mozilla/Unused.h"
 
-#if defined(XP_WIN32)
+#if defined(XP_WIN)
 
 #  include <windows.h>
 #  include "mozilla/glue/WindowsDllServices.h"
 
 #elif defined(XP_UNIX) || defined(XP_MACOSX)
 
 #  include <sys/types.h>
 #  include <sys/stat.h>
--- a/toolkit/crashreporter/nsDummyExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsDummyExceptionHandler.cpp
@@ -96,17 +96,17 @@ nsresult SetRestartArgs(int argc, char**
 int GetAnnotationTimeCrashFd() { return 7; }
 #endif
 
 void RegisterChildCrashAnnotationFileDescriptor(ProcessId aProcess,
                                                 PRFileDesc* aFd) {}
 
 void DeregisterChildCrashAnnotationFileDescriptor(ProcessId aProcess) {}
 
-#ifdef XP_WIN32
+#ifdef XP_WIN
 nsresult WriteMinidumpForException(EXCEPTION_POINTERS* aExceptionInfo) {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 #endif
 
 #ifdef XP_LINUX
 bool WriteMinidumpForSigInfo(int signo, siginfo_t* info, void* uc) {
   return false;
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -25,17 +25,17 @@
 #include "mozilla/ipc/CrashReporterClient.h"
 
 #include "nsThreadUtils.h"
 #include "nsXULAppAPI.h"
 #include "jsfriendapi.h"
 #include "ThreadAnnotation.h"
 #include "private/pprio.h"
 
-#if defined(XP_WIN32)
+#if defined(XP_WIN)
 #  ifdef WIN32_LEAN_AND_MEAN
 #    undef WIN32_LEAN_AND_MEAN
 #  endif
 
 #  include "nsXULAppAPI.h"
 #  include "nsIXULAppInfo.h"
 #  include "nsIWindowsRegKey.h"
 #  include "breakpad-client/windows/crash_generation/client_info.h"
@@ -70,17 +70,17 @@
 #  include "breakpad-client/linux/handler/exception_handler.h"
 #  include "common/linux/eintr_wrapper.h"
 #  include <fcntl.h>
 #  include <sys/types.h>
 #  include <sys/wait.h>
 #  include <unistd.h>
 #else
 #  error "Not yet implemented for this platform"
-#endif  // defined(XP_WIN32)
+#endif  // defined(XP_WIN)
 
 #ifdef MOZ_CRASHREPORTER_INJECTOR
 #  include "InjectCrashReporter.h"
 using mozilla::InjectCrashRunnable;
 #endif
 
 #include <stdlib.h>
 #include <time.h>
@@ -116,17 +116,17 @@ using google_breakpad::FileID;
 using google_breakpad::kDefaultBuildIdSize;
 using google_breakpad::PageAllocator;
 #endif
 using namespace mozilla;
 using mozilla::ipc::CrashReporterClient;
 
 namespace CrashReporter {
 
-#ifdef XP_WIN32
+#ifdef XP_WIN
 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 MINIDUMP_ANALYZER_FILENAME "minidump-analyzer.exe"
@@ -165,17 +165,17 @@ typedef std::string xpstring;
 #    define XP_STOA(size, buffer, base) sprintf(buffer, "%zu", (size_t)size)
 #    define my_strlen strlen
 #    define sys_close close
 #    define sys_fork fork
 #    define sys_open open
 #    define sys_read read
 #    define sys_write write
 #  endif
-#endif  // XP_WIN32
+#endif  // XP_WIN
 
 #if defined(__GNUC__)
 #  define MAYBE_UNUSED __attribute__((unused))
 #else
 #  define MAYBE_UNUSED
 #endif  // defined(__GNUC__)
 
 #ifndef XP_LINUX
@@ -854,17 +854,17 @@ void WriteEscapedMozCrashReason(Platform
 // handler from invoking it. See bug 1424304.
 bool MinidumpCallback(
 #ifdef XP_LINUX
     const MinidumpDescriptor& descriptor,
 #else
     const XP_CHAR* dump_path, const XP_CHAR* minidump_id,
 #endif
     void* context,
-#ifdef XP_WIN32
+#ifdef XP_WIN
     EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion,
 #endif
     bool succeeded) {
   bool returnValue = showOSCrashReporter ? false : succeeded;
 
   static XP_CHAR minidumpPath[XP_PATH_MAX];
   size_t size = XP_PATH_MAX;
   XP_CHAR* p;
@@ -1103,17 +1103,17 @@ static size_t EnsureTrailingSlash(XP_CHA
     aBuf[len] = XP_PATH_SEPARATOR_CHAR;
     ++len;
     aBuf[len] = 0;
   }
   return len;
 }
 #endif
 
-#if defined(XP_WIN32)
+#if defined(XP_WIN)
 
 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;
   }
 
@@ -1440,25 +1440,25 @@ nsresult SetExceptionHandler(nsIFile* aX
 
   nsAutoString libraryPath_temp;
   rv = libPath->GetPath(libraryPath_temp);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 #  endif  // XP_MACOSX
 
-#  ifdef XP_WIN32
+#  ifdef XP_WIN
   crashReporterPath =
       reinterpret_cast<wchar_t*>(ToNewUnicode(crashReporterPath_temp));
 #  else
   crashReporterPath = ToNewCString(crashReporterPath_temp);
 #    ifdef XP_MACOSX
   libraryPath = ToNewCString(libraryPath_temp);
 #    endif
-#  endif  // XP_WIN32
+#  endif  // XP_WIN
 #else
   // On Android, we launch a service defined via MOZ_ANDROID_CRASH_HANDLER
   const char* androidCrashHandler = PR_GetEnv("MOZ_ANDROID_CRASH_HANDLER");
   if (androidCrashHandler) {
     crashReporterPath = strdup(androidCrashHandler);
   } else {
     NS_WARNING("No Android crash handler set");
   }
@@ -1471,32 +1471,32 @@ nsresult SetExceptionHandler(nsIFile* aX
       androidStartServiceCommand = (char*)"start-foreground-service";
     } else {
       androidStartServiceCommand = (char*)"startservice";
     }
   }
 #endif  // !defined(MOZ_WIDGET_ANDROID)
 
   // get temp path to use for minidump path
-#if defined(XP_WIN32)
+#if defined(XP_WIN)
   nsString tempPath;
 #else
   nsCString tempPath;
 #endif
   if (!BuildTempPath(tempPath)) {
     return NS_ERROR_FAILURE;
   }
 
-#ifdef XP_WIN32
+#ifdef XP_WIN
   ReserveBreakpadVM();
 
   // Pre-load psapi.dll to prevent it from being loaded during exception
   // handling.
   ::LoadLibraryW(L"psapi.dll");
-#endif  // XP_WIN32
+#endif  // XP_WIN
 
 #ifdef MOZ_WIDGET_ANDROID
   androidUserSerial = getenv("MOZ_ANDROID_USER_SERIAL_NUMBER");
 #endif
 
   // Initialize the flag and mutex used to avoid dump processing
   // once browser termination has begun.
   NS_ASSERTION(!dumpSafetyLock, "Shouldn't have a lock yet");
@@ -1525,31 +1525,31 @@ nsresult SetExceptionHandler(nsIFile* aX
 #endif
 
 #ifdef XP_WIN
       FPEFilter,
 #else
       Filter,
 #endif
       MinidumpCallback, nullptr,
-#ifdef XP_WIN32
+#ifdef XP_WIN
       google_breakpad::ExceptionHandler::HANDLER_ALL, GetMinidumpType(),
       (const wchar_t*)nullptr, nullptr);
 #else
       true
 #  ifdef XP_MACOSX
       ,
       nullptr
 #  endif
 #  ifdef XP_LINUX
       ,
       -1
 #  endif
   );
-#endif  // XP_WIN32
+#endif  // XP_WIN
 
   if (!gExceptionHandler) return NS_ERROR_OUT_OF_MEMORY;
 
 #ifdef XP_WIN
   gExceptionHandler->set_handle_debug_exceptions(true);
 
   // Initially set sIncludeContextHeap to true for debugging startup crashes
   // even if the controlling pref value is false.
@@ -1616,17 +1616,17 @@ bool GetMinidumpPath(nsAString& aPath) {
       gExceptionHandler->minidump_descriptor().directory().c_str());
 #endif
   return true;
 }
 
 nsresult SetMinidumpPath(const nsAString& aPath) {
   if (!gExceptionHandler) return NS_ERROR_NOT_INITIALIZED;
 
-#ifdef XP_WIN32
+#ifdef XP_WIN
   gExceptionHandler->set_dump_path(
       std::wstring(char16ptr_t(aPath.BeginReading())));
 #elif defined(XP_LINUX)
   gExceptionHandler->set_minidump_descriptor(
       MinidumpDescriptor(NS_ConvertUTF16toUTF8(aPath).BeginReading()));
 #else
   gExceptionHandler->set_dump_path(NS_ConvertUTF16toUTF8(aPath).BeginReading());
 #endif
@@ -1743,17 +1743,17 @@ static nsresult SetupCrashReporterDirect
 
   EnsureDirectoryExists(directory);
   xpstring* directoryPath = CreatePathFromFile(directory);
 
   if (!directoryPath) {
     return NS_ERROR_FAILURE;
   }
 
-#if defined(XP_WIN32)
+#if defined(XP_WIN)
   SetEnvironmentVariableW(aEnvVarName, directoryPath->c_str());
 #else
   setenv(aEnvVarName, directoryPath->c_str(), /* overwrite */ 1);
 #endif
 
   delete directoryPath;
 
   if (aDirectory) {
@@ -1807,17 +1807,17 @@ nsresult SetupExtraData(nsIFile* aAppDat
   nsCOMPtr<nsIFile> lastCrashFile;
   rv = dataDirectory->Clone(getter_AddRefs(lastCrashFile));
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = lastCrashFile->AppendNative(NS_LITERAL_CSTRING("LastCrash"));
   NS_ENSURE_SUCCESS(rv, rv);
   memset(lastCrashTimeFilename, 0, sizeof(lastCrashTimeFilename));
 
-#if defined(XP_WIN32)
+#if defined(XP_WIN)
   nsAutoString filename;
   rv = lastCrashFile->GetPath(filename);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (filename.Length() < XP_PATH_MAX)
     wcsncpy(lastCrashTimeFilename, filename.get(), filename.Length());
 #else
   nsAutoCString filename;
@@ -2115,28 +2115,28 @@ static bool GetAnnotation(CrashReporter:
 
   data = entry;
   return true;
 }
 
 nsresult RegisterAppMemory(void* ptr, size_t length) {
   if (!GetEnabled()) return NS_ERROR_NOT_INITIALIZED;
 
-#if defined(XP_LINUX) || defined(XP_WIN32)
+#if defined(XP_LINUX) || defined(XP_WIN)
   gExceptionHandler->RegisterAppMemory(ptr, length);
   return NS_OK;
 #else
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif
 }
 
 nsresult UnregisterAppMemory(void* ptr) {
   if (!GetEnabled()) return NS_ERROR_NOT_INITIALIZED;
 
-#if defined(XP_LINUX) || defined(XP_WIN32)
+#if defined(XP_LINUX) || defined(XP_WIN)
   gExceptionHandler->UnregisterAppMemory(ptr);
   return NS_OK;
 #else
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif
 }
 
 void SetIncludeContextHeap(bool aValue) {
@@ -2206,17 +2206,17 @@ nsresult SetRestartArgs(int argc, char**
     envVar += appfile;
     env = ToNewCString(envVar);
     PR_SetEnv(env);
   }
 
   return NS_OK;
 }
 
-#ifdef XP_WIN32
+#ifdef XP_WIN
 nsresult WriteMinidumpForException(EXCEPTION_POINTERS* aExceptionInfo) {
   if (!gExceptionHandler) return NS_ERROR_NOT_INITIALIZED;
 
   return gExceptionHandler->WriteMinidumpForException(aExceptionInfo)
              ? NS_OK
              : NS_ERROR_FAILURE;
 }
 #endif
@@ -2241,17 +2241,17 @@ nsresult AppendObjCExceptionInfoToAppNot
 #endif
 
 /*
  * Combined code to get/set the crash reporter submission pref on
  * different platforms.
  */
 static nsresult PrefSubmitReports(bool* aSubmitReports, bool writePref) {
   nsresult rv;
-#if defined(XP_WIN32)
+#if defined(XP_WIN)
   /*
    * NOTE! This needs to stay in sync with the preference checking code
    *       in toolkit/crashreporter/client/crashreporter_win.cpp
    */
   nsCOMPtr<nsIXULAppInfo> appinfo =
       do_GetService("@mozilla.org/xre/app-info;1", &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -3369,17 +3369,17 @@ void RenameAdditionalHangMinidump(nsIFil
 
 static bool PairedDumpCallback(
 #ifdef XP_LINUX
     const MinidumpDescriptor& descriptor,
 #else
     const XP_CHAR* dump_path, const XP_CHAR* minidump_id,
 #endif
     void* context,
-#ifdef XP_WIN32
+#ifdef XP_WIN
     EXCEPTION_POINTERS* /*unused*/, MDRawAssertionInfo* /*unused*/,
 #endif
     bool succeeded) {
   nsCOMPtr<nsIFile>& minidump = *static_cast<nsCOMPtr<nsIFile>*>(context);
 
   xpstring dump;
 #ifdef XP_LINUX
   dump = descriptor.path();
@@ -3396,28 +3396,28 @@ static bool PairedDumpCallback(
 
 static bool PairedDumpCallbackExtra(
 #ifdef XP_LINUX
     const MinidumpDescriptor& descriptor,
 #else
     const XP_CHAR* dump_path, const XP_CHAR* minidump_id,
 #endif
     void* context,
-#ifdef XP_WIN32
+#ifdef XP_WIN
     EXCEPTION_POINTERS* /*unused*/, MDRawAssertionInfo* /*unused*/,
 #endif
     bool succeeded) {
   PairedDumpCallback(
 #ifdef XP_LINUX
       descriptor,
 #else
       dump_path, minidump_id,
 #endif
       context,
-#ifdef XP_WIN32
+#ifdef XP_WIN
       nullptr, nullptr,
 #endif
       succeeded);
 
   nsCOMPtr<nsIFile>& minidump = *static_cast<nsCOMPtr<nsIFile>*>(context);
 
   nsCOMPtr<nsIFile> extra;
   return WriteExtraForMinidump(minidump, 0, /* content */ false,
@@ -3481,17 +3481,17 @@ bool TakeMinidump(nsIFile** aResult, boo
 
   // capture the dump
   if (!google_breakpad::ExceptionHandler::WriteMinidump(
           dump_path,
 #ifdef XP_MACOSX
           true,
 #endif
           PairedDumpCallback, static_cast<void*>(aResult)
-#ifdef XP_WIN32
+#ifdef XP_WIN
                                   ,
           GetMinidumpType()
 #endif
               )) {
     return false;
   }
 
   if (aMoveToPending) {
@@ -3524,17 +3524,17 @@ bool CreateMinidumpsAndPair(ProcessHandl
   dump_path = gExceptionHandler->minidump_descriptor().directory();
 #endif
 
   // dump the target
   nsCOMPtr<nsIFile> targetMinidump;
   if (!google_breakpad::ExceptionHandler::WriteMinidumpForChild(
           aTargetPid, targetThread, dump_path, PairedDumpCallbackExtra,
           static_cast<void*>(&targetMinidump)
-#ifdef XP_WIN32
+#ifdef XP_WIN
               ,
           GetMinidumpType()
 #endif
               )) {
     return false;
   }
 
   nsCOMPtr<nsIFile> targetExtra;
@@ -3544,17 +3544,17 @@ bool CreateMinidumpsAndPair(ProcessHandl
   nsCOMPtr<nsIFile> incomingDump;
   if (aIncomingDumpToPair == nullptr) {
     if (!google_breakpad::ExceptionHandler::WriteMinidump(
             dump_path,
 #ifdef XP_MACOSX
             true,
 #endif
             PairedDumpCallback, static_cast<void*>(&incomingDump)
-#ifdef XP_WIN32
+#ifdef XP_WIN
                                     ,
             GetMinidumpType()
 #endif
                 )) {
       targetMinidump->Remove(false);
       targetExtra->Remove(false);
       return false;
     }
@@ -3596,17 +3596,17 @@ bool CreateAdditionalChildMinidump(Proce
   dump_path = gExceptionHandler->minidump_descriptor().directory();
 #endif
 
   // dump the child
   nsCOMPtr<nsIFile> childMinidump;
   if (!google_breakpad::ExceptionHandler::WriteMinidumpForChild(
           childPid, childThread, dump_path, PairedDumpCallback,
           static_cast<void*>(&childMinidump)
-#ifdef XP_WIN32
+#ifdef XP_WIN
               ,
           GetMinidumpType()
 #endif
               )) {
     return false;
   }
 
   RenameAdditionalHangMinidump(childMinidump, parentMinidump, name);
--- a/toolkit/crashreporter/nsExceptionHandler.h
+++ b/toolkit/crashreporter/nsExceptionHandler.h
@@ -18,17 +18,17 @@
 #include "CrashAnnotations.h"
 
 #include <stddef.h>
 #include <stdint.h>
 #include "nsError.h"
 #include "nsString.h"
 #include "prio.h"
 
-#if defined(XP_WIN32)
+#if defined(XP_WIN)
 #  ifdef WIN32_LEAN_AND_MEAN
 #    undef WIN32_LEAN_AND_MEAN
 #  endif
 #  include <windows.h>
 #endif
 
 #if defined(XP_MACOSX)
 #  include <mach/mach.h>
@@ -137,17 +137,17 @@ bool AppendExtraData(nsIFile* extraFile,
  * @param aDumpFile - the dump file to associate with aOwnerDumpFile.
  * @param aOwnerDumpFile - the new owner of aDumpFile.
  * @param aDumpFileProcessType - process name associated with aDumpFile.
  */
 void RenameAdditionalHangMinidump(nsIFile* aDumpFile,
                                   const nsIFile* aOwnerDumpFile,
                                   const nsACString& aDumpFileProcessType);
 
-#ifdef XP_WIN32
+#ifdef XP_WIN
 nsresult WriteMinidumpForException(EXCEPTION_POINTERS* aExceptionInfo);
 #endif
 #ifdef XP_LINUX
 bool WriteMinidumpForSigInfo(int signo, siginfo_t* info, void* uc);
 #endif
 #ifdef XP_MACOSX
 nsresult AppendObjCExceptionInfoToAppNotes(void* inException);
 #endif
@@ -242,17 +242,17 @@ bool CreateMinidumpsAndPair(ProcessHandl
 // a minidump (|parentMinidump|).
 // The resulting dump will get the id of the parent and use the |name| as
 // an extension.
 bool CreateAdditionalChildMinidump(ProcessHandle childPid,
                                    ThreadId childBlamedThread,
                                    nsIFile* parentMinidump,
                                    const nsACString& name);
 
-#if defined(XP_WIN32) || defined(XP_MACOSX)
+#if defined(XP_WIN) || defined(XP_MACOSX)
 // Parent-side API for children
 const char* GetChildNotificationPipe();
 
 #  ifdef MOZ_CRASHREPORTER_INJECTOR
 // Inject a crash report client into an arbitrary process, and inform the
 // callback object when it crashes. Parent process only.
 
 class InjectorCrashCallback {
@@ -270,17 +270,17 @@ class InjectorCrashCallback {
 };
 
 // This method implies OOPInit
 void InjectCrashReporterIntoProcess(DWORD processID, InjectorCrashCallback* cb);
 void UnregisterInjectorCallback(DWORD processID);
 #  endif
 
 // Child-side API
-#  if defined(XP_WIN32)
+#  if defined(XP_WIN)
 bool SetRemoteExceptionHandler(const nsACString& crashPipe,
                                uintptr_t aCrashTimeAnnotationFile);
 #  else
 bool SetRemoteExceptionHandler(const nsACString& crashPipe);
 #  endif
 
 #else
 // Parent-side API for children
@@ -293,17 +293,17 @@ bool SetRemoteExceptionHandler(const nsA
 //
 // If crash reporting is disabled, both outparams will be set to -1
 // and |true| will be returned.
 bool CreateNotificationPipeForChild(int* childCrashFd, int* childCrashRemapFd);
 
 // Child-side API
 bool SetRemoteExceptionHandler();
 
-#endif  // XP_WIN32
+#endif  // XP_WIN
 
 bool UnsetRemoteExceptionHandler();
 
 #if defined(MOZ_WIDGET_ANDROID)
 // Android creates child process as services so we must explicitly set
 // the handle for the pipe since it can't get remapped to a default value.
 void SetNotificationPipeForChild(int childCrashFd);
 void SetCrashAnnotationPipeForChild(int childCrashAnnotationFd);
--- a/toolkit/crashreporter/test/nsTestCrasher.cpp
+++ b/toolkit/crashreporter/test/nsTestCrasher.cpp
@@ -183,17 +183,17 @@ extern "C" NS_EXPORT uint64_t SaveAppMem
   FILE* fp = fopen("crash-addr", "w");
   if (!fp) return 0;
   fprintf(fp, "%p\n", (void*)testData);
   fclose(fp);
 
   return (int64_t)testData;
 }
 
-#ifdef XP_WIN32
+#ifdef XP_WIN
 static LONG WINAPI HandleException(EXCEPTION_POINTERS* exinfo) {
   TerminateProcess(GetCurrentProcess(), 0);
   return 0;
 }
 
 extern "C" NS_EXPORT void TryOverrideExceptionHandler() {
   SetUnhandledExceptionFilter(HandleException);
 }
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -186,17 +186,17 @@
 #  include "nsCommandLineServiceMac.h"
 #endif
 
 // for X remote support
 #if defined(MOZ_HAS_REMOTE)
 #  include "nsRemoteService.h"
 #endif
 
-#if defined(DEBUG) && defined(XP_WIN32)
+#if defined(DEBUG) && defined(XP_WIN)
 #  include <malloc.h>
 #endif
 
 #if defined(XP_MACOSX)
 #  include <Carbon/Carbon.h>
 #endif
 
 #ifdef DEBUG
@@ -1095,17 +1095,17 @@ nsXULAppInfo::AppendAppNotesToCrashRepor
 
 NS_IMETHODIMP
 nsXULAppInfo::RegisterAppMemory(uint64_t pointer, uint64_t len) {
   return CrashReporter::RegisterAppMemory((void*)pointer, len);
 }
 
 NS_IMETHODIMP
 nsXULAppInfo::WriteMinidumpForException(void* aExceptionInfo) {
-#ifdef XP_WIN32
+#ifdef XP_WIN
   return CrashReporter::WriteMinidumpForException(
       static_cast<EXCEPTION_POINTERS*>(aExceptionInfo));
 #else
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif
 }
 
 NS_IMETHODIMP
@@ -5035,17 +5035,17 @@ void SetupErrorHandling(const char* prog
   */
 
   HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
   SetProcessDEPPolicyFunc _SetProcessDEPPolicy =
       (SetProcessDEPPolicyFunc)GetProcAddress(kernel32, "SetProcessDEPPolicy");
   if (_SetProcessDEPPolicy) _SetProcessDEPPolicy(PROCESS_DEP_ENABLE);
 #endif
 
-#ifdef XP_WIN32
+#ifdef XP_WIN
   // Suppress the "DLL Foo could not be found" dialog, such that if dependent
   // libraries (such as GDI+) are not preset, we gracefully fail to load those
   // XPCOM components, instead of being ungraceful.
   UINT realMode = SetErrorMode(0);
   realMode |= SEM_FAILCRITICALERRORS;
   // If XRE_NO_WINDOWS_CRASH_DIALOG is set, suppress displaying the "This
   // application has crashed" dialog box.  This is mainly useful for
   // automated testing environments, e.g. tinderbox, where there's no need
--- a/xpcom/build/PoisonIOInterposerBase.cpp
+++ b/xpcom/build/PoisonIOInterposerBase.cpp
@@ -14,22 +14,22 @@
 
 #include "prlock.h"
 
 #ifdef MOZ_REPLACE_MALLOC
 #  include "replace_malloc_bridge.h"
 #endif
 
 // Auxiliary method to convert file descriptors to ids
-#if defined(XP_WIN32)
+#if defined(XP_WIN)
 #  include <io.h>
 inline intptr_t FileDescriptorToHandle(int aFd) { return _get_osfhandle(aFd); }
 #else
 inline intptr_t FileDescriptorToHandle(int aFd) { return aFd; }
-#endif /* if not XP_WIN32 */
+#endif /* if not XP_WIN */
 
 using namespace mozilla;
 
 namespace {
 
 struct DebugFilesAutoLockTraits {
   typedef PRLock* type;
   typedef const PRLock* const_type;
--- a/xpcom/build/nsXPCOMPrivate.h
+++ b/xpcom/build/nsXPCOMPrivate.h
@@ -47,17 +47,17 @@ void LogTerm();
  *
  * XPCOM_DLL              - name of the loadable xpcom library on disk.
  * XUL_DLL                - name of the loadable XUL library on disk
  * XPCOM_SEARCH_KEY       - name of the environment variable that can be
  *                          modified to include additional search paths.
  * GRE_CONF_NAME          - Name of the GRE Configuration file
  */
 
-#if defined(XP_WIN32)
+#if defined(XP_WIN)
 
 #  define XPCOM_SEARCH_KEY "PATH"
 #  define GRE_CONF_NAME "gre.config"
 #  define GRE_WIN_REG_LOC L"Software\\mozilla.org\\GRE"
 #  define XPCOM_DLL XUL_DLL
 #  define LXPCOM_DLL LXUL_DLL
 #  define XUL_DLL "xul.dll"
 #  define LXUL_DLL L"xul.dll"
--- a/xpcom/ds/nsMathUtils.h
+++ b/xpcom/ds/nsMathUtils.h
@@ -26,17 +26,17 @@ inline float NS_roundf(float aNum) {
 }
 inline int32_t NS_lround(double aNum) {
   return aNum >= 0.0 ? int32_t(aNum + 0.5) : int32_t(aNum - 0.5);
 }
 
 /* NS_roundup30 rounds towards infinity for positive and       */
 /* negative numbers.                                           */
 
-#if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__) && \
+#if defined(XP_WIN) && defined(_M_IX86) && !defined(__GNUC__) && \
     !defined(__clang__)
 inline int32_t NS_lroundup30(float x) {
   /* Code derived from Laurent de Soras' paper at             */
   /* http://ldesoras.free.fr/doc/articles/rounding_en.pdf     */
 
   /* Rounding up on Windows is expensive using the float to   */
   /* int conversion and the floor function. A faster          */
   /* approach is to use f87 rounding while assuming the       */
@@ -57,17 +57,17 @@ inline int32_t NS_lroundup30(float x) {
   __asm {
     fld     x                   ; load fp argument
     fadd    st, st(0)           ; double it
     fadd    round_to_nearest    ; add the rounding factor
     fistp   dword ptr i         ; convert the result to int
   }
   return i >> 1; /* divide by 2 */
 }
-#endif /* XP_WIN32 && _M_IX86 && !__GNUC__ */
+#endif /* XP_WIN && _M_IX86 && !__GNUC__ */
 
 inline int32_t NS_lroundf(float aNum) {
   return aNum >= 0.0f ? int32_t(aNum + 0.5f) : int32_t(aNum - 0.5f);
 }
 
 /*
  * hypot.  We don't need a super accurate version of this, if a platform
  * turns up with none of the possibilities below it would be okay to fall