Backed out 5 changesets (bug 806819) for WinXP test failures on a CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Mon, 06 Oct 2014 16:32:50 -0700
changeset 209090 b92b206a27605a332c3e09dd17370186f6af7ac3
parent 209089 bb3b6a3a021c88daef318ea94fcb0875b023ac3a
child 209091 f65726bd726555bd7cab954c3347931f4c9d4c00
push id27603
push usercbook@mozilla.com
push dateTue, 07 Oct 2014 12:34:22 +0000
treeherdermozilla-central@f65726bd7265 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs806819
milestone35.0a1
backs out009ae35b0c6752a7926ada4490fa38826cc65485
5a57f87f5061cde0e0207361a596d57bd330a3fc
f06cd735b5b3da53a517d763c179c5fe67a97377
e25a2a8d4af4a0c8f2d1c6cdf0eb48392d35ce68
70a167982c3fa283e32e7b1c78cf6c974cb70af8
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
Backed out 5 changesets (bug 806819) for WinXP test failures on a CLOSED TREE Backed out changeset 009ae35b0c67 (bug 806819) Backed out changeset 5a57f87f5061 (bug 806819) Backed out changeset f06cd735b5b3 (bug 806819) Backed out changeset e25a2a8d4af4 (bug 806819) Backed out changeset 70a167982c3f (bug 806819)
configure.in
content/base/src/moz.build
content/base/src/nsDOMDataChannel.cpp
content/base/src/nsDocument.cpp
content/base/src/nsNodeInfoManager.cpp
content/media/Latency.cpp
content/media/moz.build
content/media/webrtc/MediaEngineWebRTC.cpp
docshell/base/moz.build
docshell/base/nsDocShell.cpp
dom/base/moz.build
dom/base/nsGlobalWindow.cpp
dom/base/nsJSEnvironment.cpp
dom/ipc/moz.build
dom/plugins/base/moz.build
dom/plugins/base/nsPluginLogging.h
dom/plugins/ipc/moz.build
extensions/auth/moz.build
extensions/auth/nsAuth.h
extensions/pref/autoconfig/src/moz.build
extensions/pref/autoconfig/src/nsAutoConfig.cpp
extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
extensions/pref/autoconfig/src/nsReadConfig.cpp
gfx/thebes/gfxDWriteFontList.cpp
gfx/thebes/gfxFont.cpp
gfx/thebes/gfxFontEntry.cpp
gfx/thebes/gfxFontUtils.cpp
gfx/thebes/gfxGDIFontList.cpp
gfx/thebes/gfxMacPlatformFontList.mm
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatformFontList.cpp
gfx/thebes/gfxUserFontSet.cpp
gfx/thebes/moz.build
image/public/ImageLogging.h
js/xpconnect/loader/moz.build
js/xpconnect/loader/mozJSComponentLoader.cpp
layout/base/moz.build
layout/base/nsDocumentViewer.cpp
layout/base/nsPresShell.cpp
layout/printing/moz.build
layout/printing/nsPrintData.cpp
layout/printing/nsPrintEngine.cpp
layout/style/FontFaceSet.cpp
layout/style/Loader.cpp
layout/style/moz.build
layout/style/nsFontFaceLoader.cpp
media/mtransport/build/moz.build
media/mtransport/logging.h
media/mtransport/standalone/moz.build
media/webrtc/moz.build
media/webrtc/signaling/src/common/browser_logging/CSFLog.h
netwerk/base/src/moz.build
netwerk/base/src/nsAsyncRedirectVerifyHelper.cpp
netwerk/base/src/nsSocketTransport2.cpp
netwerk/base/src/nsSocketTransportService2.cpp
netwerk/cache/moz.build
netwerk/cache/nsCache.h
netwerk/cache2/CacheLog.h
netwerk/cookie/moz.build
netwerk/cookie/nsCookieService.cpp
netwerk/dns/GetAddrInfo.cpp
netwerk/dns/moz.build
netwerk/dns/nsHostResolver.cpp
netwerk/protocol/http/HttpLog.h
netwerk/protocol/http/moz.build
netwerk/protocol/rtsp/moz.build
netwerk/protocol/websocket/WebSocketLog.h
netwerk/protocol/wyciwyg/nsWyciwyg.h
netwerk/sctp/datachannel/DataChannelLog.h
netwerk/test/TestProtocols.cpp
python/mozbuild/mozbuild/backend/recursivemake.py
security/apps/AppSignatureVerification.cpp
security/apps/AppTrustDomain.cpp
security/apps/moz.build
security/manager/boot/src/moz.build
security/manager/boot/src/nsSecureBrowserUIImpl.cpp
security/manager/ssl/src/PSMContentListener.cpp
security/manager/ssl/src/nsCryptoHash.cpp
security/manager/ssl/src/nsNSSComponent.cpp
uriloader/base/nsURILoader.h
uriloader/exthandler/moz.build
uriloader/exthandler/nsExternalHelperAppService.cpp
uriloader/exthandler/nsExternalHelperAppService.h
uriloader/prefetch/moz.build
uriloader/prefetch/nsOfflineCacheUpdate.cpp
uriloader/prefetch/nsOfflineCacheUpdateService.cpp
widget/android/nsAppShell.cpp
widget/cocoa/TextInputHandler.mm
widget/cocoa/moz.build
widget/cocoa/nsChildView.mm
widget/cocoa/nsClipboard.mm
widget/cocoa/nsDragService.mm
widget/gtk/moz.build
widget/gtk/nsDeviceContextSpecG.cpp
widget/gtk/nsGtkIMModule.cpp
widget/gtk/nsWindow.h
widget/qt/nsAppShell.cpp
widget/qt/nsDeviceContextSpecQt.cpp
widget/qt/nsWindow.h
widget/windows/KeyboardLayout.cpp
widget/windows/WinMouseScrollHandler.cpp
widget/windows/WinUtils.cpp
widget/windows/moz.build
widget/windows/nsIMM32Handler.cpp
widget/windows/nsTextStore.cpp
xpcom/components/moz.build
xpcom/components/nsNativeModuleLoader.cpp
xpcom/threads/nsTimerImpl.h
--- a/configure.in
+++ b/configure.in
@@ -6906,17 +6906,16 @@ dnl ====================================
 MOZ_ARG_DISABLE_BOOL(logging,
 [  --disable-logging       Disable logging facilities],
     NS_DISABLE_LOGGING=1,
     NS_DISABLE_LOGGING= )
 if test "$NS_DISABLE_LOGGING"; then
     AC_DEFINE(NS_DISABLE_LOGGING)
 else
     AC_DEFINE(MOZ_LOGGING)
-    AC_DEFINE(FORCE_PR_LOG)
 fi
 
 dnl ========================================================
 dnl = This will enable logging of addref, release, ctor, dtor.
 dnl ========================================================
 _ENABLE_LOGREFCNT=42
 MOZ_ARG_ENABLE_BOOL(logrefcnt,
 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
--- a/content/base/src/moz.build
+++ b/content/base/src/moz.build
@@ -37,17 +37,17 @@ EXPORTS += [
     'nsTraversal.h',
 ]
 
 if CONFIG['MOZ_WEBRTC']:
     EXPORTS += [
         'nsDOMDataChannel.h',
         'nsDOMDataChannelDeclarations.h',
     ]
-    UNIFIED_SOURCES += [
+    SOURCES += [
         'nsDOMDataChannel.cpp',
     ]
     LOCAL_INCLUDES += [
         '/netwerk/sctp/datachannel',
     ]
 
 # Are we targeting x86-32 or x86-64?  If so, we want to include SSE2 code for
 # nsTextFragment.cpp
@@ -117,17 +117,16 @@ UNIFIED_SOURCES += [
     'nsContentSink.cpp',
     'nsCopySupport.cpp',
     'nsCrossSiteListenerProxy.cpp',
     'nsCSPContext.cpp',
     'nsCSPParser.cpp',
     'nsCSPService.cpp',
     'nsCSPUtils.cpp',
     'nsDataDocumentContentPolicy.cpp',
-    'nsDocument.cpp',
     'nsDocumentEncoder.cpp',
     'nsDOMAttributeMap.cpp',
     'nsDOMBlobBuilder.cpp',
     'nsDOMCaretPosition.cpp',
     'nsDOMFile.cpp',
     'nsDOMFileReader.cpp',
     'nsDOMMutationObserver.cpp',
     'nsDOMSerializer.cpp',
@@ -146,17 +145,16 @@ UNIFIED_SOURCES += [
     'nsINode.cpp',
     'nsInProcessTabChildGlobal.cpp',
     'nsLineBreaker.cpp',
     'nsMappedAttributeElement.cpp',
     'nsMappedAttributes.cpp',
     'nsMixedContentBlocker.cpp',
     'nsNameSpaceManager.cpp',
     'nsNoDataProtocolContentPolicy.cpp',
-    'nsNodeInfoManager.cpp',
     'nsNodeUtils.cpp',
     'nsPlainTextSerializer.cpp',
     'nsPropertyTable.cpp',
     'nsRange.cpp',
     'nsReferencedElement.cpp',
     'nsScriptElement.cpp',
     'nsScriptLoader.cpp',
     'nsStubDocumentObserver.cpp',
@@ -181,16 +179,22 @@ UNIFIED_SOURCES += [
     'TreeWalker.cpp',
     'WebSocket.cpp',
 ]
 
 SOURCES += [
     'nsImageLoadingContent.cpp',
 ]
 
+# These files cannot be built in unified mode because they use FORCE_PR_LOG
+SOURCES += [
+    'nsDocument.cpp',
+    'nsNodeInfoManager.cpp',
+]
+
 # These files cannot be built in unified mode because of OS X headers.
 SOURCES += [
     'nsContentUtils.cpp',
     'nsObjectLoadingContent.cpp',
 ]
 
 EXTRA_COMPONENTS += [
     'contentAreaDropListener.js',
--- a/content/base/src/nsDOMDataChannel.cpp
+++ b/content/base/src/nsDOMDataChannel.cpp
@@ -1,16 +1,20 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set sw=2 ts=8 et 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 "nsDOMDataChannel.h"
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
+
 #include "base/basictypes.h"
 #include "prlog.h"
 
 #ifdef PR_LOGGING
 extern PRLogModuleInfo* GetDataChannelLog();
 #endif
 #undef LOG
 #define LOG(args) PR_LOG(GetDataChannelLog(), PR_LOG_DEBUG, args)
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -13,16 +13,20 @@
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/AutoRestore.h"
 #include "mozilla/BinarySearch.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Likely.h"
 #include <algorithm>
 
+#ifdef MOZ_LOGGING
+// so we can get logging even in release builds
+#define FORCE_PR_LOG 1
+#endif
 #include "prlog.h"
 #include "plstr.h"
 #include "prprf.h"
 
 #include "mozilla/Telemetry.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsILoadContext.h"
--- a/content/base/src/nsNodeInfoManager.cpp
+++ b/content/base/src/nsNodeInfoManager.cpp
@@ -27,16 +27,20 @@
 #include "nsBindingManager.h"
 #include "nsHashKeys.h"
 #include "nsCCUncollectableMarker.h"
 #include "nsNameSpaceManager.h"
 
 using namespace mozilla;
 using mozilla::dom::NodeInfo;
 
+#ifdef MOZ_LOGGING
+// so we can get logging even in release builds
+#define FORCE_PR_LOG 1
+#endif
 #include "prlog.h"
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo* gNodeInfoManagerLeakPRLog;
 #endif
 
 PLHashNumber
 nsNodeInfoManager::GetNodeInfoInnerHashValue(const void *key)
--- a/content/media/Latency.cpp
+++ b/content/media/Latency.cpp
@@ -1,14 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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/. */
 
+// We want this available in opt builds
+#define FORCE_PR_LOG
+
 #include "Latency.h"
 #include "nsThreadUtils.h"
 #include "prlog.h"
 #include <cmath>
 #include <algorithm>
 
 #include <mozilla/Services.h>
 #include <mozilla/StaticPtr.h>
--- a/content/media/moz.build
+++ b/content/media/moz.build
@@ -135,17 +135,16 @@ UNIFIED_SOURCES += [
     'AudioStreamTrack.cpp',
     'AudioTrack.cpp',
     'AudioTrackList.cpp',
     'CubebUtils.cpp',
     'DOMMediaStream.cpp',
     'EncodedBufferCache.cpp',
     'FileBlockCache.cpp',
     "GraphDriver.cpp",
-    'Latency.cpp',
     'MediaCache.cpp',
     'MediaData.cpp',
     'MediaDecoder.cpp',
     'MediaDecoderReader.cpp',
     'MediaDecoderStateMachine.cpp',
     'MediaDecoderStateMachineScheduler.cpp',
     'MediaRecorder.cpp',
     'MediaResource.cpp',
@@ -173,18 +172,20 @@ UNIFIED_SOURCES += [
     'VideoUtils.cpp',
     'WebVTTListener.cpp',
 ]
 
 if CONFIG['OS_TARGET'] == 'WINNT':
   SOURCES += [ 'ThreadPoolCOMListener.cpp' ]
 
 # DecoderTraits.cpp needs to be built separately because of Mac OS X headers.
+# Latency.cpp needs to be built separately because it forces NSPR logging.
 SOURCES += [
     'DecoderTraits.cpp',
+    'Latency.cpp',
 ]
 
 FAIL_ON_WARNINGS = True
 
 MSVC_ENABLE_PGO = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
--- a/content/media/webrtc/MediaEngineWebRTC.cpp
+++ b/content/media/webrtc/MediaEngineWebRTC.cpp
@@ -1,12 +1,20 @@
 /* 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
+
+#if defined(PR_LOG)
+#error "This file must be #included before any IPDL-generated files or other files that #include prlog.h"
+#endif
+
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 
 #include "CSFLog.h"
 #include "prenv.h"
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo*
--- a/docshell/base/moz.build
+++ b/docshell/base/moz.build
@@ -48,27 +48,31 @@ EXPORTS.mozilla += [
     'LoadInfo.h',
 ]
 
 UNIFIED_SOURCES += [
     'LoadContext.cpp',
     'LoadInfo.cpp',
     'nsAboutRedirector.cpp',
     'nsDefaultURIFixup.cpp',
-    'nsDocShell.cpp',
     'nsDocShellEditorData.cpp',
     'nsDocShellEnumerator.cpp',
     'nsDocShellLoadInfo.cpp',
     'nsDocShellTransferableHooks.cpp',
     'nsDownloadHistory.cpp',
     'nsDSURIContentListener.cpp',
     'nsWebNavigationInfo.cpp',
     'SerializedLoadContext.cpp',
 ]
 
+# nsDocShell.cpp cannot be built in unified mode because it forces NSPR logging.
+SOURCES += [
+    'nsDocShell.cpp',
+]
+
 FAIL_ON_WARNINGS = True
 
 MSVC_ENABLE_PGO = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -21,16 +21,21 @@
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 #include "mozilla/StartupTimeline.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/unused.h"
 #include "mozilla/VisualEventTracer.h"
 #include "URIUtils.h"
 
+#ifdef MOZ_LOGGING
+// so we can get logging even in release builds (but only for some things)
+#define FORCE_PR_LOG 1
+#endif
+
 #include "nsIContent.h"
 #include "nsIContentInlines.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMStorage.h"
 #include "nsIContentViewer.h"
 #include "nsIDocumentLoaderFactory.h"
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -89,17 +89,16 @@ UNIFIED_SOURCES += [
     'nsDOMClassInfo.cpp',
     'nsDOMNavigationTiming.cpp',
     'nsDOMScriptObjectFactory.cpp',
     'nsDOMWindowList.cpp',
     'nsFocusManager.cpp',
     'nsGlobalWindowCommands.cpp',
     'nsHistory.cpp',
     'nsIGlobalObject.cpp',
-    'nsJSEnvironment.cpp',
     'nsJSTimeoutHandler.cpp',
     'nsJSUtils.cpp',
     'nsLocation.cpp',
     'nsMimeTypeArray.cpp',
     'nsPerformance.cpp',
     'nsQueryContentEventResult.cpp',
     'nsScreen.cpp',
     'nsScriptNameSpaceManager.cpp',
@@ -119,16 +118,18 @@ UNIFIED_SOURCES += [
 # these files couldn't be in UNIFIED_SOURCES for now for reasons given below:
 SOURCES += [
     # this file doesn't like windows.h
     'MessagePort.cpp',
     # this file doesn't like windows.h
     'nsDOMWindowUtils.cpp',
     # This file has a #error "Never include windows.h in this file!"
     'nsGlobalWindow.cpp',
+    # This file forces NSPR logging.
+    'nsJSEnvironment.cpp',
     # nsPluginArray.cpp includes npapi.h indirectly, and that includes a lot of system headers
     'nsPluginArray.cpp',
 ]
 
 EXTRA_COMPONENTS += [
     'ConsoleAPI.manifest',
     'ConsoleAPIStorage.js',
     'SiteSpecificUserAgent.js',
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -170,16 +170,20 @@
 
 #include "nsIDragService.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Selection.h"
 #include "nsFrameLoader.h"
 #include "nsISupportsPrimitives.h"
 #include "nsXPCOMCID.h"
 #include "mozIThirdPartyUtil.h"
+#ifdef MOZ_LOGGING
+// so we can get logging even in release builds
+#define FORCE_PR_LOG 1
+#endif
 #include "prlog.h"
 #include "prenv.h"
 #include "prprf.h"
 
 #include "mozilla/dom/MessageChannel.h"
 #include "mozilla/dom/MessagePort.h"
 #include "mozilla/dom/MessagePortBinding.h"
 #include "mozilla/dom/indexedDB/IDBFactory.h"
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -68,16 +68,20 @@
 #include "nsJSPrincipals.h"
 
 #ifdef XP_MACOSX
 // AssertMacros.h defines 'check' and conflicts with AccessCheck.h
 #undef check
 #endif
 #include "AccessCheck.h"
 
+#ifdef MOZ_LOGGING
+// Force PR_LOGGING so we can get JS strict warnings even in release builds
+#define FORCE_PR_LOG 1
+#endif
 #include "prlog.h"
 #include "prthread.h"
 
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/asmjscache/AsmJSCache.h"
--- a/dom/ipc/moz.build
+++ b/dom/ipc/moz.build
@@ -58,19 +58,19 @@ UNIFIED_SOURCES += [
     'StructuredCloneUtils.cpp',
     'TabChild.cpp',
     'TabContext.cpp',
     'TabMessageUtils.cpp',
     'TabParent.cpp',
 ]
 
 # Blob.cpp cannot be compiled in unified mode because it triggers a fatal gcc warning.
+# ContentChild.cpp cannot be compiled in unified mode because it forces NSPR logging.
 # CrashReporterChild.cpp cannot be compiled in unified mode because of name clashes
 # in OS X headers.
-# ContentChild.cpp cannot be compiled in unified mode on  linux due to Time conflict
 SOURCES += [
     'Blob.cpp',
     'ContentChild.cpp',
     'CrashReporterChild.cpp',
 ]
 
 IPDL_SOURCES += [
     'DOMTypes.ipdlh',
--- a/dom/plugins/base/moz.build
+++ b/dom/plugins/base/moz.build
@@ -38,29 +38,30 @@ EXPORTS += [
 ]
 
 EXPORTS.mozilla += [
     'PluginPRLibrary.h',
 ]
 
 UNIFIED_SOURCES += [
     'nsJSNPRuntime.cpp',
-    'nsNPAPIPluginInstance.cpp',
-    'nsNPAPIPluginStreamListener.cpp',
     'nsPluginInstanceOwner.cpp',
     'nsPluginModule.cpp',
     'nsPluginPlayPreviewInfo.cpp',
-    'nsPluginStreamListenerPeer.cpp',
-    'nsPluginTags.cpp',
     'PluginPRLibrary.cpp',
 ]
 
+# These files cannot be built in unified mode because they force NSPR logging.
 SOURCES += [
-    'nsNPAPIPlugin.cpp', # Conflict with X11 headers
-    'nsPluginHost.cpp',  # Conflict with NS_NPAPIPLUGIN_CALLBACK
+    'nsNPAPIPlugin.cpp',
+    'nsNPAPIPluginInstance.cpp',
+    'nsNPAPIPluginStreamListener.cpp',
+    'nsPluginHost.cpp',
+    'nsPluginStreamListenerPeer.cpp',
+    'nsPluginTags.cpp',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     UNIFIED_SOURCES += [
         'nsPluginDirServiceProvider.cpp',
         'nsPluginNativeWindowWin.cpp',
         'nsPluginsDirWin.cpp',
     ]
--- a/dom/plugins/base/nsPluginLogging.h
+++ b/dom/plugins/base/nsPluginLogging.h
@@ -3,19 +3,21 @@
  * 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/. */
 
 /* Plugin Module Logging usage instructions and includes */
 ////////////////////////////////////////////////////////////////////////////////
 #ifndef nsPluginLogging_h__
 #define nsPluginLogging_h__
 
-#include "prlog.h"
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#define PR_LOGGING 1
 
 #ifdef PR_LOGGING
+#include "prlog.h"
 
 #ifndef PLUGIN_LOGGING    // allow external override
 #define PLUGIN_LOGGING 1  // master compile-time switch for pluging logging
 #endif
 
 ////////////////////////////////////////////////////////////////////////////////
 // Basic Plugin Logging Usage Instructions
 //
--- a/dom/plugins/ipc/moz.build
+++ b/dom/plugins/ipc/moz.build
@@ -41,69 +41,68 @@ EXPORTS.mozilla.plugins += [
     'StreamNotifyChild.h',
     'StreamNotifyParent.h',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     EXPORTS.mozilla.plugins += [
         'PluginSurfaceParent.h',
     ]
-    UNIFIED_SOURCES += [
+    # These files cannot be built in unified mode because they force NSPR logging.
+    SOURCES += [
         'COMMessageFilter.cpp',
+        'MiniShmParent.cpp',
         'PluginHangUIParent.cpp',
         'PluginSurfaceParent.cpp',
     ]
-    SOURCES += [
-        'MiniShmParent.cpp', # Issues with CreateEvent
-    ]
     DEFINES['MOZ_HANGUI_PROCESS_NAME'] = '"plugin-hang-ui%s"' % CONFIG['BIN_SUFFIX']
     LOCAL_INCLUDES += [
         '/widget/shared',
         'hangui',
     ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     EXPORTS.mozilla.plugins += [
         'PluginInterposeOSX.h',
     ]
 
 if CONFIG['MOZ_ENABLE_QT']:
     GENERATED_SOURCES += [
         'moc_NestedLoopTimer.cpp',
     ]
-    UNIFIED_SOURCES += [
+    # These files cannot be built in unified mode because they force NSPR logging.
+    SOURCES += [
         'NestedLoopTimer.cpp',
     ]
 
-UNIFIED_SOURCES += [
+# These files cannot be built in unified mode because they force NSPR logging.
+SOURCES += [
     'BrowserStreamChild.cpp',
     'BrowserStreamParent.cpp',
     'ChildAsyncCall.cpp',
     'ChildTimer.cpp',
     'PluginBackgroundDestroyer.cpp',
     'PluginIdentifierChild.cpp',
     'PluginIdentifierParent.cpp',
+    'PluginInstanceChild.cpp',
     'PluginInstanceParent.cpp',
     'PluginMessageUtils.cpp',
+    'PluginModuleChild.cpp',
     'PluginModuleParent.cpp',
     'PluginProcessChild.cpp',
     'PluginProcessParent.cpp',
     'PluginScriptableObjectChild.cpp',
     'PluginScriptableObjectParent.cpp',
     'PluginStreamChild.cpp',
     'PluginStreamParent.cpp',
 ]
 
-SOURCES += [
-    'PluginInstanceChild.cpp', # 'PluginThreadCallback' : ambiguous symbol
-    'PluginModuleChild.cpp',   # Redefinition of mozilla::WindowsDllInterceptor sUser32Intercept
-]
-
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
-    UNIFIED_SOURCES += [
+    # These files cannot be built in unified mode because they force NSPR logging.
+    SOURCES += [
         'PluginInterposeOSX.mm',
         'PluginUtilsOSX.mm',
     ]
 
 IPDL_SOURCES += [
     'PBrowserStream.ipdl',
     'PPluginBackgroundDestroyer.ipdl',
     'PPluginIdentifier.ipdl',
--- a/extensions/auth/moz.build
+++ b/extensions/auth/moz.build
@@ -1,27 +1,24 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-UNIFIED_SOURCES += [
-    'nsAuthFactory.cpp',
-    'nsAuthGSSAPI.cpp',
-]
-
 SOURCES += [
+    'nsAuthFactory.cpp',       # forces NSPR logging
+    'nsAuthGSSAPI.cpp',        # forces NSPR logging
     'nsAuthSASL.cpp',
     'nsHttpNegotiateAuth.cpp', # contains constants whose names conflict with constants in other files
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     SOURCES += [
         'nsAuthSSPI.cpp',
     ]
     DEFINES['USE_SSPI'] = True
 else:
-    UNIFIED_SOURCES += [
-        'nsAuthSambaNTLM.cpp',
+    SOURCES += [
+        'nsAuthSambaNTLM.cpp', # forces NSPR logging
     ]
 
 FINAL_LIBRARY = 'xul'
--- a/extensions/auth/nsAuth.h
+++ b/extensions/auth/nsAuth.h
@@ -7,16 +7,20 @@
 
 /* types of packages */
 enum pType {
      PACKAGE_TYPE_KERBEROS,
      PACKAGE_TYPE_NEGOTIATE,
      PACKAGE_TYPE_NTLM
 };
 
+#if defined(MOZ_LOGGING)
+#define FORCE_PR_LOG
+#endif
+
 #include "prlog.h"
 
 #if defined( PR_LOGGING )
 //
 // in order to do logging, the following environment variables need to be set:
 // 
 //      set NSPR_LOG_MODULES=negotiateauth:4
 //      set NSPR_LOG_FILE=negotiateauth.log
--- a/extensions/pref/autoconfig/src/moz.build
+++ b/extensions/pref/autoconfig/src/moz.build
@@ -1,14 +1,15 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-UNIFIED_SOURCES += [
+# These files cannot be built in unified mode because they force NSPR logging.
+SOURCES += [
     'nsAutoConfig.cpp',
     'nsConfigFactory.cpp',
     'nsJSConfigTriggers.cpp',
     'nsReadConfig.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
--- a/extensions/pref/autoconfig/src/nsAutoConfig.cpp
+++ b/extensions/pref/autoconfig/src/nsAutoConfig.cpp
@@ -1,13 +1,17 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
+#ifdef MOZ_LOGGING
+// sorry, this has to be before the pre-compiled header
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif
 #include "nsAutoConfig.h"
 #include "nsIURI.h"
 #include "nsIHttpChannel.h"
 #include "nsIFileStreams.h"
 #include "nsThreadUtils.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "prmem.h"
 #include "nsIObserverService.h"
--- a/extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
+++ b/extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
@@ -1,13 +1,17 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
+#ifdef MOZ_LOGGING
+// sorry, this has to be before the pre-compiled header
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif
 #include "jsapi.h"
 #include "nsIXPConnect.h"
 #include "nsIJSRuntimeService.h"
 #include "nsCOMPtr.h"
 #include "nsIServiceManager.h"
 #include "nsIComponentManager.h"
 #include "nsString.h"
 #include "nsIPrefService.h"
--- a/extensions/pref/autoconfig/src/nsReadConfig.cpp
+++ b/extensions/pref/autoconfig/src/nsReadConfig.cpp
@@ -1,13 +1,17 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
+#ifdef MOZ_LOGGING
+// sorry, this has to be before the pre-compiled header
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif
 #include "nsReadConfig.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsIAppStartup.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsIAutoConfig.h"
 #include "nsIComponentManager.h"
 #include "nsIFile.h"
 #include "nsIObserverService.h"
--- a/gfx/thebes/gfxDWriteFontList.cpp
+++ b/gfx/thebes/gfxDWriteFontList.cpp
@@ -1,16 +1,20 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * 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 "mozilla/ArrayUtils.h"
 #include "mozilla/MemoryReporting.h"
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif /* MOZ_LOGGING */
+
 #include "gfxDWriteFontList.h"
 #include "gfxDWriteFonts.h"
 #include "nsUnicharUtils.h"
 #include "nsILocaleService.h"
 #include "nsServiceManagerUtils.h"
 #include "nsCharSeparatedTokenizer.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -2,16 +2,19 @@
 /* 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 "mozilla/BinarySearch.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/MathAlgorithms.h"
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif
 #include "prlog.h"
 
 #include "nsExpirationTracker.h"
 #include "nsITimer.h"
 
 #include "gfxFont.h"
 #include "gfxGlyphExtents.h"
 #include "gfxPlatform.h"
--- a/gfx/thebes/gfxFontEntry.cpp
+++ b/gfx/thebes/gfxFontEntry.cpp
@@ -1,16 +1,19 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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 "mozilla/DebugOnly.h"
 #include "mozilla/MathAlgorithms.h"
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif
 #include "prlog.h"
 
 #include "nsServiceManagerUtils.h"
 #include "nsExpirationTracker.h"
 #include "nsILanguageAtomService.h"
 #include "nsITimer.h"
 
 #include "gfxFontEntry.h"
--- a/gfx/thebes/gfxFontUtils.cpp
+++ b/gfx/thebes/gfxFontUtils.cpp
@@ -1,13 +1,18 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#include "prlog.h"
+#endif
+
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/BinarySearch.h"
 
 #include "gfxFontUtils.h"
 #include "gfxColor.h"
 
 #include "nsServiceManagerUtils.h"
 
--- a/gfx/thebes/gfxGDIFontList.cpp
+++ b/gfx/thebes/gfxGDIFontList.cpp
@@ -1,16 +1,19 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * 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 "mozilla/DebugOnly.h"
 #include <algorithm>
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif
 #include "prlog.h"
 
 #include "gfxGDIFontList.h"
 #include "gfxWindowsPlatform.h"
 #include "gfxUserFontSet.h"
 #include "gfxFontUtils.h"
 #include "gfxGDIFont.h"
 
--- a/gfx/thebes/gfxMacPlatformFontList.mm
+++ b/gfx/thebes/gfxMacPlatformFontList.mm
@@ -33,16 +33,19 @@
  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * ***** END LICENSE BLOCK ***** */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif
 #include "prlog.h"
 
 #include <algorithm>
 
 #import <AppKit/AppKit.h>
 
 #include "gfxPlatformMac.h"
 #include "gfxMacPlatformFontList.h"
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -1,13 +1,17 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif
+
 #include "mozilla/layers/AsyncTransactionTracker.h" // for AsyncTransactionTracker
 #include "mozilla/layers/CompositorChild.h"
 #include "mozilla/layers/CompositorParent.h"
 #include "mozilla/layers/ImageBridgeChild.h"
 #include "mozilla/layers/SharedBufferManagerChild.h"
 #include "mozilla/layers/ISurfaceAllocator.h"     // for GfxMemoryImageReporter
 
 #include "prlog.h"
--- a/gfx/thebes/gfxPlatformFontList.cpp
+++ b/gfx/thebes/gfxPlatformFontList.cpp
@@ -1,13 +1,16 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif
 #include "prlog.h"
 
 #include "gfxPlatformFontList.h"
 #include "gfxTextRun.h"
 #include "gfxUserFontSet.h"
 
 #include "nsUnicharUtils.h"
 #include "nsUnicodeRange.h"
--- a/gfx/thebes/gfxUserFontSet.cpp
+++ b/gfx/thebes/gfxUserFontSet.cpp
@@ -1,13 +1,16 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif /* MOZ_LOGGING */
 #include "prlog.h"
 
 #include "gfxUserFontSet.h"
 #include "gfxPlatform.h"
 #include "nsUnicharUtils.h"
 #include "nsNetUtil.h"
 #include "nsIJARChannel.h"
 #include "nsIProtocolHandler.h"
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -164,31 +164,31 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wi
         'gfxGDIFont.h',
         'gfxGDIFontList.h',
         'gfxPDFSurface.h',
         'gfxPlatformFontList.h',
         'gfxWindowsNativeDrawing.h',
         'gfxWindowsPlatform.h',
         'gfxWindowsSurface.h',
     ]
+    # gfxGDIFontList.cpp forces NSPR logging, so it cannot be built in unified mode.
     SOURCES += [
         'gfxGDIFont.cpp',
         'gfxGDIFontList.cpp',
         'gfxPDFSurface.cpp',
         'gfxWindowsNativeDrawing.cpp',
         'gfxWindowsPlatform.cpp',
         'gfxWindowsSurface.cpp',
     ]
     if CONFIG['MOZ_ENABLE_DWRITE_FONT']:
-        UNIFIED_SOURCES += [
-            'gfxDWriteFontList.cpp',
-        ]
+        # gfxDWriteFontList.cpp forces NSPR logging, so it cannot be built in unified mode.
         SOURCES += [
             'gfxD2DSurface.cpp',
             'gfxDWriteCommon.cpp',
+            'gfxDWriteFontList.cpp',
             'gfxDWriteFonts.cpp',
         ]
     if CONFIG['MOZ_ENABLE_DIRECT2D1_1']:
         DEFINES['USE_D2D1_1'] = True
 
 # Are we targeting x86 or x64?  If so, build gfxAlphaRecoverySSE2.cpp.
 if CONFIG['INTEL_ARCHITECTURE']:
     SOURCES += ['gfxAlphaRecoverySSE2.cpp']
@@ -199,60 +199,66 @@ if CONFIG['INTEL_ARCHITECTURE']:
 SOURCES += [
     # Includes mac system header conflicting with point/size,
     # and includes glxXlibSurface.h which drags in Xrender.h
     'gfxASurface.cpp',
     # on X11, gfxDrawable.cpp includes X headers for an old workaround which
     # we could consider removing soon (affects Ubuntus older than 10.04 LTS)
     # which currently prevent it from joining UNIFIED_SOURCES.
     'gfxDrawable.cpp',
-    # gfxPlatform.cpp includes mac system header conflicting with point/size
+    # Uses FORCE_PR_LOG
+    'gfxFont.cpp',
+    # Uses FORCE_PR_LOG
+    'gfxFontEntry.cpp',
+    # Uses FORCE_PR_LOG
+    'gfxFontUtils.cpp',
+    # Includes mac system header conflicting with point/size, and also uses FORCE_PR_LOG
     'gfxPlatform.cpp',
+    # Uses FORCE_PR_LOG
+    'gfxPlatformFontList.cpp',
     'gfxPrefs.cpp',
+    # Uses FORCE_PR_LOG
+    'gfxUserFontSet.cpp',
 ]
 
 UNIFIED_SOURCES += [
     'CJKCompatSVS.cpp',
     'gfx3DMatrix.cpp',
     'gfxAlphaRecovery.cpp',
     'gfxBaseSharedMemorySurface.cpp',
     'gfxBlur.cpp',
     'gfxContext.cpp',
-    'gfxFont.cpp',
-    'gfxFontEntry.cpp',
     'gfxFontFeatures.cpp',
     'gfxFontInfoLoader.cpp',
     'gfxFontMissingGlyphs.cpp',
     'gfxFontTest.cpp',
-    'gfxFontUtils.cpp',
     'gfxGlyphExtents.cpp',
     'gfxGradientCache.cpp',
     'gfxGraphiteShaper.cpp',
     'gfxHarfBuzzShaper.cpp',
     'gfxImageSurface.cpp',
     'gfxMathTable.cpp',
     'gfxMatrix.cpp',
     'gfxPattern.cpp',
-    'gfxPlatformFontList.cpp',
     'gfxRect.cpp',
     'gfxReusableImageSurfaceWrapper.cpp',
     'gfxReusableSharedImageSurfaceWrapper.cpp',
     'gfxScriptItemizer.cpp',
     'gfxSkipChars.cpp',
     'gfxSVGGlyphs.cpp',
     'gfxTeeSurface.cpp',
     'gfxTextRun.cpp',
-    'gfxUserFontSet.cpp',
     'gfxUtils.cpp',
     'nsSurfaceTexture.cpp',
     'nsUnicodeRange.cpp',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
-    UNIFIED_SOURCES += [
+    # gfxMacPlatformFontList.mm forces NSPR logging so it cannot be built in unified mode.
+    SOURCES += [
         'gfxMacPlatformFontList.mm',
     ]
 
 FAIL_ON_WARNINGS = not CONFIG['_MSC_VER']
 
 MSVC_ENABLE_PGO = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
--- a/image/public/ImageLogging.h
+++ b/image/public/ImageLogging.h
@@ -2,16 +2,26 @@
  *
  * 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/. */
 
 #ifndef ImageLogging_h
 #define ImageLogging_h
 
+// In order for FORCE_PR_LOG below to work, we have to define it before the
+// first time prlog is #included.
+#if defined(PR_LOG)
+#error "Must #include ImageLogging.h before before any IPDL-generated files or other files that #include prlog.h."
+#endif
+
+#if defined(MOZ_LOGGING)
+#define FORCE_PR_LOG
+#endif
+
 #include "prlog.h"
 #include "prinrval.h"
 #include "nsString.h"
 
 #if defined(PR_LOGGING)
 // Declared in imgRequest.cpp.
 extern PRLogModuleInfo *GetImgLog();
 
--- a/js/xpconnect/loader/moz.build
+++ b/js/xpconnect/loader/moz.build
@@ -1,15 +1,16 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 # These files cannot be built in unified mode because they rely on plarena.h
+# and they want to force NSPR logging.
 SOURCES += [
     'mozJSComponentLoader.cpp',
     'mozJSLoaderUtils.cpp',
     'mozJSSubScriptLoader.cpp',
 ]
 
 EXTRA_JS_MODULES += [
     'ISO8601DateUtils.jsm',
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -1,16 +1,20 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim: set ts=8 sts=4 et sw=4 tw=99: */
 /* 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 "mozilla/Attributes.h"
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
+
 #include <cstdarg>
 
 #include "prlog.h"
 #ifdef ANDROID
 #include <android/log.h>
 #endif
 #ifdef XP_WIN
 #include <windows.h>
--- a/layout/base/moz.build
+++ b/layout/base/moz.build
@@ -75,41 +75,43 @@ UNIFIED_SOURCES += [
     'nsCaret.cpp',
     'nsCounterManager.cpp',
     'nsCSSColorUtils.cpp',
     'nsCSSFrameConstructor.cpp',
     'nsCSSRendering.cpp',
     'nsCSSRenderingBorders.cpp',
     'nsDisplayList.cpp',
     'nsDisplayListInvalidation.cpp',
-    'nsDocumentViewer.cpp',
     'nsFrameManager.cpp',
     'nsFrameTraversal.cpp',
     'nsGenConList.cpp',
     'nsLayoutDebugger.cpp',
     'nsLayoutHistoryState.cpp',
     'nsLayoutUtils.cpp',
     'nsPresContext.cpp',
-    'nsPresShell.cpp',
     'nsQuoteList.cpp',
     'nsStyleChangeList.cpp',
     'nsStyleSheetService.cpp',
     'PaintTracker.cpp',
     'PositionedEventTargeting.cpp',
     'RestyleManager.cpp',
     'RestyleTracker.cpp',
     'SelectionCarets.cpp',
     'StackArena.cpp',
     'TouchCaret.cpp',
 ]
 
+# nsDocumentViewer.cpp and nsPresShell.cpp need to be built separately
+# because they force NSPR logging.
 # nsPresArena.cpp needs to be built separately because it uses plarena.h.
 # nsRefreshDriver.cpp needs to be built separately because of name clashes in the OS X headers
 SOURCES += [
+    'nsDocumentViewer.cpp',
     'nsPresArena.cpp',
+    'nsPresShell.cpp',
     'nsRefreshDriver.cpp',
 ]
 
 FAIL_ON_WARNINGS = True
 
 MSVC_ENABLE_PGO = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -125,16 +125,20 @@ static const char sPrintOptionsContractI
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 #define BEFOREUNLOAD_DISABLED_PREFNAME "dom.disable_beforeunload"
 
 //-----------------------------------------------------
 // PR LOGGING
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif
+
 #include "prlog.h"
 
 #ifdef PR_LOGGING
 
 #ifdef NS_PRINTING
 static PRLogModuleInfo *
 GetPrintingLog()
 {
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -13,16 +13,19 @@
  * identified per MPL Section 3.3
  *
  * Date         Modified by     Description of modification
  * 05/03/2000   IBM Corp.       Observer events for reflow states
  */
 
 /* a presentation of a document, part 2 */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif
 #include "prlog.h"
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/CSSStyleSheet.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/IMEStateManager.h"
--- a/layout/printing/moz.build
+++ b/layout/printing/moz.build
@@ -9,20 +9,24 @@ XPIDL_SOURCES += [
     'nsIPrintProgressParams.idl',
     'nsIPrintStatusFeedback.idl',
 ]
 
 XPIDL_MODULE = 'layout_printing'
 
 UNIFIED_SOURCES += [
     'nsPagePrintTimer.cpp',
+    'nsPrintObject.cpp',
+    'nsPrintPreviewListener.cpp',
+]
+
+# These files cannot be built in unified mode because they force NSPR logging.
+SOURCES += [
     'nsPrintData.cpp',
     'nsPrintEngine.cpp',
-    'nsPrintObject.cpp',
-    'nsPrintPreviewListener.cpp',
 ]
 
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '../../content/base/src',
     '../base',
--- a/layout/printing/nsPrintData.cpp
+++ b/layout/printing/nsPrintData.cpp
@@ -9,16 +9,20 @@
 #include "nsIServiceManager.h"
 #include "nsPrintObject.h"
 #include "nsPrintPreviewListener.h"
 #include "nsIWebProgressListener.h"
 #include "mozilla/Services.h"
 
 //-----------------------------------------------------
 // PR LOGGING
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif
+
 #include "prlog.h"
 
 #ifdef PR_LOGGING
 #define DUMP_LAYOUT_LEVEL 9 // this turns on the dumping of each doucment's layout info
 static PRLogModuleInfo *
 GetPrintingLog()
 {
   static PRLogModuleInfo *sLog;
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -122,16 +122,20 @@ static const char kPrintingPromptService
 #include "nsIChannel.h"
 #include "xpcpublic.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 //-----------------------------------------------------
 // PR LOGGING
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif
+
 #include "prlog.h"
 
 #ifdef PR_LOGGING
 
 #ifdef DEBUG
 // PR_LOGGING is force to always be on (even in release builds)
 // but we only want some of it on,
 //#define EXTENDED_DEBUG_PRINTING 
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -1,16 +1,19 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=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 "FontFaceSet.h"
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif /* MOZ_LOGGING */
 #include "prlog.h"
 
 #include "mozilla/css/Loader.h"
 #include "mozilla/dom/CSSFontFaceLoadEvent.h"
 #include "mozilla/dom/CSSFontFaceLoadEventBinding.h"
 #include "mozilla/dom/FontFaceSetBinding.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/AsyncEventDispatcher.h"
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -249,16 +249,19 @@ public:
   // by ScheduleLoadEventIfNeeded, and is only used after that has
   // been called.
   nsresult                              mStatus;
 
 private:
   void FireLoadEvent(nsIThreadInternal* aThread);
 };
 
+#ifdef MOZ_LOGGING
+// #define FORCE_PR_LOG /* Allow logging in the release build */
+#endif /* MOZ_LOGGING */
 #include "prlog.h"
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo *
 GetLoaderLog()
 {
   static PRLogModuleInfo *sLog;
   if (!sLog)
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -112,17 +112,16 @@ UNIFIED_SOURCES += [
     'nsCSSRules.cpp',
     'nsCSSScanner.cpp',
     'nsCSSValue.cpp',
     'nsDOMCSSAttrDeclaration.cpp',
     'nsDOMCSSDeclaration.cpp',
     'nsDOMCSSRect.cpp',
     'nsDOMCSSRGBColor.cpp',
     'nsDOMCSSValueList.cpp',
-    'nsFontFaceLoader.cpp',
     'nsHTMLCSSStyleSheet.cpp',
     'nsHTMLStyleSheet.cpp',
     'nsLayoutStylesheetCache.cpp',
     'nsMediaFeatures.cpp',
     'nsNthIndexCache.cpp',
     'nsROCSSPrimitiveValue.cpp',
     'nsRuleData.cpp',
     'nsRuleNode.cpp',
@@ -133,21 +132,23 @@ UNIFIED_SOURCES += [
     'nsStyleTransformMatrix.cpp',
     'nsStyleUtil.cpp',
     'nsTransitionManager.cpp',
     'StyleAnimationValue.cpp',
     'StyleRule.cpp',
     'SVGAttrAnimationRuleProcessor.cpp',
 ]
 
-# FontFaceSet.cpp needs to be built separately because it redefines LOG.
 # nsCSSRuleProcessor.cpp needs to be built separately because it uses plarena.h.
+# FontFaceSet.cpp and nsFontFaceLoader.cpp need to be built separately because
+# they force NSPR logging.
 SOURCES += [
     'FontFaceSet.cpp',
     'nsCSSRuleProcessor.cpp',
+    'nsFontFaceLoader.cpp',
 ]
 
 FAIL_ON_WARNINGS = True
 
 MSVC_ENABLE_PGO = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
--- a/layout/style/nsFontFaceLoader.cpp
+++ b/layout/style/nsFontFaceLoader.cpp
@@ -1,16 +1,19 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 // vim:cindent:ts=2:et:sw=2:
 /* 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/. */
 
 /* code for loading in @font-face defined font data */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif /* MOZ_LOGGING */
 #include "prlog.h"
 
 #include "nsFontFaceLoader.h"
 
 #include "nsError.h"
 #include "nsContentUtils.h"
 #include "mozilla/Preferences.h"
 #include "FontFaceSet.h"
--- a/media/mtransport/build/moz.build
+++ b/media/mtransport/build/moz.build
@@ -22,19 +22,17 @@ EXPORTS.mtransport += [
     '../transportlayerice.h',
     '../transportlayerlog.h',
     '../transportlayerloopback.h',
     '../transportlayerprsock.h',
 ]
 
 include('../objs.mozbuild')
 
-# These files cannot be built in unified mode because of the redefinition of
-# getLogModule, UNIMPLEMENTED, nr_socket_long_term_violation_time,
-# nr_socket_short_term_violation_time.
+# These files cannot be built in unified mode because they force NSPR logging.
 SOURCES += mtransport_cppsrcs
 
 FAIL_ON_WARNINGS = True
 
 LOCAL_INCLUDES += [
     '/media/mtransport/',
     '/media/mtransport/third_party/',
     '/media/mtransport/third_party/nICEr/src/crypto',
--- a/media/mtransport/logging.h
+++ b/media/mtransport/logging.h
@@ -4,16 +4,25 @@
  * 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/. */
 
 // Original author: ekr@rtfm.com
 
 #ifndef logging_h__
 #define logging_h__
 
+#if defined(PR_LOG)
+#error "Must #include logging.h before any IPDL-generated files or other files that #include prlog.h."
+#endif
+
+// Enforce logging under production builds for MOZ_MTLOG friends.
+#ifndef PR_LOGGING
+#define FORCE_PR_LOG 1
+#endif
+
 #include <sstream>
 #include <prlog.h>
 
 #if defined(PR_LOGGING)
 
 #define ML_EMERG            1
 #define ML_ERROR            2
 #define ML_WARNING          3
--- a/media/mtransport/standalone/moz.build
+++ b/media/mtransport/standalone/moz.build
@@ -1,19 +1,17 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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('../objs.mozbuild')
 
-# These files cannot be built in unified mode because of the redefinition of
-# getLogModule, UNIMPLEMENTED, nr_socket_long_term_violation_time,
-# nr_socket_short_term_violation_time.
+# These files cannot be built in unified mode because they force NSPR logging.
 SOURCES += mtransport_cppsrcs
 
 Library('mtransport_s')
 
 LOCAL_INCLUDES += [
     '/media/mtransport/',
     '/media/mtransport/third_party/',
     '/media/mtransport/third_party/nICEr/src/crypto',
--- a/media/webrtc/moz.build
+++ b/media/webrtc/moz.build
@@ -46,64 +46,163 @@ GYP_DIRS['trunk'].non_unified_sources +=
 if CONFIG['MOZ_WEBRTC_SIGNALING']:
     GYP_DIRS += ['signaling']
     GYP_DIRS['signaling'].input = 'signaling/signaling.gyp'
     GYP_DIRS['signaling'].variables = gyp_vars.copy()
     GYP_DIRS['signaling'].variables.update(
         build_for_test=0
     )
     GYP_DIRS['signaling'].sandbox_vars['FINAL_LIBRARY'] = 'xul'
-    # Excluded because of name clash in the logTag variable
     signaling_non_unified_sources = [
+        'signaling/src/sipcc/core/gsm/fim.c',        # Because of name clash in the logTag variable
+        'signaling/src/sipcc/core/gsm/gsm_sdp.c',    # Because of name clash in the logTag variable
+        'signaling/src/sipcc/core/gsm/lsm.c',        # Because of name clash in the logTag variable
+        'signaling/src/sipcc/core/sdp/sdp_base64.c', # Because of name clash with the macro PADDING
+    ]
+    # These files cannot be built in unified mode because they force NSPR logging.
+    signaling_non_unified_sources_2 = [
+        'signaling/src/callcontrol/CallControlManagerImpl.cpp',
+        'signaling/src/common/browser_logging/CSFLog.cpp',
         'signaling/src/media-conduit/AudioConduit.cpp',
         'signaling/src/media-conduit/CodecStatistics.cpp',
         'signaling/src/media-conduit/VideoConduit.cpp',
+        'signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp',
         'signaling/src/media/CSFAudioControlWrapper.cpp',
         'signaling/src/media/CSFVideoControlWrapper.cpp',
         'signaling/src/media/VcmSIPCCBinding.cpp',
+        'signaling/src/mediapipeline/MediaPipeline.cpp',
+        'signaling/src/mediapipeline/MediaPipelineFilter.cpp',
+        'signaling/src/mediapipeline/SrtpFlow.cpp',
+        'signaling/src/peerconnection/MediaStreamList.cpp',
         'signaling/src/peerconnection/PeerConnectionCtx.cpp',
         'signaling/src/peerconnection/PeerConnectionImpl.cpp',
         'signaling/src/peerconnection/PeerConnectionMedia.cpp',
         'signaling/src/peerconnection/WebrtcGlobalInformation.cpp',
+        'signaling/src/sipcc/core/ccapp/call_logger.c',
+        'signaling/src/sipcc/core/ccapp/capability_set.c',
+        'signaling/src/sipcc/core/ccapp/cc_call_feature.c',
+        'signaling/src/sipcc/core/ccapp/cc_config.c',
+        'signaling/src/sipcc/core/ccapp/cc_device_feature.c',
+        'signaling/src/sipcc/core/ccapp/cc_device_manager.c',
+        'signaling/src/sipcc/core/ccapp/cc_info.c',
+        'signaling/src/sipcc/core/ccapp/cc_service.c',
+        'signaling/src/sipcc/core/ccapp/ccapi_call.c',
+        'signaling/src/sipcc/core/ccapp/ccapi_call_info.c',
+        'signaling/src/sipcc/core/ccapp/ccapi_config.c',
+        'signaling/src/sipcc/core/ccapp/ccapi_device.c',
         'signaling/src/sipcc/core/ccapp/ccapi_device_info.c',
-        'signaling/src/sipcc/core/gsm/fim.c',
-        'signaling/src/sipcc/core/gsm/gsm_sdp.c',
-        'signaling/src/sipcc/core/gsm/lsm.c',
+        'signaling/src/sipcc/core/ccapp/ccapi_feature_info.c',
+        'signaling/src/sipcc/core/ccapp/ccapi_line_info.c',
+        'signaling/src/sipcc/core/ccapp/ccapi_service.c',
+        'signaling/src/sipcc/core/ccapp/ccapi_snapshot.c',
+        'signaling/src/sipcc/core/ccapp/ccapp_task.c',
+        'signaling/src/sipcc/core/ccapp/ccprovider.c',
+        'signaling/src/sipcc/core/ccapp/conf_roster.c',
+        'signaling/src/sipcc/core/common/cfgfile_utils.c',
+        'signaling/src/sipcc/core/common/config_api.c',
+        'signaling/src/sipcc/core/common/config_parser.c',
+        'signaling/src/sipcc/core/common/init.c',
+        'signaling/src/sipcc/core/common/logger.c',
+        'signaling/src/sipcc/core/common/misc.c',
+        'signaling/src/sipcc/core/common/plat.c',
+        'signaling/src/sipcc/core/common/platform_api.c',
+        'signaling/src/sipcc/core/common/prot_configmgr.c',
+        'signaling/src/sipcc/core/common/resource_manager.c',
+        'signaling/src/sipcc/core/common/subscription_handler.c',
+        'signaling/src/sipcc/core/common/ui.c',
+        'signaling/src/sipcc/core/gsm/ccapi.c',
+        'signaling/src/sipcc/core/gsm/ccapi_strings.c',
+        'signaling/src/sipcc/core/gsm/dcsm.c',
+        'signaling/src/sipcc/core/gsm/fsm.c',
+        'signaling/src/sipcc/core/gsm/fsmb2bcnf.c',
+        'signaling/src/sipcc/core/gsm/fsmcac.c',
+        'signaling/src/sipcc/core/gsm/fsmcnf.c',
+        'signaling/src/sipcc/core/gsm/fsmdef.c',
+        'signaling/src/sipcc/core/gsm/fsmxfr.c',
+        'signaling/src/sipcc/core/gsm/gsm.c',
+        'signaling/src/sipcc/core/gsm/gsm_sdp_crypto.c',
+        'signaling/src/sipcc/core/gsm/media_cap_tbl.c',
+        'signaling/src/sipcc/core/gsm/sm.c',
+        'signaling/src/sipcc/core/gsm/subapi.c',
+        'signaling/src/sipcc/core/sdp/ccsdp.c',
         'signaling/src/sipcc/core/sdp/sdp_access.c',
         'signaling/src/sipcc/core/sdp/sdp_attr.c',
         'signaling/src/sipcc/core/sdp/sdp_attr_access.c',
         'signaling/src/sipcc/core/sdp/sdp_config.c',
         'signaling/src/sipcc/core/sdp/sdp_main.c',
+        'signaling/src/sipcc/core/sdp/sdp_services_unix.c',
         'signaling/src/sipcc/core/sdp/sdp_token.c',
         'signaling/src/sipcc/core/sdp/sdp_utils.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_callinfo.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_cc.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_common_util.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_core.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_debug.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_info.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_messaging.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_platform.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_platform_tcp.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_platform_timers.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_platform_tls.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_platform_udp.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_pmh.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_publish.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_register.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_reldev.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_sdp.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_spi_utils.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_subsmanager.c',
+        'signaling/src/sipcc/core/sipstack/ccsip_task.c',
+        'signaling/src/sipcc/core/sipstack/httpish.c',
+        'signaling/src/sipcc/core/sipstack/sip_common_regmgr.c',
+        'signaling/src/sipcc/core/sipstack/sip_common_transport.c',
+        'signaling/src/sipcc/core/sipstack/sip_csps_transport.c',
+        'signaling/src/sipcc/core/sipstack/sip_interface_regmgr.c',
+        'signaling/src/sipcc/core/sipstack/sip_platform_task.c',
+        'signaling/src/sipcc/core/sipstack/sip_platform_win32_task.c',
+        'signaling/src/sipcc/core/src-common/configapp.c',
+        'signaling/src/sipcc/core/src-common/dialplan.c',
+        'signaling/src/sipcc/core/src-common/dialplanint.c',
+        'signaling/src/sipcc/core/src-common/digcalc.c',
+        'signaling/src/sipcc/core/src-common/kpml_common_util.c',
+        'signaling/src/sipcc/core/src-common/kpmlmap.c',
+        'signaling/src/sipcc/core/src-common/misc_apps_task.c',
+        'signaling/src/sipcc/core/src-common/pres_sub_not_handler.c',
+        'signaling/src/sipcc/core/src-common/publish_int.c',
+        'signaling/src/sipcc/core/src-common/string_lib.c',
+        'signaling/src/sipcc/core/src-common/util_ios_queue.c',
+        'signaling/src/sipcc/cpr/android/cpr_android_init.c',
+        'signaling/src/sipcc/cpr/android/cpr_android_stdio.c',
+        'signaling/src/sipcc/cpr/android/cpr_android_timers_using_select.c',
+        'signaling/src/sipcc/cpr/darwin/cpr_darwin_init.c',
+        'signaling/src/sipcc/cpr/darwin/cpr_darwin_stdio.c',
+        'signaling/src/sipcc/cpr/darwin/cpr_darwin_timers_using_select.c',
+        'signaling/src/sipcc/cpr/linux/cpr_linux_init.c',
+        'signaling/src/sipcc/cpr/linux/cpr_linux_stdio.c',
+        'signaling/src/sipcc/cpr/linux/cpr_linux_timers_using_select.c',
+        'signaling/src/sipcc/cpr/win32/cpr_win_stdio.c',
+        'signaling/src/sipcc/cpr/win32/cpr_win_timers.c',
+        'signaling/src/sipcc/plat/common/dns_utils.c',
+        'signaling/src/sipcc/plat/csf2g/reset_api.c',
+        'signaling/src/sipcc/plat/win32/dns_utils.c',
+        'signaling/src/sipcc/plat/win32/mystub.c',
+        'signaling/src/sipcc/plat/win32/plat_api_stub.c',
+        'signaling/src/sipcc/plat/win32/plat_api_win.c',
         'signaling/src/softphonewrapper/CC_SIPCCCall.cpp',
         'signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp',
+        'signaling/src/softphonewrapper/CC_SIPCCCallServerInfo.cpp',
+        'signaling/src/softphonewrapper/CC_SIPCCDevice.cpp',
+        'signaling/src/softphonewrapper/CC_SIPCCDeviceInfo.cpp',
+        'signaling/src/softphonewrapper/CC_SIPCCFeatureInfo.cpp',
+        'signaling/src/softphonewrapper/CC_SIPCCLine.cpp',
+        'signaling/src/softphonewrapper/CC_SIPCCLineInfo.cpp',
         'signaling/src/softphonewrapper/CC_SIPCCService.cpp',
         'signaling/src/softphonewrapper/ccapi_plat_api_impl.cpp',
     ]
 
-    # Excluded for various symbol conflicts
-    signaling_non_unified_sources_2 = [
-        'signaling/src/mediapipeline/MediaPipelineFilter.cpp',
-        'signaling/src/mediapipeline/SrtpFlow.cpp',
-        'signaling/src/sipcc/core/ccapp/ccapi_call_info.c',
-        'signaling/src/sipcc/core/ccapp/ccprovider.c',
-        'signaling/src/sipcc/core/common/platform_api.c',
-        'signaling/src/sipcc/core/common/ui.c',
-        'signaling/src/sipcc/core/gsm/ccapi_strings.c',
-        'signaling/src/sipcc/core/gsm/fsm.c',
-        'signaling/src/sipcc/core/gsm/fsmcac.c',
-        'signaling/src/sipcc/core/gsm/fsmdef.c',
-        'signaling/src/sipcc/core/sdp/sdp_base64.c',      # Because of name clash with the macro PADDING
-        'signaling/src/sipcc/core/sipstack/ccsip_cc.c',
-        'signaling/src/sipcc/core/sipstack/sip_common_transport.c',
-        'signaling/src/sipcc/core/sipstack/sip_platform_task.c',
-        'signaling/src/sipcc/core/src-common/string_lib.c',
-    ]
-
     GYP_DIRS['signaling'].non_unified_sources += signaling_non_unified_sources
     GYP_DIRS['signaling'].non_unified_sources += signaling_non_unified_sources_2
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
     GYP_DIRS += ['trunk/testing']
     GYP_DIRS['trunk/testing'].input = 'trunk/testing/gtest.gyp'
     GYP_DIRS['trunk/testing'].variables = gyp_vars
     GYP_DIRS['trunk/testing'].non_unified_sources += webrtc_non_unified_sources
--- a/media/webrtc/signaling/src/common/browser_logging/CSFLog.h
+++ b/media/webrtc/signaling/src/common/browser_logging/CSFLog.h
@@ -1,15 +1,25 @@
 /* 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/. */
 
 #ifndef CSFLOG_H
 #define CSFLOG_H
 
+// In order for FORCE_PR_LOG below to work, we have to define it before the
+// first time prlog is #included.
+#if defined(PR_LOG)
+#error "Must #include CSFLog.h before before any IPDL-generated files or other files that #include prlog.h."
+#endif
+
+#if defined(MOZ_LOGGING)
+#define FORCE_PR_LOG
+#endif
+
 #include <stdarg.h>
 #include "prlog.h"
 
 typedef enum{
     CSF_LOG_CRITICAL =1,
     CSF_LOG_ERROR,
     CSF_LOG_WARNING,
     CSF_LOG_NOTICE,
--- a/netwerk/base/src/moz.build
+++ b/netwerk/base/src/moz.build
@@ -23,17 +23,16 @@ UNIFIED_SOURCES += [
     'ArrayBufferInputStream.cpp',
     'BackgroundFileSaver.cpp',
     'ChannelDiverterChild.cpp',
     'ChannelDiverterParent.cpp',
     'Dashboard.cpp',
     'EventTokenBucket.cpp',
     'LoadContextInfo.cpp',
     'NetworkActivityMonitor.cpp',
-    'nsAsyncRedirectVerifyHelper.cpp',
     'nsAsyncStreamCopier.cpp',
     'nsAuthInformationHolder.cpp',
     'nsBase64Encoder.cpp',
     'nsBaseChannel.cpp',
     'nsBaseContentStream.cpp',
     'nsBufferedStreams.cpp',
     'nsChannelClassifier.cpp',
     'nsDirectoryIndexStream.cpp',
@@ -55,18 +54,16 @@ UNIFIED_SOURCES += [
     'nsProtocolProxyService.cpp',
     'nsProxyInfo.cpp',
     'nsRequestObserverProxy.cpp',
     'nsSerializationHelper.cpp',
     'nsServerSocket.cpp',
     'nsSimpleNestedURI.cpp',
     'nsSimpleStreamListener.cpp',
     'nsSimpleURI.cpp',
-    'nsSocketTransport2.cpp',
-    'nsSocketTransportService2.cpp',
     'nsStandardURL.cpp',
     'nsStreamListenerTee.cpp',
     'nsStreamListenerWrapper.cpp',
     'nsStreamLoader.cpp',
     'nsStreamTransportService.cpp',
     'nsSyncStreamListener.cpp',
     'nsTemporaryFileInputStream.cpp',
     'nsTransportUtils.cpp',
@@ -78,16 +75,23 @@ UNIFIED_SOURCES += [
     'Predictor.cpp',
     'ProxyAutoConfig.cpp',
     'RedirectChannelRegistrar.cpp',
     'StreamingProtocolService.cpp',
     'Tickler.cpp',
     'TLSServerSocket.cpp',
 ]
 
+# These files cannot be built in unified mode because they force NSPR logging.
+SOURCES += [
+    'nsAsyncRedirectVerifyHelper.cpp',
+    'nsSocketTransport2.cpp',
+    'nsSocketTransportService2.cpp',
+]
+
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
     SOURCES += [
         'nsAutodialWin.cpp',
         'nsNativeConnectionHelper.cpp',
         'nsURLHelperWin.cpp',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     SOURCES += [
--- a/netwerk/base/src/nsAsyncRedirectVerifyHelper.cpp
+++ b/netwerk/base/src/nsAsyncRedirectVerifyHelper.cpp
@@ -1,13 +1,17 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
+
 #include "prlog.h"
 #include "nsAsyncRedirectVerifyHelper.h"
 #include "nsThreadUtils.h"
 #include "nsNetUtil.h"
 
 #include "nsIOService.h"
 #include "nsIChannel.h"
 #include "nsIHttpChannelInternal.h"
--- a/netwerk/base/src/nsSocketTransport2.cpp
+++ b/netwerk/base/src/nsSocketTransport2.cpp
@@ -1,14 +1,18 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim:set ts=4 sw=4 et cindent: */
 /* 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
+
 #include "nsSocketTransport2.h"
 
 #include "mozilla/Attributes.h"
 #include "nsIOService.h"
 #include "nsStreamUtils.h"
 #include "nsNetSegmentUtils.h"
 #include "nsNetAddr.h"
 #include "nsTransportUtils.h"
--- a/netwerk/base/src/nsSocketTransportService2.cpp
+++ b/netwerk/base/src/nsSocketTransportService2.cpp
@@ -1,13 +1,17 @@
 // vim:set sw=4 sts=4 et cin:
 /* 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
+
 #include "nsSocketTransportService2.h"
 #include "nsSocketTransport2.h"
 #include "nsError.h"
 #include "prnetdb.h"
 #include "prerror.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsServiceManagerUtils.h"
--- a/netwerk/cache/moz.build
+++ b/netwerk/cache/moz.build
@@ -16,17 +16,18 @@ XPIDL_SOURCES += [
 XPIDL_MODULE = 'necko_cache'
 
 EXPORTS += [
     'nsApplicationCacheService.h',
     'nsCacheService.h',
     'nsDeleteDir.h'
 ]
 
-UNIFIED_SOURCES += [
+# These files cannot be built in unified mode because they force NSPR logging.
+SOURCES += [
     'nsApplicationCacheService.cpp',
     'nsCache.cpp',
     'nsCacheEntry.cpp',
     'nsCacheEntryDescriptor.cpp',
     'nsCacheMetaData.cpp',
     'nsCacheService.cpp',
     'nsCacheSession.cpp',
     'nsCacheUtils.cpp',
--- a/netwerk/cache/nsCache.h
+++ b/netwerk/cache/nsCache.h
@@ -6,16 +6,24 @@
 
 /**
  * Cache Service Utility Functions
  */
 
 #ifndef _nsCache_h_
 #define _nsCache_h_
 
+#if defined(MOZ_LOGGING)
+#define FORCE_PR_LOG
+#endif
+
+#if defined(PR_LOG)
+#error "If nsCache.h #included it must come before any files that #include prlog.h"
+#endif
+
 #include "prlog.h"
 #include "nsISupports.h"
 #include "nsIFile.h"
 #include "nsAString.h"
 #include "prtime.h"
 #include "nsError.h"
 
 // PR_LOG args = "format string", arg, arg, ...
--- a/netwerk/cache2/CacheLog.h
+++ b/netwerk/cache2/CacheLog.h
@@ -1,15 +1,23 @@
 /* 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/. */
 
 #ifndef Cache2Log__h__
 #define Cache2Log__h__
 
+#if defined(MOZ_LOGGING)
+#define FORCE_PR_LOG
+#endif
+
+#if defined(PR_LOG)
+#error "If nsCache.h #included it must come before any files that #include prlog.h"
+#endif
+
 #include "prlog.h"
 
 namespace mozilla {
 namespace net {
 
 #if defined(PR_LOGGING)
 extern PRLogModuleInfo* GetCache2Log();
 #define LOG(x)  PR_LOG(GetCache2Log(), PR_LOG_DEBUG, x)
--- a/netwerk/cookie/moz.build
+++ b/netwerk/cookie/moz.build
@@ -23,17 +23,17 @@ if CONFIG['NECKO_COOKIES']:
         'CookieServiceChild.h',
         'CookieServiceParent.h',
     ]
     UNIFIED_SOURCES += [
         'CookieServiceChild.cpp',
         'CookieServiceParent.cpp',
         'nsCookie.cpp',
     ]
-    # nsCookieService.cpp can't be unified because of symbol conflicts
+    # nsCookieService.cpp can't be unified because it forces NSPR logging.
     SOURCES += [
         'nsCookieService.cpp',
     ]
     LOCAL_INCLUDES += [
         '/intl/uconv',
     ]
 
     XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -3,16 +3,21 @@
 /* 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 "mozilla/Attributes.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Likely.h"
 
+#ifdef MOZ_LOGGING
+// this next define has to appear before the include of prlog.h
+#define FORCE_PR_LOG // Allow logging in the release build
+#endif
+
 #include "mozilla/net/CookieServiceChild.h"
 #include "mozilla/net/NeckoCommon.h"
 
 #include "nsCookieService.h"
 #include "nsIServiceManager.h"
 
 #include "nsIIOService.h"
 #include "nsIPrefBranch.h"
--- a/netwerk/dns/GetAddrInfo.cpp
+++ b/netwerk/dns/GetAddrInfo.cpp
@@ -1,14 +1,18 @@
 /* -*- 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/. */
 
+#if defined(MOZ_LOGGING)
+#define FORCE_PR_LOG
+#endif
+
 #include "GetAddrInfo.h"
 #include "mozilla/net/DNS.h"
 #include "prnetdb.h"
 #include "nsHostResolver.h"
 #include "nsError.h"
 #include "mozilla/Mutex.h"
 #include "nsAutoPtr.h"
 #include "mozilla/StaticPtr.h"
--- a/netwerk/dns/moz.build
+++ b/netwerk/dns/moz.build
@@ -20,27 +20,27 @@ EXPORTS.mozilla.net += [
     'DNS.h',
     'DNSListenerProxy.h',
     'DNSRequestChild.h',
     'DNSRequestParent.h',
     'PDNSParams.h',
 ]
 
 SOURCES += [
+    'GetAddrInfo.cpp',           # Excluded from UNIFIED_SOURCES due to NSPR forced logging.
     'nsEffectiveTLDService.cpp', # Excluded from UNIFIED_SOURCES due to special build flags.
-    'nsHostResolver.cpp', # Redefines LOG
+    'nsHostResolver.cpp',        # Excluded from UNIFIED_SOURCES due to NSPR forced logging.
 ]
 
 UNIFIED_SOURCES += [
     'ChildDNSService.cpp',
     'DNS.cpp',
     'DNSListenerProxy.cpp',
     'DNSRequestChild.cpp',
     'DNSRequestParent.cpp',
-    'GetAddrInfo.cpp',
     'nameprep.c',
     'nsDNSService2.cpp',
     'nsIDNService.cpp',
     'punycode.c',
     'race.c',
 ]
 
 IPDL_SOURCES = [
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -1,13 +1,17 @@
 /* vim:set ts=4 sw=4 sts=4 et cin: */
 /* 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/. */
 
+#if defined(MOZ_LOGGING)
+#define FORCE_PR_LOG
+#endif
+
 #if defined(HAVE_RES_NINIT)
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>   
 #include <arpa/nameser.h>
 #include <resolv.h>
 #define RES_RETRY_ON_FAILURE
 #endif
--- a/netwerk/protocol/http/HttpLog.h
+++ b/netwerk/protocol/http/HttpLog.h
@@ -13,16 +13,37 @@
  *  directory, not headers (.h).  If you need to use LOG() in a .h file, call
  *  PR_LOG directly.
  *
  *  This file should also be the first #include in your file.
  *
  *  Yes, this is kludgy.
  *******************************************************************************/
 
+
+// e10s mess: IPDL-generated headers include chromium files that both #include
+// prlog.h, and #define LOG in conflict with this file.
+// Solution: (as described in bug 545995)
+// 1) ensure that this file is #included before any IPDL-generated files and
+//    anything else that #includes prlog.h, so that we can make sure prlog.h
+//    sees FORCE_PR_LOG
+// 2) #include IPDL boilerplate, and then undef LOG so our LOG wins.
+// 3) nsNetModule.cpp does its own crazy stuff with #including prlog.h
+//    multiple times; allow it to define ALLOW_LATE_HTTPLOG_H_INCLUDE to bypass
+//    check.
+#if defined(PR_LOG) && !defined(ALLOW_LATE_HTTPLOG_H_INCLUDE)
+#error "If HttpLog.h #included it must come before any IPDL-generated files or other files that #include prlog.h"
+#endif
+
+// NeckoChild.h will include chromium, which will include prlog.h so define
+// PR_FORCE before we do that.
+#if defined(MOZ_LOGGING)
+#define FORCE_PR_LOG
+#endif
+
 #include "mozilla/net/NeckoChild.h"
 
 // Get rid of Chromium's LOG definition
 #undef LOG
 
 #if defined(PR_LOGGING)
 //
 // Log module for HTTP Protocol logging...
--- a/netwerk/protocol/http/moz.build
+++ b/netwerk/protocol/http/moz.build
@@ -34,38 +34,37 @@ EXPORTS.mozilla.net += [
     'HttpInfo.h',
     'PHttpChannelParams.h',
     'PSpdyPush.h',
     'TimingStruct.h',
 ]
 
 # ASpdySession.cpp and nsHttpAuthCache cannot be built in unified mode because
 # they use plarena.h.
+# The rest of these files cannot be built in unified mode because they want to
+# force NSPR logging.
 SOURCES += [
     'ASpdySession.cpp',
-    'nsHttpAuthCache.cpp',
-    'nsHttpChannelAuthProvider.cpp', # redefines GetAuthType
-]
-
-UNIFIED_SOURCES += [
     'ConnectionDiagnostics.cpp',
     'Http2Compression.cpp',
     'Http2Push.cpp',
     'Http2Session.cpp',
     'Http2Stream.cpp',
     'HttpBaseChannel.cpp',
     'HttpChannelChild.cpp',
     'HttpChannelParent.cpp',
     'HttpChannelParentListener.cpp',
     'HttpInfo.cpp',
     'nsHttp.cpp',
     'nsHttpActivityDistributor.cpp',
+    'nsHttpAuthCache.cpp',
     'nsHttpAuthManager.cpp',
     'nsHttpBasicAuth.cpp',
     'nsHttpChannel.cpp',
+    'nsHttpChannelAuthProvider.cpp',
     'nsHttpChunkedDecoder.cpp',
     'nsHttpConnection.cpp',
     'nsHttpConnectionInfo.cpp',
     'nsHttpConnectionMgr.cpp',
     'nsHttpDigestAuth.cpp',
     'nsHttpHeaderArray.cpp',
     'nsHttpNTLMAuth.cpp',
     'nsHttpPipeline.cpp',
--- a/netwerk/protocol/rtsp/moz.build
+++ b/netwerk/protocol/rtsp/moz.build
@@ -9,17 +9,18 @@ EXPORTS.mozilla.net += [
     'controller/RtspControllerParent.h',
     'controller/RtspMetaData.h',
     'rtsp/RTSPSource.h',
     'RtspChannelChild.h',
     'RtspChannelParent.h',
     'RtspHandler.h',
 ]
 
-UNIFIED_SOURCES += [
+# These files cannot be built in unified mode because they force NSPR logging.
+SOURCES += [
     'controller/RtspController.cpp',
     'controller/RtspControllerChild.cpp',
     'controller/RtspControllerParent.cpp',
     'controller/RtspMetaData.cpp',
     'RtspChannelChild.cpp',
     'RtspChannelParent.cpp',
     'RtspHandler.cpp',
 ]
--- a/netwerk/protocol/websocket/WebSocketLog.h
+++ b/netwerk/protocol/websocket/WebSocketLog.h
@@ -2,16 +2,24 @@
 /* vim: set sw=2 ts=8 et 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/. */
 
 #ifndef WebSocketLog_h
 #define WebSocketLog_h
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
+
+#if defined(PR_LOG)
+#error "This file must be #included before any IPDL-generated files or other files that #include prlog.h"
+#endif
+
 #include "base/basictypes.h"
 #include "prlog.h"
 #include "mozilla/net/NeckoChild.h"
 
 #ifdef PR_LOGGING
 extern PRLogModuleInfo* webSocketLog;
 #endif
 
--- a/netwerk/protocol/wyciwyg/nsWyciwyg.h
+++ b/netwerk/protocol/wyciwyg/nsWyciwyg.h
@@ -1,18 +1,33 @@
 /* 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/. */
 
 #ifndef nsWyciwyg_h__
 #define nsWyciwyg_h__
 
-#include "mozilla/net/NeckoChild.h"
+#if defined(MOZ_LOGGING)
+#define FORCE_PR_LOG
+#endif
 
-// Get rid of chromium's LOG.
+// e10s mess: IPDL-generatd headers include chromium which both #includes
+// prlog.h, and #defines LOG in conflict with this file.
+// Solution: (as described in bug 545995)
+// 1) ensure that this file is #included before any IPDL-generated files and
+//    anything else that #includes prlog.h, so that we can make sure prlog.h
+//    sees FORCE_PR_LOG if needed.
+// 2) #include IPDL boilerplate, and then undef LOG so our LOG wins.
+// 3) nsNetModule.cpp does its own crazy stuff with #including prlog.h
+//    multiple times; allow it to define ALLOW_LATE_NSHTTP_H_INCLUDE to bypass
+//    check. 
+#if defined(PR_LOG) && !defined(ALLOW_LATE_NSHTTP_H_INCLUDE)
+#error "If nsWyciwyg.h #included it must come before any IPDL-generated files or other files that #include prlog.h"
+#endif
+#include "mozilla/net/NeckoChild.h"
 #undef LOG
 
 #include "prlog.h"
 
 #if defined(PR_LOGGING)
 //
 // Log module for HTTP Protocol logging...
 //
--- a/netwerk/sctp/datachannel/DataChannelLog.h
+++ b/netwerk/sctp/datachannel/DataChannelLog.h
@@ -2,16 +2,24 @@
 /* vim: set ts=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/. */
 
 #ifndef DataChannelLog_h
 #define DataChannelLog_h
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
+
+#if defined(PR_LOG)
+#error "This file must be #included before any IPDL-generated files or other files that #include prlog.h"
+#endif
+
 #include "base/basictypes.h"
 #include "prlog.h"
 
 #ifdef PR_LOGGING
 extern PRLogModuleInfo* GetDataChannelLog();
 extern PRLogModuleInfo* GetSCTPLog();
 #endif
 
--- a/netwerk/test/TestProtocols.cpp
+++ b/netwerk/test/TestProtocols.cpp
@@ -10,16 +10,17 @@
     big then we should split it to individual protocols. 
 
     -Gagan Saksena 04/29/99
 */
 
 #include "TestCommon.h"
 #include <algorithm>
 
+#define FORCE_PR_LOG
 #include <stdio.h>
 #ifdef WIN32 
 #include <windows.h>
 #endif
 #ifdef XP_UNIX
 #include <unistd.h>
 #endif
 #include "nspr.h"
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -641,16 +641,21 @@ class RecursiveMakeBackend(CommonBackend
                         "#endif")
                 includeTemplate += (
                     '\n'
                     '#ifdef PL_ARENA_CONST_ALIGN_MASK\n'
                     '#error "%(cppfile)s uses PL_ARENA_CONST_ALIGN_MASK, '
                     'so it cannot be built in unified mode."\n'
                     '#undef PL_ARENA_CONST_ALIGN_MASK\n'
                     '#endif\n'
+                    '#ifdef FORCE_PR_LOG\n'
+                    '#error "%(cppfile)s forces NSPR logging, '
+                    'so it cannot be built in unified mode."\n'
+                    '#undef FORCE_PR_LOG\n'
+                    '#endif\n'
                     '#ifdef INITGUID\n'
                     '#error "%(cppfile)s defines INITGUID, '
                     'so it cannot be built in unified mode."\n'
                     '#undef INITGUID\n'
                     '#endif')
                 f.write('\n'.join(includeTemplate % { "cppfile": s } for
                                   s in source_filenames))
 
--- a/security/apps/AppSignatureVerification.cpp
+++ b/security/apps/AppSignatureVerification.cpp
@@ -1,14 +1,18 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG 1
+#endif
+
 #include "nsNSSCertificateDB.h"
 
 #include "pkix/pkix.h"
 #include "pkix/pkixnss.h"
 #include "pkix/ScopedPtr.h"
 #include "mozilla/RefPtr.h"
 #include "CryptoTask.h"
 #include "AppTrustDomain.h"
--- a/security/apps/AppTrustDomain.cpp
+++ b/security/apps/AppTrustDomain.cpp
@@ -1,14 +1,18 @@
 /* -*- 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG 1
+#endif
+
 #include "AppTrustDomain.h"
 #include "certdb.h"
 #include "pkix/pkixnss.h"
 #include "mozilla/ArrayUtils.h"
 #include "nsIX509CertDB.h"
 #include "nsNSSCertificate.h"
 #include "prerror.h"
 #include "secerr.h"
--- a/security/apps/moz.build
+++ b/security/apps/moz.build
@@ -1,15 +1,16 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-UNIFIED_SOURCES += [
+# These cannot be built in unified mode because they force NSPR logging.
+SOURCES += [
     'AppSignatureVerification.cpp',
     'AppTrustDomain.cpp',
 ]
 
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 
--- a/security/manager/boot/src/moz.build
+++ b/security/manager/boot/src/moz.build
@@ -7,23 +7,28 @@
 EXPORTS.mozilla += [
     'DataStorage.h',
 ]
 
 UNIFIED_SOURCES += [
     'DataStorage.cpp',
     'nsBOOTModule.cpp',
     'nsEntropyCollector.cpp',
-    'nsSecureBrowserUIImpl.cpp',
     'nsSecurityHeaderParser.cpp',
     'nsSecurityWarningDialogs.cpp',
     'nsSiteSecurityService.cpp',
     'PublicKeyPinningService.cpp',
 ]
 
+# nsSecureBrowserUIImpl.cpp cannot be built in unified mode because it forces NSPR logging.
+SOURCES += [
+    'nsSecureBrowserUIImpl.cpp',
+]
+
+
 LOCAL_INCLUDES += [
     '../../../pkix/include',
 ]
 
 FAIL_ON_WARNINGS = True
 
 MSVC_ENABLE_PGO = True
 
--- a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp
+++ b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp
@@ -1,13 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
+
 #include "nspr.h"
 #include "prlog.h"
 
 #include "nsISecureBrowserUI.h"
 #include "nsSecureBrowserUIImpl.h"
 #include "nsCOMPtr.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
--- a/security/manager/ssl/src/PSMContentListener.cpp
+++ b/security/manager/ssl/src/PSMContentListener.cpp
@@ -1,14 +1,18 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  *
  * 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG 1
+#endif
+
 #include "PSMContentListener.h"
 
 #include "nsIStreamListener.h"
 #include "nsIX509CertDB.h"
 
 #include "mozilla/Casting.h"
 #include "mozilla/Services.h"
 
--- a/security/manager/ssl/src/nsCryptoHash.cpp
+++ b/security/manager/ssl/src/nsCryptoHash.cpp
@@ -1,14 +1,18 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  *
  * 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG 1
+#endif
+
 #include <algorithm>
 
 #include "nsCryptoHash.h"
 
 #include "nsIInputStream.h"
 #include "nsIKeyModule.h"
 
 #include "nsString.h"
--- a/security/manager/ssl/src/nsNSSComponent.cpp
+++ b/security/manager/ssl/src/nsNSSComponent.cpp
@@ -1,14 +1,18 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  *
  * 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG 1
+#endif
+
 #include "nsNSSComponent.h"
 
 #include "ExtendedValidation.h"
 #include "NSSCertDBTrustDomain.h"
 #include "mozilla/Telemetry.h"
 #include "nsCertVerificationThread.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsComponentManagerUtils.h"
--- a/uriloader/base/nsURILoader.h
+++ b/uriloader/base/nsURILoader.h
@@ -11,16 +11,20 @@
 #include "nsCOMArray.h"
 #include "nsCOMPtr.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsString.h"
 #include "nsIWeakReference.h"
 #include "mozilla/Attributes.h"
 
+#ifdef MOZ_LOGGING
+// Uncomment the next line to force logging on in release builds
+// #define FORCE_PR_LOG
+#endif
 #include "prlog.h"
 
 class nsDocumentOpenInfo;
 
 class nsURILoader MOZ_FINAL : public nsIURILoader
 {
 public:
   NS_DECL_NSIURILOADER
--- a/uriloader/exthandler/moz.build
+++ b/uriloader/exthandler/moz.build
@@ -46,32 +46,39 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'andr
     ]]
 
 EXPORTS.mozilla.dom += [
     'ExternalHelperAppChild.h',
     'ExternalHelperAppParent.h',
 ]
 
 UNIFIED_SOURCES += [
+    'ExternalHelperAppParent.cpp',
+    'nsLocalHandlerApp.cpp',
+    'nsMIMEInfoImpl.cpp',
+]
+
+# These files can't be built in unified mode because they force NSPR logging.
+SOURCES += [
     'ExternalHelperAppChild.cpp',
-    'ExternalHelperAppParent.cpp',
     'nsExternalHelperAppService.cpp',
     'nsExternalProtocolHandler.cpp',
-    'nsLocalHandlerApp.cpp',
-    'nsMIMEInfoImpl.cpp',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     UNIFIED_SOURCES += [
         'mac/nsLocalHandlerAppMac.mm',
         'mac/nsMIMEInfoMac.mm',
+    ]
+    # These files can't be built in unified mode because they force NSPR logging.
+    SOURCES += [
         'mac/nsOSHelperAppService.mm',
     ]
 else:
-    # These files can't be built in unified mode because they redefine LOG.
+    # These files can't be built in unified mode because they force NSPR logging.
     SOURCES += [
         osdir + '/nsOSHelperAppService.cpp',
     ]
 
 if CONFIG['MOZ_ENABLE_GTK']:
     UNIFIED_SOURCES += [
         'unix/nsGNOMERegistry.cpp',
         'unix/nsMIMEInfoUnix.cpp',
@@ -84,17 +91,18 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'an
         'android/nsMIMEInfoAndroid.cpp',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
     UNIFIED_SOURCES += [
         'unix/nsGNOMERegistry.cpp',
         'unix/nsMIMEInfoUnix.cpp',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
-    UNIFIED_SOURCES += [
+    # These files can't be built in unified mode because they force NSPR logging.
+    SOURCES += [
         'win/nsMIMEInfoWin.cpp',
     ]
 
 if CONFIG['MOZ_ENABLE_DBUS']:
     UNIFIED_SOURCES += [
         'nsDBusHandlerApp.cpp',
     ]
 
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -1,14 +1,18 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * vim:expandtab:shiftwidth=2:tabstop=2:cin:
  * 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
+
 #include "base/basictypes.h"
 
 /* This must occur *after* base/basictypes.h to avoid typedefs conflicts. */
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Base64.h"
 
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/TabChild.h"
--- a/uriloader/exthandler/nsExternalHelperAppService.h
+++ b/uriloader/exthandler/nsExternalHelperAppService.h
@@ -1,16 +1,19 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * 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/. */
 
 #ifndef nsExternalHelperAppService_h__
 #define nsExternalHelperAppService_h__
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
 #include "prlog.h"
 #include "prtime.h"
 
 #include "nsIExternalHelperAppService.h"
 #include "nsIExternalProtocolService.h"
 #include "nsIWebProgressListener2.h"
 #include "nsIHelperAppLauncherDialog.h"
 
--- a/uriloader/prefetch/moz.build
+++ b/uriloader/prefetch/moz.build
@@ -16,24 +16,28 @@ EXPORTS += [
 ]
 
 EXPORTS.mozilla.docshell += [
     'OfflineCacheUpdateChild.h',
     'OfflineCacheUpdateParent.h',
 ]
 
 UNIFIED_SOURCES += [
-    'nsOfflineCacheUpdate.cpp',
-    'nsOfflineCacheUpdateService.cpp',
     'nsPrefetchService.cpp',
     'OfflineCacheUpdateChild.cpp',
     'OfflineCacheUpdateGlue.cpp',
     'OfflineCacheUpdateParent.cpp',
 ]
 
+# These files can't be built in unified mode because they force NSPR logging.
+SOURCES += [
+    'nsOfflineCacheUpdate.cpp',
+    'nsOfflineCacheUpdateService.cpp',
+]
+
 IPDL_SOURCES += [
     'POfflineCacheUpdate.ipdl',
 ]
 
 FAIL_ON_WARNINGS = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
--- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp
+++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp
@@ -1,13 +1,17 @@
 /* -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
+#if defined(MOZ_LOGGING)
+#define FORCE_PR_LOG
+#endif
+
 #include "nsOfflineCacheUpdate.h"
 
 #include "nsCPrefetchService.h"
 #include "nsCURILoader.h"
 #include "nsIApplicationCacheContainer.h"
 #include "nsIApplicationCacheChannel.h"
 #include "nsIApplicationCacheService.h"
 #include "nsICachingChannel.h"
--- a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp
+++ b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp
@@ -1,13 +1,17 @@
 /* -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
+#if defined(MOZ_LOGGING)
+#define FORCE_PR_LOG
+#endif
+
 #include "OfflineCacheUpdateChild.h"
 #include "OfflineCacheUpdateParent.h"
 #include "nsXULAppAPI.h"
 #include "OfflineCacheUpdateGlue.h"
 #include "nsOfflineCacheUpdate.h"
 
 #include "nsCPrefetchService.h"
 #include "nsCURILoader.h"
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -46,16 +46,17 @@
 
 #include "GeckoProfiler.h"
 #ifdef MOZ_ANDROID_HISTORY
 #include "nsNetUtil.h"
 #include "IHistory.h"
 #endif
 
 #ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
 #include "prlog.h"
 #endif
 
 #ifdef DEBUG_ANDROID_EVENTS
 #define EVLOG(args...)  ALOG(args)
 #else
 #define EVLOG(args...) do { } while (0)
 #endif
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -3,16 +3,19 @@
 /* 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 "mozilla/ArrayUtils.h"
 
 #include "TextInputHandler.h"
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif // MOZ_LOGGING
 #include "prlog.h"
 
 #include "mozilla/MiscEvents.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/TextEvents.h"
 
 #include "nsChildView.h"
 #include "nsObjCExceptions.h"
@@ -22,16 +25,21 @@
 #include "WidgetUtils.h"
 #include "nsPrintfCString.h"
 
 #ifdef __LP64__
 #include "ComplexTextInputPanel.h"
 #include <objc/runtime.h>
 #endif // __LP64__
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
+#include "prlog.h"
+
 #ifndef __LP64__
 enum {
   // Currently focused ChildView (while this TSM document is active).
   // Transient (only set while TSMProcessRawKeyEvent() is processing a key
   // event), and the ChildView will be retained and released around the call
   // to TSMProcessRawKeyEvent() -- so it can be weak.
   kFocusedChildViewTSMDocPropertyTag  = 'GKFV', // type ChildView* [WEAK]
 };
--- a/widget/cocoa/moz.build
+++ b/widget/cocoa/moz.build
@@ -23,17 +23,16 @@ UNIFIED_SOURCES += [
     'nsAppShell.mm',
     'nsBidiKeyboard.mm',
     'nsCocoaFeatures.mm',
     'nsCocoaUtils.mm',
     'nsCocoaWindow.mm',
     'nsColorPicker.mm',
     'nsCursorManager.mm',
     'nsDeviceContextSpecX.mm',
-    'nsDragService.mm',
     'nsFilePicker.mm',
     'nsIdleServiceX.mm',
     'nsLookAndFeel.mm',
     'nsMacCursor.mm',
     'nsMacDockSupport.mm',
     'nsMacWebAppUtils.mm',
     'nsMenuBarX.mm',
     'nsMenuGroupOwnerX.mm',
@@ -49,25 +48,26 @@ UNIFIED_SOURCES += [
     'nsScreenManagerCocoa.mm',
     'nsSound.mm',
     'nsStandaloneNativeMenu.mm',
     'nsSystemStatusBarCocoa.mm',
     'nsToolkit.mm',
     'nsWidgetFactory.mm',
     'nsWindowMap.mm',
     'OSXNotificationCenter.mm',
-    'TextInputHandler.mm',
     'VibrancyManager.mm',
     'WidgetTraceEvent.mm',
 ]
 
-# These files cannot be built in unified mode because they cause symbol conflicts
+# These files cannot be built in unified mode because they force NSPR logging.
 SOURCES += [
     'nsChildView.mm',
     'nsClipboard.mm',
+    'nsDragService.mm',
+    'TextInputHandler.mm',
 ]
 
 if CONFIG['TARGET_CPU'] == 'x86_64':
     UNIFIED_SOURCES += [
         'ComplexTextInputPanel.mm',
     ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -1,15 +1,18 @@
 /* -*- Mode: objc; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "mozilla/ArrayUtils.h"
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
 #include "prlog.h"
 
 #include <unistd.h>
 #include <math.h>
 
 #include "nsChildView.h"
 #include "nsCocoaWindow.h"
 
--- a/widget/cocoa/nsClipboard.mm
+++ b/widget/cocoa/nsClipboard.mm
@@ -1,13 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
 #include "prlog.h"
 
 #include "gfxPlatform.h"
 #include "nsCOMPtr.h"
 #include "nsClipboard.h"
 #include "nsString.h"
 #include "nsISupportsPrimitives.h"
 #include "nsXPIDLString.h"
--- a/widget/cocoa/nsDragService.mm
+++ b/widget/cocoa/nsDragService.mm
@@ -1,13 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
 #include "prlog.h"
 
 #include "nsDragService.h"
 #include "nsObjCExceptions.h"
 #include "nsITransferable.h"
 #include "nsString.h"
 #include "nsClipboard.h"
 #include "nsXPCOM.h"
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
@@ -11,57 +11,64 @@ EXPORTS += [
     'mozcontainer.h',
     'nsGTKToolkit.h',
     'nsIImageToPixbuf.h',
 ]
 
 UNIFIED_SOURCES += [
     'mozcontainer.c',
     'NativeKeyBindings.cpp',
-    'nsAppShell.cpp',
     'nsBidiKeyboard.cpp',
     'nsColorPicker.cpp',
     'nsFilePicker.cpp',
-    'nsGtkIMModule.cpp',
     'nsGtkKeyUtils.cpp',
     'nsImageToPixbuf.cpp',
     'nsLookAndFeel.cpp',
     'nsNativeThemeGTK.cpp',
     'nsScreenGtk.cpp',
     'nsScreenManagerGtk.cpp',
     'nsSound.cpp',
     'nsToolkit.cpp',
-    'nsWidgetFactory.cpp',
     'WakeLockListener.cpp',
     'WidgetTraceEvent.cpp',
 ]
 
+# These files force-enable NSPR logging and thus cannot be built in unified mode
 SOURCES += [
-    'nsWindow.cpp', # conflicts with X11 headers
+    'nsAppShell.cpp',
+    'nsGtkIMModule.cpp',
+    'nsWidgetFactory.cpp',
+    'nsWindow.cpp',
 ]
 
 if CONFIG['MOZ_X11']:
     UNIFIED_SOURCES += [
         'nsIdleServiceGTK.cpp',
     ]
 
 if CONFIG['NS_PRINTING']:
     UNIFIED_SOURCES += [
         'nsCUPSShim.cpp',
-        'nsDeviceContextSpecG.cpp',
         'nsPaperPS.cpp',
         'nsPrintDialogGTK.cpp',
         'nsPrintOptionsGTK.cpp',
         'nsPrintSettingsGTK.cpp',
         'nsPSPrinters.cpp',
     ]
+    # This file force-enables NSPR logging and thus cannot be built in unified mode
+    SOURCES += [
+        'nsDeviceContextSpecG.cpp',
+    ]
 
 if CONFIG['MOZ_X11']:
     UNIFIED_SOURCES += [
         'nsClipboard.cpp',
+    ]
+    # This file force-enables NSPR logging and thus cannot be built in unified mode
+    SOURCES += [
         'nsDragService.cpp',
     ]
 
 FAIL_ON_WARNINGS = True
 
 if CONFIG['ACCESSIBILITY']:
     UNIFIED_SOURCES += [
         'maiRedundantObjectFactory.c',
--- a/widget/gtk/nsDeviceContextSpecG.cpp
+++ b/widget/gtk/nsDeviceContextSpecG.cpp
@@ -1,13 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG 1 /* Allow logging in the release build */
+#endif /* MOZ_LOGGING */
 #include "prlog.h"
 
 #include "plstr.h"
 
 #include "nsDeviceContextSpecG.h"
 
 #include "prenv.h" /* for PR_GetEnv */
 
--- a/widget/gtk/nsGtkIMModule.cpp
+++ b/widget/gtk/nsGtkIMModule.cpp
@@ -1,14 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim: set ts=4 et sw=4 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif // MOZ_LOGGING
 #include "prlog.h"
 #include "prtime.h"
 
 #include "nsGtkIMModule.h"
 #include "nsWindow.h"
 #include "mozilla/Likely.h"
 #include "mozilla/MiscEvents.h"
 #include "mozilla/Preferences.h"
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -32,16 +32,19 @@
 #endif
 #include "mozilla/EventForwards.h"
 
 #include "nsGtkIMModule.h"
 
 #undef LOG
 #ifdef MOZ_LOGGING
 
+// make sure that logging is enabled before including prlog.h
+#define FORCE_PR_LOG
+
 #include "prlog.h"
 #include "nsTArray.h"
 
 extern PRLogModuleInfo *gWidgetLog;
 extern PRLogModuleInfo *gWidgetFocusLog;
 extern PRLogModuleInfo *gWidgetDragLog;
 extern PRLogModuleInfo *gWidgetDrawLog;
 
--- a/widget/qt/nsAppShell.cpp
+++ b/widget/qt/nsAppShell.cpp
@@ -13,16 +13,17 @@
 
 #include <qabstracteventdispatcher.h>
 #include <qthread.h>
 
 #include "prenv.h"
 #include "nsQAppInstance.h"
 
 #ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
 #include "prlog.h"
 #endif
 
 #ifdef PR_LOGGING
 PRLogModuleInfo *gWidgetLog = nullptr;
 PRLogModuleInfo *gWidgetFocusLog = nullptr;
 PRLogModuleInfo *gWidgetIMLog = nullptr;
 PRLogModuleInfo *gWidgetDrawLog = nullptr;
--- a/widget/qt/nsDeviceContextSpecQt.cpp
+++ b/widget/qt/nsDeviceContextSpecQt.cpp
@@ -5,16 +5,19 @@
 
 
 #include <QTemporaryFile>
 #include <QPrinterInfo>
 
 #define SET_PRINTER_FEATURES_VIA_PREFS 1
 #define PRINTERFEATURES_PREF "print.tmp.printerfeatures"
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG 1 /* Allow logging in the release build */
+#endif /* MOZ_LOGGING */
 #include "prlog.h"
 
 #include "plstr.h"
 
 #include "nsDeviceContextSpecQt.h"
 
 #include "prenv.h" /* for PR_GetEnv */
 
--- a/widget/qt/nsWindow.h
+++ b/widget/qt/nsWindow.h
@@ -18,16 +18,19 @@
 
 #include "nsGkAtoms.h"
 #include "nsIIdleServiceInternal.h"
 #include "nsIRunnable.h"
 #include "nsThreadUtils.h"
 
 #ifdef MOZ_LOGGING
 
+// make sure that logging is enabled before including prlog.h
+#define FORCE_PR_LOG
+
 #include "prlog.h"
 #include "nsTArray.h"
 
 extern PRLogModuleInfo *gWidgetLog;
 extern PRLogModuleInfo *gWidgetFocusLog;
 extern PRLogModuleInfo *gWidgetIMLog;
 extern PRLogModuleInfo *gWidgetDrawLog;
 
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -1,13 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif // MOZ_LOGGING
 #include "prlog.h"
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/WindowsVersion.h"
 
--- a/widget/windows/WinMouseScrollHandler.cpp
+++ b/widget/windows/WinMouseScrollHandler.cpp
@@ -1,16 +1,19 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=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 "mozilla/DebugOnly.h"
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif // MOZ_LOGGING
 #include "prlog.h"
 
 #include "WinMouseScrollHandler.h"
 #include "nsWindow.h"
 #include "nsWindowDefs.h"
 #include "KeyboardLayout.h"
 #include "WinUtils.h"
 #include "nsGkAtoms.h"
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -15,16 +15,19 @@
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/DataSurfaceHelpers.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/WindowsVersion.h"
 #include "nsIContentPolicy.h"
 #include "nsContentUtils.h"
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif // MOZ_LOGGING
 #include "prlog.h"
 
 #include "nsString.h"
 #include "nsDirectoryServiceUtils.h"
 #include "imgIContainer.h"
 #include "imgITools.h"
 #include "nsStringStream.h"
 #include "nsNetUtil.h"
--- a/widget/windows/moz.build
+++ b/widget/windows/moz.build
@@ -19,26 +19,24 @@ EXPORTS.mozilla.widget += [
     'AudioSession.h',
 ]
 
 UNIFIED_SOURCES += [
     'AudioSession.cpp',
     'GfxInfo.cpp',
     'IEnumFE.cpp',
     'JumpListItem.cpp',
-    'KeyboardLayout.cpp',
     'nsAppShell.cpp',
     'nsClipboard.cpp',
     'nsColorPicker.cpp',
     'nsDataObj.cpp',
     'nsDataObjCollection.cpp',
     'nsDragService.cpp',
     'nsIdleServiceWin.cpp',
     'nsImageClipboard.cpp',
-    'nsIMM32Handler.cpp',
     'nsLookAndFeel.cpp',
     'nsNativeDragSource.cpp',
     'nsNativeDragTarget.cpp',
     'nsNativeThemeWin.cpp',
     'nsScreenManagerWin.cpp',
     'nsScreenWin.cpp',
     'nsSound.cpp',
     'nsToolkit.cpp',
@@ -50,18 +48,24 @@ UNIFIED_SOURCES += [
     'nsWinGesture.cpp',
     'TaskbarPreview.cpp',
     'TaskbarPreviewButton.cpp',
     'TaskbarTabPreview.cpp',
     'TaskbarWindowPreview.cpp',
     'WidgetTraceEvent.cpp',
     'WindowHook.cpp',
     'WinIMEHandler.cpp',
+    'WinTaskbar.cpp',
+]
+
+# The following files cannot be built in unified mode because they force NSPR logging.
+SOURCES += [
+    'KeyboardLayout.cpp',
+    'nsIMM32Handler.cpp',
     'WinMouseScrollHandler.cpp',
-    'WinTaskbar.cpp',
     'WinUtils.cpp',
 ]
 
 # The following files cannot be built in unified mode because of name clashes.
 SOURCES += [
     'JumpListBuilder.cpp',
     'nsBidiKeyboard.cpp',
     'nsFilePicker.cpp',
--- a/widget/windows/nsIMM32Handler.cpp
+++ b/widget/windows/nsIMM32Handler.cpp
@@ -1,14 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sts=2 sw=2 et cin: */
 /* 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/. */
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif // MOZ_LOGGING
 #include "prlog.h"
 
 #include "nsIMM32Handler.h"
 #include "nsWindow.h"
 #include "nsWindowDefs.h"
 #include "WinUtils.h"
 #include "KeyboardLayout.h"
 #include <algorithm>
--- a/widget/windows/nsTextStore.cpp
+++ b/widget/windows/nsTextStore.cpp
@@ -1,16 +1,19 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 <olectl.h>
 #include <algorithm>
 
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG /* Allow logging in the release build */
+#endif // MOZ_LOGGING
 #include "prlog.h"
 
 #include "nscore.h"
 #include "nsWindow.h"
 #ifdef MOZ_METRO
 #include "winrt/MetroWidget.h"
 #endif
 #include "nsPrintfCString.h"
--- a/xpcom/components/moz.build
+++ b/xpcom/components/moz.build
@@ -24,23 +24,22 @@ EXPORTS.mozilla += [
     'Module.h',
     'ModuleLoader.h',
     'ModuleUtils.h',
 ]
 
 # nsCategoryManager.cpp and nsComponentManager.cpp cannot be built in
 # unified mode because they use thea PL_ARENA_CONST_ALIGN_MASK macro
 # with plarena.h.
+# nsNativeModuleLoader.cpp cannot be built in unified mode because it
+# forces NSPR logging.
 SOURCES += [
+    'ManifestParser.cpp',
     'nsCategoryManager.cpp',
     'nsComponentManager.cpp',
-]
-
-UNIFIED_SOURCES += [
-    'ManifestParser.cpp',
     'nsNativeModuleLoader.cpp',
 ]
 
 FAIL_ON_WARNINGS = True
 
 MSVC_ENABLE_PGO = True
 
 FINAL_LIBRARY = 'xul'
--- a/xpcom/components/nsNativeModuleLoader.cpp
+++ b/xpcom/components/nsNativeModuleLoader.cpp
@@ -9,16 +9,21 @@
  *
  * Modifications to Mozilla code or documentation
  * identified per MPL Section 3.3
  *
  * Date             Modified by     Description of modification
  * 04/20/2000       IBM Corp.      Added PR_CALLBACK for Optlink use in OS2
  */
 
+/* Allow logging in the release build */
+#ifdef MOZ_LOGGING
+#define FORCE_PR_LOG
+#endif
+
 #include "nsNativeModuleLoader.h"
 
 #include "prlog.h"
 #include "prinit.h"
 #include "prerror.h"
 
 #include "nsComponentManager.h"
 #include "ManifestParser.h" // for LogMessage
--- a/xpcom/threads/nsTimerImpl.h
+++ b/xpcom/threads/nsTimerImpl.h
@@ -2,16 +2,18 @@
 /* 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/. */
 
 #ifndef nsTimerImpl_h___
 #define nsTimerImpl_h___
 
+//#define FORCE_PR_LOG /* Allow logging in the release build */
+
 #include "nsITimer.h"
 #include "nsIEventTarget.h"
 #include "nsIObserver.h"
 
 #include "nsCOMPtr.h"
 
 #include "prlog.h"
 #include "mozilla/TimeStamp.h"