Backed out changeset 0f5799df920b (bug 1093934) for various test failures CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Thu, 02 Apr 2015 13:42:34 -0700
changeset 256295 352c9ffd70cc5173277b437f1f033cd408633ffa
parent 256294 eebb50c443890c1cebcc67067f8036f02e7fe66a
child 256296 bf782ce1cb1f476a44d1ab21e613490296203df5
push id8007
push userraliiev@mozilla.com
push dateMon, 11 May 2015 19:23:16 +0000
treeherdermozilla-aurora@e2ce1aac996e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1093934
milestone40.0a1
backs out0f5799df920bfbf966217fa7a8d511a646a53725
Backed out changeset 0f5799df920b (bug 1093934) for various test failures CLOSED TREE
mfbt/Assertions.h
mfbt/RefPtr.h
mfbt/Types.h
toolkit/components/telemetry/Telemetry.h
tools/profiler/GeckoProfiler.h
xpcom/base/nsDebugImpl.cpp
xpcom/base/nsIMemoryReporter.idl
xpcom/build/FileLocation.cpp
xpcom/build/FileLocation.h
xpcom/build/ServiceList.h
xpcom/build/Services.cpp
xpcom/components/ManifestParser.h
xpcom/components/nsCategoryManager.cpp
xpcom/components/nsComponentManager.cpp
xpcom/components/nsComponentManager.h
xpcom/ds/nsObserverList.cpp
xpcom/ds/nsObserverService.cpp
xpcom/glue/BlockingResourceBase.cpp
xpcom/glue/nsISupportsImpl.h
xpcom/libxpcomrt/XPCOMRTInit.cpp
xpcom/libxpcomrt/XPCOMRTInit.h
xpcom/libxpcomrt/XPCOMRTModule.inc
xpcom/libxpcomrt/XPCOMRTStubs.cpp
xpcom/libxpcomrt/docs/index.rst
xpcom/libxpcomrt/moz.build
xpcom/moz.build
xpcom/string/nsSubstring.cpp
xpcom/string/nsTSubstring.cpp
xpcom/threads/LazyIdleThread.cpp
xpcom/threads/nsThread.cpp
xpcom/threads/nsTimerImpl.cpp
--- a/mfbt/Assertions.h
+++ b/mfbt/Assertions.h
@@ -136,33 +136,33 @@ MOZ_ReportAssertionFailure(const char* a
   MOZ_PRETEND_NORETURN_FOR_STATIC_ANALYSIS
 {
 #ifdef ANDROID
   __android_log_print(ANDROID_LOG_FATAL, "MOZ_Assert",
                       "Assertion failure: %s, at %s:%d\n",
                       aStr, aFilename, aLine);
 #else
   fprintf(stderr, "Assertion failure: %s, at %s:%d\n", aStr, aFilename, aLine);
-#if defined (MOZ_DUMP_ASSERTION_STACK) && !defined(MOZILLA_XPCOMRT_API)
+#ifdef MOZ_DUMP_ASSERTION_STACK
   nsTraceRefcnt::WalkTheStack(stderr);
 #endif
   fflush(stderr);
 #endif
 }
 
 static MOZ_COLD MOZ_ALWAYS_INLINE void
 MOZ_ReportCrash(const char* aStr, const char* aFilename, int aLine)
   MOZ_PRETEND_NORETURN_FOR_STATIC_ANALYSIS
 {
 #ifdef ANDROID
   __android_log_print(ANDROID_LOG_FATAL, "MOZ_CRASH",
                       "Hit MOZ_CRASH(%s) at %s:%d\n", aStr, aFilename, aLine);
 #else
   fprintf(stderr, "Hit MOZ_CRASH(%s) at %s:%d\n", aStr, aFilename, aLine);
-#if defined(MOZ_DUMP_ASSERTION_STACK) && !defined(MOZILLA_XPCOMRT_API)
+#ifdef MOZ_DUMP_ASSERTION_STACK
   nsTraceRefcnt::WalkTheStack(stderr);
 #endif
   fflush(stderr);
 #endif
 }
 
 /**
  * MOZ_REALLY_CRASH is used in the implementation of MOZ_CRASH().  You should
--- a/mfbt/RefPtr.h
+++ b/mfbt/RefPtr.h
@@ -15,17 +15,16 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/RefCountType.h"
 #include "mozilla/TypeTraits.h"
 #if defined(MOZILLA_INTERNAL_API)
 #include "nsXPCOM.h"
 #endif
 
 #if defined(MOZILLA_INTERNAL_API) && \
-    !defined(MOZILLA_XPCOMRT_API) && \
     (defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING))
 #define MOZ_REFCOUNTED_LEAK_CHECKING
 #endif
 
 namespace mozilla {
 
 template<typename T> class RefCounted;
 template<typename T> class RefPtr;
--- a/mfbt/Types.h
+++ b/mfbt/Types.h
@@ -84,17 +84,17 @@
 #else
   /*
    * On linux mozglue is linked in the program and we link libxul.so with
    * -z,defs. Normally that causes the linker to reject undefined references in
    * libxul.so, but as a loophole it allows undefined references to weak
    * symbols. We add the weak attribute to the import version of the MFBT API
    * macros to exploit this.
    */
-#  if defined(MOZ_GLUE_IN_PROGRAM) && !defined(MOZILLA_XPCOMRT_API)
+#  if defined(MOZ_GLUE_IN_PROGRAM)
 #    define MFBT_API   __attribute__((weak)) MOZ_IMPORT_API
 #    define MFBT_DATA  __attribute__((weak)) MOZ_IMPORT_DATA
 #  else
 #    define MFBT_API   MOZ_IMPORT_API
 #    define MFBT_DATA  MOZ_IMPORT_DATA
 #  endif
 #endif
 
--- a/toolkit/components/telemetry/Telemetry.h
+++ b/toolkit/components/telemetry/Telemetry.h
@@ -232,17 +232,17 @@ class ProcessedStack;
  * Record the main thread's call stack after it hangs.
  *
  * @param aDuration - Approximate duration of main thread hang, in seconds
  * @param aStack - Array of PCs from the hung call stack
  * @param aSystemUptime - System uptime at the time of the hang, in minutes
  * @param aFirefoxUptime - Firefox uptime at the time of the hang, in minutes
  * @param aAnnotations - Any annotations to be added to the report
  */
-#if defined(MOZ_ENABLE_PROFILER_SPS) && !defined(MOZILLA_XPCOMRT_API)
+#if defined(MOZ_ENABLE_PROFILER_SPS)
 void RecordChromeHang(uint32_t aDuration,
                       ProcessedStack &aStack,
                       int32_t aSystemUptime,
                       int32_t aFirefoxUptime,
                       mozilla::UniquePtr<mozilla::HangMonitor::HangAnnotations>
                               aAnnotations);
 #endif
 
--- a/tools/profiler/GeckoProfiler.h
+++ b/tools/profiler/GeckoProfiler.h
@@ -46,32 +46,30 @@
  *
  */
 
 #ifndef SAMPLER_H
 #define SAMPLER_H
 
 #include "js/TypeDecls.h"
 #include "mozilla/UniquePtr.h"
-#include "mozilla/GuardObjects.h"
-#include "ProfilerBacktrace.h"
 
 namespace mozilla {
 class TimeStamp;
 }
 
 enum TracingMetadata {
   TRACING_DEFAULT,
   TRACING_INTERVAL_START,
   TRACING_INTERVAL_END,
   TRACING_EVENT,
   TRACING_EVENT_BACKTRACE
 };
 
-#if !defined(MOZ_ENABLE_PROFILER_SPS) || defined(MOZILLA_XPCOMRT_API)
+#ifndef MOZ_ENABLE_PROFILER_SPS
 
 #include <stdint.h>
 #include <stdarg.h>
 
 // Insert a RAII in this scope to active a pseudo label. Any samples collected
 // in this scope will contain this annotation. For dynamic strings use
 // PROFILER_LABEL_PRINTF. Arguments must be string literals.
 #define PROFILER_LABEL(name_space, info, category) do {} while (0)
--- a/xpcom/base/nsDebugImpl.cpp
+++ b/xpcom/base/nsDebugImpl.cpp
@@ -348,19 +348,17 @@ NS_DebugBreak(uint32_t aSeverity, const 
 
 #  define PrintToBuffer(...) PR_sxprintf(StuffFixedBuffer, &buf, __VA_ARGS__)
 
   // Print "[PID]" or "[Desc PID]" at the beginning of the message.
   PrintToBuffer("[");
   if (sMultiprocessDescription) {
     PrintToBuffer("%s ", sMultiprocessDescription);
   }
-#if !defined(MOZILLA_XPCOMRT_API)
   PrintToBuffer("%d] ", base::GetCurrentProcId());
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
   PrintToBuffer("%s: ", sevString);
 
   if (aStr) {
     PrintToBuffer("%s: ", aStr);
   }
   if (aExpr) {
     PrintToBuffer("'%s', ", aExpr);
@@ -400,34 +398,34 @@ NS_DebugBreak(uint32_t aSeverity, const 
     case NS_DEBUG_WARNING:
       return;
 
     case NS_DEBUG_BREAK:
       Break(buf.buffer);
       return;
 
     case NS_DEBUG_ABORT: {
-#if defined(MOZ_CRASHREPORTER) && !defined(MOZILLA_XPCOMRT_API)
+#if defined(MOZ_CRASHREPORTER)
       // Updating crash annotations in the child causes us to do IPC. This can
       // really cause trouble if we're asserting from within IPC code. So we
       // have to do without the annotations in that case.
       if (XRE_GetProcessType() == GeckoProcessType_Default) {
         nsCString note("xpcom_runtime_abort(");
         note += buf.buffer;
         note += ")";
         CrashReporter::AppendAppNotesToCrashReport(note);
         CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AbortMessage"),
                                            nsDependentCString(buf.buffer));
       }
 #endif  // MOZ_CRASHREPORTER
 
 #if defined(DEBUG) && defined(_WIN32)
       RealBreak();
 #endif
-#if defined(DEBUG) && !defined(MOZILLA_XPCOMRT_API)
+#ifdef DEBUG
       nsTraceRefcnt::WalkTheStack(stderr);
 #endif
       Abort(buf.buffer);
       return;
     }
   }
 
   // Now we deal with assertions
@@ -442,25 +440,21 @@ NS_DebugBreak(uint32_t aSeverity, const 
       fprintf(stderr, "Suspending process; attach with the debugger.\n");
       kill(0, SIGSTOP);
 #else
       Break(buf.buffer);
 #endif
       return;
 
     case NS_ASSERT_STACK:
-#if !defined(MOZILLA_XPCOMRT_API)
       nsTraceRefcnt::WalkTheStack(stderr);
-#endif // !defined(MOZILLA_XPCOMRT_API)
       return;
 
     case NS_ASSERT_STACK_AND_ABORT:
-#if !defined(MOZILLA_XPCOMRT_API)
       nsTraceRefcnt::WalkTheStack(stderr);
-#endif // !defined(MOZILLA_XPCOMRT_API)
       // Fall through to abort
 
     case NS_ASSERT_ABORT:
       Abort(buf.buffer);
       return;
 
     case NS_ASSERT_TRAP:
     case NS_ASSERT_UNINITIALIZED: // Default to "trap" behavior
@@ -617,14 +611,14 @@ NS_ErrorAccordingToNSPR()
     case PR_NO_ACCESS_RIGHTS_ERROR:      return NS_ERROR_FILE_ACCESS_DENIED;
     default:                             return NS_ERROR_FAILURE;
   }
 }
 
 void
 NS_ABORT_OOM(size_t aSize)
 {
-#if defined(MOZ_CRASHREPORTER) && !defined(MOZILLA_XPCOMRT_API)
+#ifdef MOZ_CRASHREPORTER
   CrashReporter::AnnotateOOMAllocationSize(aSize);
 #endif
   MOZ_CRASH();
 }
 
--- a/xpcom/base/nsIMemoryReporter.idl
+++ b/xpcom/base/nsIMemoryReporter.idl
@@ -511,17 +511,17 @@ typedef nsresult (*NonJSSizeOfTabFn)(nsP
                                      size_t* aStyleSize,
                                      size_t* aOtherSize);
 
 nsresult RegisterJSSizeOfTab(JSSizeOfTabFn aSizeOfTabFn);
 nsresult RegisterNonJSSizeOfTab(NonJSSizeOfTabFn aSizeOfTabFn);
 
 }
 
-#if defined(MOZ_DMD) && !defined(MOZILLA_XPCOMRT_API)
+#if defined(MOZ_DMD)
 namespace mozilla {
 namespace dmd {
 // This runs all the memory reporters in the current process but does nothing
 // with the results;  i.e. it does the minimal amount of work possible for DMD
 // to do its thing.  It does nothing with child processes.
 void RunReportersForThisProcess();
 }
 }
--- a/xpcom/build/FileLocation.cpp
+++ b/xpcom/build/FileLocation.cpp
@@ -1,17 +1,15 @@
 /* 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 "FileLocation.h"
-#if !defined(MOZILLA_XPCOMRT_API)
 #include "nsZipArchive.h"
 #include "nsURLHelper.h"
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
 namespace mozilla {
 
 FileLocation::FileLocation()
 {
 }
 
 FileLocation::~FileLocation()
@@ -28,22 +26,19 @@ FileLocation::FileLocation(nsIFile* aFil
   Init(aFile, aPath);
 }
 
 FileLocation::FileLocation(const FileLocation& aFile, const char* aPath)
 {
   if (aFile.IsZip()) {
     if (aFile.mBaseFile) {
       Init(aFile.mBaseFile, aFile.mPath.get());
-    }
-#if !defined(MOZILLA_XPCOMRT_API)
-    else {
+    } else {
       Init(aFile.mBaseZip, aFile.mPath.get());
     }
-#endif
     if (aPath) {
       int32_t i = mPath.RFindChar('/');
       if (kNotFound == i) {
         mPath.Truncate(0);
       } else {
         mPath.Truncate(i + 1);
       }
       mPath += aPath;
@@ -71,73 +66,63 @@ FileLocation::FileLocation(const FileLoc
       Init(aFile.mBaseFile);
     }
   }
 }
 
 void
 FileLocation::Init(nsIFile* aFile)
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   mBaseZip = nullptr;
-#endif //!defined(MOZILLA_XPCOMRT_API)
   mBaseFile = aFile;
   mPath.Truncate();
 }
 
 void
 FileLocation::Init(nsIFile* aFile, const char* aPath)
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   mBaseZip = nullptr;
-#endif // !defined(MOZILLA_XPCOMRT_API)
   mBaseFile = aFile;
   mPath = aPath;
 }
 
 void
 FileLocation::Init(nsZipArchive* aZip, const char* aPath)
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   mBaseZip = aZip;
-#endif // !defined(MOZILLA_XPCOMRT_API)
   mBaseFile = nullptr;
   mPath = aPath;
 }
 
 void
 FileLocation::GetURIString(nsACString& aResult) const
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   if (mBaseFile) {
     net_GetURLSpecFromActualFile(mBaseFile, aResult);
   } else if (mBaseZip) {
     nsRefPtr<nsZipHandle> handler = mBaseZip->GetFD();
     handler->mFile.GetURIString(aResult);
   }
   if (IsZip()) {
     aResult.Insert("jar:", 0);
     aResult += "!/";
     aResult += mPath;
   }
-#endif // !defined(MOZILLA_XPCOMRT_API)
 }
 
 already_AddRefed<nsIFile>
 FileLocation::GetBaseFile()
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   if (IsZip() && mBaseZip) {
     nsRefPtr<nsZipHandle> handler = mBaseZip->GetFD();
     if (handler) {
       return handler->mFile.GetBaseFile();
     }
     return nullptr;
   }
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
   nsCOMPtr<nsIFile> file = mBaseFile;
   return file.forget();
 }
 
 bool
 FileLocation::Equals(const FileLocation& aFile) const
 {
@@ -147,47 +132,42 @@ FileLocation::Equals(const FileLocation&
 
   if (mBaseFile && aFile.mBaseFile) {
     bool eq;
     return NS_SUCCEEDED(mBaseFile->Equals(aFile.mBaseFile, &eq)) && eq;
   }
 
   const FileLocation* a = this;
   const FileLocation* b = &aFile;
-#if !defined(MOZILLA_XPCOMRT_API)
   if (a->mBaseZip) {
     nsRefPtr<nsZipHandle> handler = a->mBaseZip->GetFD();
     a = &handler->mFile;
   }
   if (b->mBaseZip) {
     nsRefPtr<nsZipHandle> handler = b->mBaseZip->GetFD();
     b = &handler->mFile;
   }
-#endif // !defined(MOZILLA_XPCOMRT_API)
-
   return a->Equals(*b);
 }
 
 nsresult
 FileLocation::GetData(Data& aData)
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   if (!IsZip()) {
     return mBaseFile->OpenNSPRFileDesc(PR_RDONLY, 0444, &aData.mFd.rwget());
   }
   aData.mZip = mBaseZip;
   if (!aData.mZip) {
     aData.mZip = new nsZipArchive();
     aData.mZip->OpenArchive(mBaseFile);
   }
   aData.mItem = aData.mZip->GetItem(mPath.get());
   if (aData.mItem) {
     return NS_OK;
   }
-#endif // !defined(MOZILLA_XPCOMRT_API)
   return NS_ERROR_FILE_UNRECOGNIZED_PATH;
 }
 
 nsresult
 FileLocation::Data::GetSize(uint32_t* aResult)
 {
   if (mFd) {
     PRFileInfo64 fileInfo;
@@ -196,45 +176,39 @@ FileLocation::Data::GetSize(uint32_t* aR
     }
 
     if (fileInfo.size > int64_t(UINT32_MAX)) {
       return NS_ERROR_FILE_TOO_BIG;
     }
 
     *aResult = fileInfo.size;
     return NS_OK;
-  }
-#if !defined(MOZILLA_XPCOMRT_API)
-  else if (mItem) {
+  } else if (mItem) {
     *aResult = mItem->RealSize();
     return NS_OK;
   }
-#endif // !defined(MOZILLA_XPCOMRT_API)
   return NS_ERROR_NOT_INITIALIZED;
 }
 
 nsresult
 FileLocation::Data::Copy(char* aBuf, uint32_t aLen)
 {
   if (mFd) {
     for (uint32_t totalRead = 0; totalRead < aLen;) {
       int32_t read = PR_Read(mFd, aBuf + totalRead,
                              XPCOM_MIN(aLen - totalRead, uint32_t(INT32_MAX)));
       if (read < 0) {
         return NS_ErrorAccordingToNSPR();
       }
       totalRead += read;
     }
     return NS_OK;
-  }
-#if !defined(MOZILLA_XPCOMRT_API)
-  else if (mItem) {
+  } else if (mItem) {
     nsZipCursor cursor(mItem, mZip, reinterpret_cast<uint8_t*>(aBuf),
                        aLen, true);
     uint32_t readLen;
     cursor.Copy(&readLen);
     return (readLen == aLen) ? NS_OK : NS_ERROR_FILE_CORRUPTED;
   }
-#endif // !defined(MOZILLA_XPCOMRT_API)
   return NS_ERROR_NOT_INITIALIZED;
 }
 
 } /* namespace mozilla */
--- a/xpcom/build/FileLocation.h
+++ b/xpcom/build/FileLocation.h
@@ -82,21 +82,17 @@ public:
    * Returns the path within the archive, when within an archive
    */
   void GetPath(nsACString& aResult) const { aResult = mPath; }
 
   /**
    * Boolean value corresponding to whether the file location is initialized
    * or not.
    */
-#if defined(MOZILLA_XPCOMRT_API)
-  operator bool() const { return mBaseFile; }
-#else
   operator bool() const { return mBaseFile || mBaseZip; }
-#endif // defined(MOZILLA_XPCOMRT_API)
 
   /**
    * Returns whether another FileLocation points to the same resource
    */
   bool Equals(const FileLocation& aFile) const;
 
   /**
    * Data associated with a FileLocation.
@@ -110,31 +106,27 @@ public:
     nsresult GetSize(uint32_t* aResult);
 
     /**
      * Copies the data in the given buffer
      */
     nsresult Copy(char* aBuf, uint32_t aLen);
   protected:
     friend class FileLocation;
-#if !defined(MOZILLA_XPCOMRT_API)
     nsZipItem* mItem;
-#endif // !defined(MOZILLA_XPCOMRT_API)
     nsRefPtr<nsZipArchive> mZip;
     mozilla::AutoFDClose mFd;
   };
 
   /**
    * Returns the data associated with the resource pointed at by the file
    * location.
    */
   nsresult GetData(Data& aData);
 private:
   nsCOMPtr<nsIFile> mBaseFile;
-#if !defined(MOZILLA_XPCOMRT_API)
   nsRefPtr<nsZipArchive> mBaseZip;
-#endif // !defined(MOZILLA_XPCOMRT_API)
   nsCString mPath;
 }; /* class FileLocation */
 
 } /* namespace mozilla */
 
 #endif /* mozilla_FileLocation_h */
--- a/xpcom/build/ServiceList.h
+++ b/xpcom/build/ServiceList.h
@@ -1,32 +1,29 @@
 /* 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/. */
 // IWYU pragma: private, include "mozilla/Services.h"
 
-#if !defined(MOZILLA_XPCOMRT_API)
 #ifdef ACCESSIBILITY
 MOZ_SERVICE(AccessibilityService, nsIAccessibilityService,
             "@mozilla.org/accessibilityService;1")
 #endif
 MOZ_SERVICE(ChromeRegistryService, nsIChromeRegistry,
             "@mozilla.org/chrome/chrome-registry;1")
 MOZ_SERVICE(ToolkitChromeRegistryService, nsIToolkitChromeRegistry,
             "@mozilla.org/chrome/chrome-registry;1")
 MOZ_SERVICE(XULChromeRegistryService, nsIXULChromeRegistry,
             "@mozilla.org/chrome/chrome-registry;1")
 MOZ_SERVICE(XULOverlayProviderService, nsIXULOverlayProvider,
             "@mozilla.org/chrome/chrome-registry;1")
 MOZ_SERVICE(IOService, nsIIOService,
             "@mozilla.org/network/io-service;1")
-#endif // !defined(MOZILLA_XPCOMRT_API)
 MOZ_SERVICE(ObserverService, nsIObserverService,
             "@mozilla.org/observer-service;1")
-#if !defined(MOZILLA_XPCOMRT_API)
 MOZ_SERVICE(StringBundleService, nsIStringBundleService,
             "@mozilla.org/intl/stringbundle;1")
 MOZ_SERVICE(XPConnect, nsIXPConnect,
             "@mozilla.org/js/xpc/XPConnect;1")
 MOZ_SERVICE(InDOMUtils, inIDOMUtils,
             "@mozilla.org/inspector/dom-utils;1")
 MOZ_SERVICE(PermissionManager, nsIPermissionManager,
             "@mozilla.org/permissionmanager;1");
@@ -42,9 +39,8 @@ namespace mozilla {
 #endif
 
 MOZ_SERVICE(HistoryService, IHistory,
             "@mozilla.org/browser/history;1")
 
 #ifdef MOZ_USE_NAMESPACE
 }
 #endif
-#endif // !defined(MOZILLA_XPCOMRT_API)
--- a/xpcom/build/Services.cpp
+++ b/xpcom/build/Services.cpp
@@ -1,37 +1,35 @@
 /* -*- 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 "mozilla/Likely.h"
 #include "mozilla/Services.h"
 #include "nsComponentManager.h"
-#include "nsIObserverService.h"
-#include "nsNetCID.h"
-#include "nsObserverService.h"
-#include "nsXPCOMPrivate.h"
-#if !defined(MOZILLA_XPCOMRT_API)
 #include "nsIIOService.h"
 #include "nsIDirectoryService.h"
 #ifdef ACCESSIBILITY
 #include "nsIAccessibilityService.h"
 #endif
 #include "nsIChromeRegistry.h"
+#include "nsIObserverService.h"
+#include "nsNetCID.h"
+#include "nsObserverService.h"
+#include "nsXPCOMPrivate.h"
 #include "nsIStringBundle.h"
 #include "nsIToolkitChromeRegistry.h"
 #include "nsIXULOverlayProvider.h"
 #include "IHistory.h"
 #include "nsIXPConnect.h"
 #include "inIDOMUtils.h"
 #include "nsIPermissionManager.h"
 #include "nsIServiceWorkerManager.h"
 #include "nsIAsyncShutdown.h"
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
 using namespace mozilla;
 using namespace mozilla::services;
 
 /*
  * Define a global variable and a getter for every service in ServiceList.
  * eg. gIOService and GetIOService()
  */
--- a/xpcom/components/ManifestParser.h
+++ b/xpcom/components/ManifestParser.h
@@ -2,19 +2,17 @@
 /* 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 ManifestParser_h
 #define ManifestParser_h
 
 #include "nsComponentManager.h"
-#if !defined(MOZILLA_XPCOMRT_API)
 #include "nsChromeRegistry.h"
-#endif // !defined(MOZILLA_XPCOMRT_API)
 #include "mozilla/FileLocation.h"
 
 class nsIFile;
 
 void ParseManifest(NSLocationType aType, mozilla::FileLocation& aFile,
                    char* aBuf, bool aChromeOnly, bool aXPTOnly = false);
 
 void LogMessage(const char* aMsg, ...);
--- a/xpcom/components/nsCategoryManager.cpp
+++ b/xpcom/components/nsCategoryManager.cpp
@@ -464,19 +464,17 @@ nsCategoryManager::nsCategoryManager()
 {
   PL_INIT_ARENA_POOL(&mArena, "CategoryManagerArena",
                      NS_CATEGORYMANAGER_ARENA_SIZE);
 }
 
 void
 nsCategoryManager::InitMemoryReporter()
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   RegisterStrongMemoryReporter(this);
-#endif // !defined(MOZILLA_XPCOMRT_API)
 }
 
 nsCategoryManager::~nsCategoryManager()
 {
   // the hashtable contains entries that must be deleted before the arena is
   // destroyed, or else you will have PRLocks undestroyed and other Really
   // Bad Stuff (TM)
   mTable.Clear();
@@ -859,29 +857,25 @@ NS_CreateServicesFromCategory(const char
     rv = categoryManager->GetCategoryEntry(aCategory, entryString.get(),
                                            getter_Copies(contractID));
     if (NS_FAILED(rv)) {
       continue;
     }
 
     nsCOMPtr<nsISupports> instance = do_GetService(contractID);
     if (!instance) {
-#if !defined(MOZILLA_XPCOMRT_API)
       LogMessage("While creating services from category '%s', could not create service for entry '%s', contract ID '%s'",
                  aCategory, entryString.get(), contractID.get());
-#endif // !defined(MOZILLA_XPCOMRT_API)
       continue;
     }
 
     if (aObserverTopic) {
       // try an observer, if it implements it.
       nsCOMPtr<nsIObserver> observer = do_QueryInterface(instance);
       if (observer) {
         observer->Observe(aOrigin, aObserverTopic, EmptyString().get());
       } else {
-#if !defined(MOZILLA_XPCOMRT_API)
         LogMessage("While creating services from category '%s', service for entry '%s', contract ID '%s' does not implement nsIObserver.",
                    aCategory, entryString.get(), contractID.get());
-#endif // !defined(MOZILLA_XPCOMRT_API)
       }
     }
   }
 }
--- a/xpcom/components/nsComponentManager.cpp
+++ b/xpcom/components/nsComponentManager.cpp
@@ -53,29 +53,27 @@
 #include "nsXPIDLString.h"
 #include "prcmon.h"
 #include "xptinfo.h" // this after nsISupports, to pick up IID so that xpt stuff doesn't try to define it itself...
 #include "nsThreadUtils.h"
 #include "prthread.h"
 #include "private/pprthred.h"
 #include "nsTArray.h"
 #include "prio.h"
-#if !defined(MOZILLA_XPCOMRT_API)
 #include "ManifestParser.h"
-#include "nsNetUtil.h"
-#endif // !defined(MOZILLA_XPCOMRT_API)
 #include "mozilla/Services.h"
 
 #include "mozilla/GenericFactory.h"
 #include "nsSupportsPrimitives.h"
 #include "nsArray.h"
 #include "nsIMutableArray.h"
 #include "nsArrayEnumerator.h"
 #include "nsStringEnumerator.h"
 #include "mozilla/FileUtils.h"
+#include "nsNetUtil.h"
 #include "nsDataHashtable.h"
 
 #include <new>     // for placement new
 
 #include "mozilla/Omnijar.h"
 
 #include "prlog.h"
 
@@ -247,17 +245,16 @@ public:
 
 private:
   SafeMutex& mMutex;
   bool mLocked;
 };
 
 } // anonymous namespace
 
-#if !defined(MOZILLA_XPCOMRT_API)
 // this is safe to call during InitXPCOM
 static already_AddRefed<nsIFile>
 GetLocationFromDirectoryService(const char* aProp)
 {
   nsCOMPtr<nsIProperties> directoryService;
   nsDirectoryService::Create(nullptr,
                              NS_GET_IID(nsIProperties),
                              getter_AddRefs(directoryService));
@@ -284,17 +281,16 @@ CloneAndAppend(nsIFile* aBase, const nsA
   aBase->Clone(getter_AddRefs(f));
   if (!f) {
     return nullptr;
   }
 
   f->AppendNative(aAppend);
   return f.forget();
 }
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsComponentManagerImpl
 ////////////////////////////////////////////////////////////////////////////////
 
 nsresult
 nsComponentManagerImpl::Create(nsISupports* aOuter, REFNSIID aIID,
                                void** aResult)
@@ -317,43 +313,39 @@ nsComponentManagerImpl::nsComponentManag
   , mContractIDs(CONTRACTID_HASHTABLE_INITIAL_LENGTH)
   , mLock("nsComponentManagerImpl.mLock")
   , mStatus(NOT_INITIALIZED)
 {
 }
 
 nsTArray<const mozilla::Module*>* nsComponentManagerImpl::sStaticModules;
 
-#if !defined(MOZILLA_XPCOMRT_API)
 NSMODULE_DEFN(start_kPStaticModules);
 NSMODULE_DEFN(end_kPStaticModules);
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
 /* The content between start_kPStaticModules and end_kPStaticModules is gathered
  * by the linker from various objects containing symbols in a specific section.
  * ASAN considers (rightfully) the use of this content as a global buffer
  * overflow. But this is a deliberate and well-considered choice, with no proper
  * way to make ASAN happy. */
 MOZ_ASAN_BLACKLIST
 /* static */ void
 nsComponentManagerImpl::InitializeStaticModules()
 {
   if (sStaticModules) {
     return;
   }
 
   sStaticModules = new nsTArray<const mozilla::Module*>;
-#if !defined(MOZILLA_XPCOMRT_API)
   for (const mozilla::Module * const* staticModules =
          &NSMODULE_NAME(start_kPStaticModules) + 1;
        staticModules < &NSMODULE_NAME(end_kPStaticModules); ++staticModules)
     if (*staticModules) { // ASAN adds padding
       sStaticModules->AppendElement(*staticModules);
     }
-#endif // !defined(MOZILLA_XPCOMRT_API)
 }
 
 nsTArray<nsComponentManagerImpl::ComponentLocation>*
 nsComponentManagerImpl::sModuleLocations;
 
 /* static */ void
 nsComponentManagerImpl::InitializeModuleLocations()
 {
@@ -371,45 +363,36 @@ nsComponentManagerImpl::Init()
 
   if (!nsComponentManagerLog) {
     nsComponentManagerLog = PR_NewLogModule("nsComponentManager");
   }
 
   // Initialize our arena
   PL_INIT_ARENA_POOL(&mArena, "ComponentManagerArena", NS_CM_BLOCK_SIZE);
 
-#if !defined(MOZILLA_XPCOMRT_API)
   nsCOMPtr<nsIFile> greDir =
     GetLocationFromDirectoryService(NS_GRE_DIR);
   nsCOMPtr<nsIFile> appDir =
     GetLocationFromDirectoryService(NS_XPCOM_CURRENT_PROCESS_DIR);
-#endif
 
   InitializeStaticModules();
 
-#if !defined(MOZILLA_XPCOMRT_API)
   nsresult rv = mNativeModuleLoader.Init();
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   nsCategoryManager::GetSingleton()->SuppressNotifications(true);
-#endif
 
-#if defined(MOZILLA_XPCOMRT_API)
-  RegisterModule(&kXPCOMRTModule, nullptr);
-#else
   RegisterModule(&kXPCOMModule, nullptr);
-#endif // defined(MOZILLA_XPCOMRT_API)
 
   for (uint32_t i = 0; i < sStaticModules->Length(); ++i) {
     RegisterModule((*sStaticModules)[i], nullptr);
   }
 
-#if !defined(MOZILLA_XPCOMRT_API)
   // The overall order in which chrome.manifests are expected to be treated
   // is the following:
   // - greDir
   // - greDir's omni.ja
   // - appDir
   // - appDir's omni.ja
 
   InitializeModuleLocations();
@@ -444,17 +427,16 @@ nsComponentManagerImpl::Init()
     cl->location.Init(appOmnijar, "chrome.manifest");
   }
 
   RereadChromeManifests(false);
 
   nsCategoryManager::GetSingleton()->SuppressNotifications(false);
 
   RegisterWeakMemoryReporter(this);
-#endif
 
   // Unfortunately, we can't register the nsCategoryManager memory reporter
   // in its constructor (which is triggered by the GetSingleton() call
   // above) because the memory reporter manager isn't initialized at that
   // point.  So we wait until now.
   nsCategoryManager::GetSingleton()->InitMemoryReporter();
 
   PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG,
@@ -553,22 +535,20 @@ nsComponentManagerImpl::RegisterCIDEntry
 
     nsCString existing;
     if (f->mModule) {
       existing = f->mModule->Description();
     } else {
       existing = "<unknown module>";
     }
     SafeMutexAutoUnlock unlock(mLock);
-#if !defined(MOZILLA_XPCOMRT_API)
     LogMessage("While registering XPCOM module %s, trying to re-register CID '%s' already registered by %s.",
                aModule->Description().get(),
                idstr,
                existing.get());
-#endif // !defined(MOZILLA_XPCOMRT_API)
     return;
   }
 
   f = new nsFactoryEntry(aEntry, aModule);
   mFactories.Put(*aEntry->cid, f);
 }
 
 void
@@ -584,29 +564,26 @@ nsComponentManagerImpl::RegisterContract
   nsFactoryEntry* f = mFactories.Get(*aEntry->cid);
   if (!f) {
     NS_WARNING("No CID found when attempting to map contract ID");
 
     char idstr[NSID_LENGTH];
     aEntry->cid->ToProvidedString(idstr);
 
     SafeMutexAutoUnlock unlock(mLock);
-#if !defined(MOZILLA_XPCOMRT_API)
     LogMessage("Could not map contract ID '%s' to CID %s because no implementation of the CID is registered.",
                aEntry->contractid,
                idstr);
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
     return;
   }
 
   mContractIDs.Put(nsDependentCString(aEntry->contractid), f);
 }
 
-#if !defined(MOZILLA_XPCOMRT_API)
 static void
 CutExtension(nsCString& aPath)
 {
   int32_t dotPos = aPath.RFindChar('.');
   if (kNotFound == dotPos) {
     aPath.Truncate();
   } else {
     aPath.Cut(0, dotPos + 1);
@@ -839,30 +816,27 @@ nsComponentManagerImpl::ManifestCategory
 void
 nsComponentManagerImpl::RereadChromeManifests(bool aChromeOnly)
 {
   for (uint32_t i = 0; i < sModuleLocations->Length(); ++i) {
     ComponentLocation& l = sModuleLocations->ElementAt(i);
     RegisterManifest(l.type, l.location, aChromeOnly);
   }
 }
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
 bool
 nsComponentManagerImpl::KnownModule::EnsureLoader()
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   if (!mLoader) {
     nsCString extension;
     mFile.GetURIString(extension);
     CutExtension(extension);
     mLoader =
       nsComponentManagerImpl::gComponentManager->LoaderForExtension(extension);
   }
-#endif // !defined(MOZILLA_XPCOMRT_API)
   return !!mLoader;
 }
 
 bool
 nsComponentManagerImpl::KnownModule::Load()
 {
   if (mFailed) {
     return false;
@@ -909,38 +883,34 @@ nsresult nsComponentManagerImpl::Shutdow
   PR_ASSERT(NORMAL == mStatus);
 
   mStatus = SHUTDOWN_IN_PROGRESS;
 
   // Shutdown the component manager
   PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG,
          ("nsComponentManager: Beginning Shutdown."));
 
-#if !defined(MOZILLA_XPCOMRT_API)
   UnregisterWeakMemoryReporter(this);
-#endif
 
   // Release all cached factories
   mContractIDs.Clear();
   mFactories.Clear(); // XXX release the objects, don't just clear
   mLoaderMap.Clear();
   mKnownModules.Clear();
   mKnownStaticModules.Clear();
 
   delete sStaticModules;
   delete sModuleLocations;
 #ifdef MOZ_B2G_LOADER
   delete sXPTIInfosBook;
   sXPTIInfosBook = nullptr;
 #endif
 
-#if !defined(MOZILLA_XPCOMRT_API)
   // Unload libraries
   mNativeModuleLoader.UnloadLibraries();
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
   // delete arena for strings and small objects
   PL_FinishArenaPool(&mArena);
 
   mStatus = SHUTDOWN_COMPLETE;
 
   PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG,
          ("nsComponentManager: Shutdown complete."));
@@ -1614,34 +1584,32 @@ nsComponentManagerImpl::GetServiceByCont
 
   nsISupports** sresult = reinterpret_cast<nsISupports**>(aResult);
   *sresult = entry->mServiceObject;
   (*sresult)->AddRef();
 
   return NS_OK;
 }
 
-#if !defined(MOZILLA_XPCOMRT_API)
 already_AddRefed<mozilla::ModuleLoader>
 nsComponentManagerImpl::LoaderForExtension(const nsACString& aExt)
 {
   nsCOMPtr<mozilla::ModuleLoader> loader = mLoaderMap.Get(aExt);
   if (!loader) {
     loader = do_GetServiceFromCategory("module-loader",
                                        PromiseFlatCString(aExt).get());
     if (!loader) {
       return nullptr;
     }
 
     mLoaderMap.Put(aExt, loader);
   }
 
   return loader.forget();
 }
-#endif
 
 NS_IMETHODIMP
 nsComponentManagerImpl::RegisterFactory(const nsCID& aClass,
                                         const char* aName,
                                         const char* aContractID,
                                         nsIFactory* aFactory)
 {
   if (!aFactory) {
@@ -1704,22 +1672,18 @@ nsComponentManagerImpl::UnregisterFactor
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsComponentManagerImpl::AutoRegister(nsIFile* aLocation)
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   XRE_AddManifestLocation(NS_COMPONENT_LOCATION, aLocation);
   return NS_OK;
-#else
-  return NS_ERROR_NOT_IMPLEMENTED;
-#endif // !defined(MOZILLA_XPCOMRT_API)
 }
 
 NS_IMETHODIMP
 nsComponentManagerImpl::AutoUnregister(nsIFile* aLocation)
 {
   NS_ERROR("AutoUnregister not implemented.");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
@@ -2045,39 +2009,34 @@ XRE_AddStaticComponent(const mozilla::Mo
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsComponentManagerImpl::AddBootstrappedManifestLocation(nsIFile* aLocation)
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   nsString path;
   nsresult rv = aLocation->GetPath(path);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   if (Substring(path, path.Length() - 4).EqualsLiteral(".xpi")) {
     return XRE_AddJarManifestLocation(NS_BOOTSTRAPPED_LOCATION, aLocation);
   }
 
   nsCOMPtr<nsIFile> manifest =
     CloneAndAppend(aLocation, NS_LITERAL_CSTRING("chrome.manifest"));
   return XRE_AddManifestLocation(NS_BOOTSTRAPPED_LOCATION, manifest);
-#else
-  return NS_ERROR_NOT_IMPLEMENTED;
-#endif // !defined(MOZILLA_XPCOMRT_API)
 }
 
 NS_IMETHODIMP
 nsComponentManagerImpl::RemoveBootstrappedManifestLocation(nsIFile* aLocation)
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   nsCOMPtr<nsIChromeRegistry> cr = mozilla::services::GetChromeRegistryService();
   if (!cr) {
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIFile> manifest;
   nsString path;
   nsresult rv = aLocation->GetPath(path);
@@ -2097,25 +2056,21 @@ nsComponentManagerImpl::RemoveBootstrapp
   }
 
   // Remove reference.
   nsComponentManagerImpl::sModuleLocations->RemoveElement(elem,
                                                           ComponentLocationComparator());
 
   rv = cr->CheckForNewChrome();
   return rv;
-#else
-  return NS_ERROR_NOT_IMPLEMENTED;
-#endif // !defined(MOZILLA_XPCOMRT_API)
 }
 
 NS_IMETHODIMP
 nsComponentManagerImpl::GetManifestLocations(nsIArray** aLocations)
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   NS_ENSURE_ARG_POINTER(aLocations);
   *aLocations = nullptr;
 
   if (!sModuleLocations) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   nsCOMPtr<nsIMutableArray> locations = nsArray::Create();
@@ -2129,19 +2084,16 @@ nsComponentManagerImpl::GetManifestLocat
     rv = NS_NewURI(getter_AddRefs(uri), uriString);
     if (NS_SUCCEEDED(rv)) {
       locations->AppendElement(uri, false);
     }
   }
 
   locations.forget(aLocations);
   return NS_OK;
-#else
-  return NS_ERROR_NOT_IMPLEMENTED;
-#endif // !defined(MOZILLA_XPCOMRT_API)
 }
 
 #ifdef MOZ_B2G_LOADER
 
 /* static */
 void
 nsComponentManagerImpl::XPTOnlyManifestManifest(
     XPTOnlyManifestProcessingContext&  aCx, int aLineNo, char* const* aArgv)
@@ -2180,17 +2132,16 @@ nsComponentManagerImpl::PreloadXPT(nsIFi
 void
 PreloadXPT(nsIFile* aOmnijarFile)
 {
   nsComponentManagerImpl::PreloadXPT(aOmnijarFile);
 }
 
 #endif /* MOZ_B2G_LOADER */
 
-#if !defined(MOZILLA_XPCOMRT_API)
 EXPORT_XPCOM_API(nsresult)
 XRE_AddManifestLocation(NSLocationType aType, nsIFile* aLocation)
 {
   nsComponentManagerImpl::InitializeModuleLocations();
   nsComponentManagerImpl::ComponentLocation* c =
     nsComponentManagerImpl::sModuleLocations->AppendElement();
   c->type = aType;
   c->location.Init(aLocation);
@@ -2221,10 +2172,9 @@ XRE_AddJarManifestLocation(NSLocationTyp
         nsComponentManagerImpl::gComponentManager->mStatus) {
     nsComponentManagerImpl::gComponentManager->RegisterManifest(aType,
                                                                 c->location,
                                                                 false);
   }
 
   return NS_OK;
 }
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
--- a/xpcom/components/nsComponentManager.h
+++ b/xpcom/components/nsComponentManager.h
@@ -62,21 +62,17 @@ extern const char fileSizeValueName[];
 extern const char nativeComponentType[];
 extern const char staticComponentType[];
 
 #ifdef DEBUG
 #define XPCOM_CHECK_PENDING_CIDS
 #endif
 ////////////////////////////////////////////////////////////////////////////////
 
-#if defined(MOZILLA_XPCOMRT_API)
-extern const mozilla::Module kXPCOMRTModule;
-#else
 extern const mozilla::Module kXPCOMModule;
-#endif
 
 /**
  * This is a wrapper around mozilla::Mutex which provides runtime
  * checking for a deadlock where the same thread tries to lock a mutex while
  * it is already locked. This checking is present in both debug and release
  * builds.
  */
 class SafeMutex
--- a/xpcom/ds/nsObserverList.cpp
+++ b/xpcom/ds/nsObserverList.cpp
@@ -99,23 +99,21 @@ nsObserverList::NotifyObservers(nsISuppo
   for (int32_t i = 0; i < observers.Count(); ++i) {
     observers[i]->Observe(aSubject, aTopic, someData);
   }
 }
 
 void
 nsObserverList::UnmarkGrayStrongObservers()
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   for (uint32_t i = 0; i < mObservers.Length(); ++i) {
     if (!mObservers[i].isWeakRef) {
       xpc_TryUnmarkWrappedGrayObject(mObservers[i].asObserver());
     }
   }
-#endif // !defined(MOZILLA_XPCOMRT_API)
 }
 
 NS_IMPL_ISUPPORTS(nsObserverEnumerator, nsISimpleEnumerator)
 
 nsObserverEnumerator::nsObserverEnumerator(nsObserverList* aObserverList)
   : mIndex(0)
 {
   aObserverList->FillObserverArray(mObservers);
--- a/xpcom/ds/nsObserverService.cpp
+++ b/xpcom/ds/nsObserverService.cpp
@@ -200,27 +200,23 @@ nsObserverService::nsObserverService()
 nsObserverService::~nsObserverService(void)
 {
   Shutdown();
 }
 
 void
 nsObserverService::RegisterReporter()
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   RegisterWeakMemoryReporter(this);
-#endif // !defined(MOZILLA_XPCOMRT_API)
 }
 
 void
 nsObserverService::Shutdown()
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   UnregisterWeakMemoryReporter(this);
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
   mShuttingDown = true;
 
   mObserverTopicTable.Clear();
 }
 
 nsresult
 nsObserverService::Create(nsISupports* aOuter, const nsIID& aIID,
--- a/xpcom/glue/BlockingResourceBase.cpp
+++ b/xpcom/glue/BlockingResourceBase.cpp
@@ -18,17 +18,17 @@
 #include "nsTHashtable.h"
 #endif
 
 #include "mozilla/CondVar.h"
 #include "mozilla/DeadlockDetector.h"
 #include "mozilla/ReentrantMonitor.h"
 #include "mozilla/Mutex.h"
 
-#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
+#ifdef MOZILLA_INTERNAL_API
 #include "GeckoProfiler.h"
 #endif //MOZILLA_INTERNAL_API
 
 #endif // ifdef DEBUG
 
 namespace mozilla {
 //
 // BlockingResourceBase implementation
@@ -456,26 +456,26 @@ ReentrantMonitor::Wait(PRIntervalTime aI
   int32_t savedEntryCount = mEntryCount;
   AcquisitionState savedAcquisitionState = GetAcquisitionState();
   BlockingResourceBase* savedChainPrev = mChainPrev;
   mEntryCount = 0;
   ClearAcquisitionState();
   mChainPrev = 0;
 
   nsresult rv;
-#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
+#ifdef MOZILLA_INTERNAL_API
   {
     GeckoProfilerSleepRAII profiler_sleep;
 #endif //MOZILLA_INTERNAL_API
 
     // give up the monitor until we're back from Wait()
     rv = PR_Wait(mReentrantMonitor, aInterval) == PR_SUCCESS ? NS_OK :
                                                                NS_ERROR_FAILURE;
 
-#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
+#ifdef MOZILLA_INTERNAL_API
   }
 #endif //MOZILLA_INTERNAL_API
 
   // restore saved state
   mEntryCount = savedEntryCount;
   SetAcquisitionState(savedAcquisitionState);
   mChainPrev = savedChainPrev;
 
--- a/xpcom/glue/nsISupportsImpl.h
+++ b/xpcom/glue/nsISupportsImpl.h
@@ -139,17 +139,17 @@ private:
 #define NS_ASSERT_OWNINGTHREAD_AGGREGATE(agg, _class) ((void)0)
 #define NS_ASSERT_OWNINGTHREAD(_class)  ((void)0)
 
 #endif // DEBUG || (NIGHTLY_BUILD && !MOZ_PROFILING)
 
 
 // Macros for reference-count and constructor logging
 
-#if defined(NS_BUILD_REFCNT_LOGGING) && !defined(MOZILLA_XPCOMRT_API)
+#ifdef NS_BUILD_REFCNT_LOGGING
 
 #define NS_LOG_ADDREF(_p, _rc, _type, _size) \
   NS_LogAddRef((_p), (_rc), (_type), (uint32_t) (_size))
 
 #define NS_LOG_RELEASE(_p, _rc, _type) \
   NS_LogRelease((_p), (_rc), (_type))
 
 #include "mozilla/TypeTraits.h"
@@ -176,39 +176,29 @@ do {                                    
 
 #define MOZ_COUNT_CTOR_INHERITED(_type, _base)                    \
 do {                                                              \
   MOZ_ASSERT_CLASSNAME(_type);                                    \
   MOZ_ASSERT_CLASSNAME(_base);                                    \
   NS_LogCtor((void*)this, #_type, sizeof(*this) - sizeof(_base)); \
 } while (0)
 
-#define MOZ_LOG_CTOR(_ptr, _name, _size) \
-do {                                     \
-  NS_LogCtor((void*)_ptr, _name, _size); \
-} while (0)
-
 #define MOZ_COUNT_DTOR(_type)                                 \
 do {                                                          \
   MOZ_ASSERT_CLASSNAME(_type);                                \
   NS_LogDtor((void*)this, #_type, sizeof(*this));             \
 } while (0)
 
 #define MOZ_COUNT_DTOR_INHERITED(_type, _base)                    \
 do {                                                              \
   MOZ_ASSERT_CLASSNAME(_type);                                    \
   MOZ_ASSERT_CLASSNAME(_base);                                    \
   NS_LogDtor((void*)this, #_type, sizeof(*this) - sizeof(_base)); \
 } while (0)
 
-#define MOZ_LOG_DTOR(_ptr, _name, _size) \
-do {                                     \
-  NS_LogDtor((void*)_ptr, _name, _size); \
-} while (0)
-
 /* nsCOMPtr.h allows these macros to be defined by clients
  * These logging functions require dynamic_cast<void*>, so they don't
  * do anything useful if we don't have dynamic_cast<void*>. */
 #define NSCAP_LOG_ASSIGNMENT(_c, _p)                                \
   if (_p)                                                           \
     NS_LogCOMPtrAddRef((_c),static_cast<nsISupports*>(_p))
 
 #define NSCAP_LOG_RELEASE(_c, _p)                                   \
@@ -216,20 +206,18 @@ do {                                    
     NS_LogCOMPtrRelease((_c), static_cast<nsISupports*>(_p))
 
 #else /* !NS_BUILD_REFCNT_LOGGING */
 
 #define NS_LOG_ADDREF(_p, _rc, _type, _size)
 #define NS_LOG_RELEASE(_p, _rc, _type)
 #define MOZ_COUNT_CTOR(_type)
 #define MOZ_COUNT_CTOR_INHERITED(_type, _base)
-#define MOZ_LOG_CTOR(_ptr, _name, _size)
 #define MOZ_COUNT_DTOR(_type)
 #define MOZ_COUNT_DTOR_INHERITED(_type, _base)
-#define MOZ_LOG_DTOR(_ptr, _name, _size)
 
 #endif /* NS_BUILD_REFCNT_LOGGING */
 
 
 // Support for ISupports classes which interact with cycle collector.
 
 #define NS_NUMBER_OF_FLAGS_IN_REFCNT 2
 #define NS_IN_PURPLE_BUFFER (1 << 0)
deleted file mode 100644
--- a/xpcom/libxpcomrt/XPCOMRTInit.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim:set ts=4 sw=4 sts=4 ci et: */
-/* 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/Module.h"
-#include "mozilla/ModuleUtils.h"
-#include "mozilla/NullPtr.h"
-#include "mozilla/TimeStamp.h"
-#include "nsCategoryManager.h"
-#include "nsComponentManager.h"
-#include "nsDebugImpl.h"
-#include "nsIErrorService.h"
-#include "nsMemoryImpl.h"
-#include "nsObserverService.h"
-#include "nsThreadManager.h"
-#include "nsThreadPool.h"
-#include "nsUUIDGenerator.h"
-#include "nsXPCOMCIDInternal.h"
-#include "nsXPCOMPrivate.h"
-#include "TimerThread.h"
-#include "XPCOMRTInit.h"
-
-static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimerImpl)
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUUIDGenerator, Init)
-
-static nsresult
-nsThreadManagerGetSingleton(nsISupports* aOuter,
-                            const nsIID& aIID,
-                            void** aInstancePtr)
-{
-  NS_ASSERTION(aInstancePtr, "null outptr");
-  if (NS_WARN_IF(aOuter)) {
-    return NS_ERROR_NO_AGGREGATION;
-  }
-
-  return nsThreadManager::get()->QueryInterface(aIID, aInstancePtr);
-}
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsThreadPool)
-
-nsComponentManagerImpl* nsComponentManagerImpl::gComponentManager = nullptr;
-bool gXPCOMShuttingDown = false;
-bool gXPCOMThreadsShutDown = false;
-
-#define COMPONENT(NAME, Ctor) static NS_DEFINE_CID(kNS_##NAME##_CID, NS_##NAME##_CID);
-#include "XPCOMRTModule.inc"
-#undef COMPONENT
-
-#define COMPONENT(NAME, Ctor) { &kNS_##NAME##_CID, false, nullptr, Ctor },
-const mozilla::Module::CIDEntry kXPCOMCIDEntries[] = {
-  { &kComponentManagerCID, true, nullptr, nsComponentManagerImpl::Create },
-#include "XPCOMRTModule.inc"
-  { nullptr }
-};
-#undef COMPONENT
-
-#define COMPONENT(NAME, Ctor) { NS_##NAME##_CONTRACTID, &kNS_##NAME##_CID },
-const mozilla::Module::ContractIDEntry kXPCOMContracts[] = {
-#include "XPCOMRTModule.inc"
-  { nullptr }
-};
-#undef COMPONENT
-
-const mozilla::Module kXPCOMRTModule = {
-  mozilla::Module::kVersion, kXPCOMCIDEntries, kXPCOMContracts
-};
-
-nsresult
-NS_InitXPCOMRT()
-{
-  nsresult rv = NS_OK;
-
-  NS_SetMainThread();
-
-  mozilla::TimeStamp::Startup();
-
-  rv = nsThreadManager::get()->Init();
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  // Set up the timer globals/timer thread
-  rv = nsTimerImpl::Startup();
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  nsComponentManagerImpl::gComponentManager = new nsComponentManagerImpl();
-  NS_ADDREF(nsComponentManagerImpl::gComponentManager);
-
-  rv = nsComponentManagerImpl::gComponentManager->Init();
-  if (NS_FAILED(rv)) {
-    NS_RELEASE(nsComponentManagerImpl::gComponentManager);
-    return rv;
-  }
-
-  return NS_OK;
-}
-
-nsresult
-NS_ShutdownXPCOMRT()
-{
-  nsresult rv = NS_OK;
-
-  // Notify observers of xpcom shutting down
-  {
-    // Block it so that the COMPtr will get deleted before we hit
-    // servicemanager shutdown
-
-    nsCOMPtr<nsIThread> thread = do_GetCurrentThread();
-
-    if (NS_WARN_IF(!thread)) {
-      return NS_ERROR_UNEXPECTED;
-    }
-
-    nsRefPtr<nsObserverService> observerService;
-    CallGetService("@mozilla.org/observer-service;1",
-                     (nsObserverService**)getter_AddRefs(observerService));
-
-    if (observerService) {
-      observerService->NotifyObservers(nullptr,
-                                       NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID,
-                                       nullptr);
-
-      nsCOMPtr<nsIServiceManager> mgr;
-      rv = NS_GetServiceManager(getter_AddRefs(mgr));
-      if (NS_SUCCEEDED(rv)) {
-        observerService->NotifyObservers(mgr, NS_XPCOM_SHUTDOWN_OBSERVER_ID,
-                                         nullptr);
-      }
-    }
-
-    // This must happen after the shutdown of media and widgets, which
-    // are triggered by the NS_XPCOM_SHUTDOWN_OBSERVER_ID notification.
-    NS_ProcessPendingEvents(thread);
-
-    if (observerService)
-      observerService->NotifyObservers(nullptr,
-                                       NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID,
-                                       nullptr);
-
-    gXPCOMThreadsShutDown = true;
-    NS_ProcessPendingEvents(thread);
-
-    // Shutdown the timer thread and all timers that might still be alive before
-    // shutting down the component manager
-    nsTimerImpl::Shutdown();
-
-    NS_ProcessPendingEvents(thread);
-
-    // Shutdown all remaining threads.  This method does not return until
-    // all threads created using the thread manager (with the exception of
-    // the main thread) have exited.
-    nsThreadManager::get()->Shutdown();
-
-    NS_ProcessPendingEvents(thread);
-  }
-
-  mozilla::services::Shutdown();
-
-  // Shutdown global servicemanager
-  if (nsComponentManagerImpl::gComponentManager) {
-    nsComponentManagerImpl::gComponentManager->FreeServices();
-  }
-
-  // Shutdown xpcom. This will release all loaders and cause others holding
-  // a refcount to the component manager to release it.
-  if (nsComponentManagerImpl::gComponentManager) {
-    rv = (nsComponentManagerImpl::gComponentManager)->Shutdown();
-    NS_ASSERTION(NS_SUCCEEDED(rv), "Component Manager shutdown failed.");
-  } else {
-    NS_WARNING("Component Manager was never created ...");
-  }
-
-  // Finally, release the component manager last because it unloads the
-  // libraries:
-  if (nsComponentManagerImpl::gComponentManager) {
-    nsrefcnt cnt;
-    NS_RELEASE2(nsComponentManagerImpl::gComponentManager, cnt);
-    NS_ASSERTION(cnt == 0, "Component Manager being held past XPCOM shutdown.");
-  }
-  nsComponentManagerImpl::gComponentManager = nullptr;
-  nsCategoryManager::Destroy();
-
-  return NS_OK;
-}
deleted file mode 100644
--- a/xpcom/libxpcomrt/XPCOMRTInit.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim:set ts=4 sw=4 sts=4 ci et: */
-/* 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 XPCOMRT_INIT_H__
-#define XPCOMRT_INIT_H__
-
-#include "nsError.h"
-
-nsresult NS_InitXPCOMRT();
-nsresult NS_ShutdownXPCOMRT();
-
-#endif // define XPCOMRT_INIT_H__
deleted file mode 100644
--- a/xpcom/libxpcomrt/XPCOMRTModule.inc
+++ /dev/null
@@ -1,8 +0,0 @@
-    COMPONENT(MEMORY, nsMemoryImpl::Create)
-    COMPONENT(DEBUG,  nsDebugImpl::Create)
-    COMPONENT(CATEGORYMANAGER, nsCategoryManager::Create)
-    COMPONENT(OBSERVERSERVICE, nsObserverService::Create)
-    COMPONENT(TIMER, nsTimerImplConstructor)
-    COMPONENT(THREADMANAGER, nsThreadManagerGetSingleton)
-    COMPONENT(THREADPOOL, nsThreadPoolConstructor)
-    COMPONENT(UUID_GENERATOR, nsUUIDGeneratorConstructor)
deleted file mode 100644
--- a/xpcom/libxpcomrt/XPCOMRTStubs.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim:set ts=4 sw=4 sts=4 ci et: */
-/* 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 "nsXULAppAPI.h"
-#include "mozilla/TimeStamp.h"
-
-
-GeckoProcessType
-XRE_GetProcessType()
-{
-  return GeckoProcessType_Default;
-}
-
-#define PRINT_CALLED fprintf(stderr, "!!! ERROR: function %s defined in file %s should not be called, needs to be correctly implemented.\n", __FUNCTION__, __FILE__)
-
-class nsAString;
-class nsCString;
-
-namespace base {
-  class Histogram;
-}
-
-namespace mozilla {
-namespace Telemetry {
-
-#include "mozilla/TelemetryHistogramEnums.h"
-
-void Accumulate(ID id, uint32_t sample) {}
-void Accumulate(ID id, const nsCString& key, uint32_t sample) {}
-void Accumulate(const char* name, uint32_t sample) {}
-void AccumulateTimeDelta(ID id, TimeStamp start, TimeStamp end) {}
-
-base::Histogram* GetHistogramById(ID id)
-{
-  return nullptr;
-}
-
-base::Histogram* GetKeyedHistogramById(ID id, const nsAString&)
-{
-  return nullptr;
-}
-
-} // Telemetry
-} // mozilla
deleted file mode 100644
--- a/xpcom/libxpcomrt/docs/index.rst
+++ /dev/null
@@ -1,40 +0,0 @@
-==========================
- XPCOM Standalone Library
-==========================
-
-What it is for
---------------
-The XPCOM standalone library, libxpcomrt, was created to support building the WebRTC
-standalone library. The libxpcomrt library contains only the parts of XPCOM that are required
-to run WebRTC; parts such as the cycle collector and the startup cache required only by Gecko
-are not included. A library containing a small subset of Necko was also
-created to support the WebRTC standalone library.
-
-The libxcomrt library was created specifically to support the WebRTC standalone library.
-It is not intended to be used as a general purpose library to add XPCOM functionality to
-an application. It is likely that some of the code contained in the libxpcomrt library
-has unresolved symbols that may be exposed if used for purposes other than being linked
-into the WebRTC standalone library.
-
-How to use it
--------------
-When compiling code utilizing libxpcomrt, both ``MOZILLA_INTERNAL_API`` and ``MOZILLA_XPCOMRT_API``
-must be defined in addition to whatever standard flags are used to compile Gecko.
-The library is initialized with ``NS_InitXPCOMRT()`` and shutdown with ``NS_ShutdownXPCOMRT()``.
-Both functions are declared in xpcom/libxpcomrt/XPCOMRTInit.h.
-Only a small number of services which are required for the WebRTC
-standalone library to function are included with libxpcomrt. The dynamic loading of services is not
-supported. Including a service through ``NSMODULE_DEFN`` and static linking is also not supported.
-The only way to add a service to libxpcomrt is to explicitly start the service during
-``nsComponentManagerImpl::Init`` in xpcom/components/nsComponentManager.cpp.
-The best method to determine what parts of XPCOM are included in libxpcomrt is to examine the
-xpcom/libxpcomrt/moz.build file. It contains all of the XPCOM source files used to build libxpcomrt.
-A few of the services that are included are:
-
-* UUID Generator
-* DNS Service
-* Socket Transport Service
-* IDN Service
-
-All dependencies on ipc/chromium have been removed.
-IO and preference services are not included making this library of limited utility.
deleted file mode 100644
--- a/xpcom/libxpcomrt/moz.build
+++ /dev/null
@@ -1,153 +0,0 @@
-# -*- 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/.
-
-if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
-    Library('xpcomrt')
-
-src_list = [
-    'XPCOMRTInit.cpp',
-    'XPCOMRTStubs.cpp',
-]
-
-xpcom_base_src = [
-    'nsDebugImpl.cpp',
-    'nsMemoryImpl.cpp',
-    'nsUUIDGenerator.cpp',
-]
-src_list += [
-    '%s/xpcom/base/%s' % (TOPSRCDIR, s) for s in xpcom_base_src
-]
-
-xpcom_build_src = [
-    'FileLocation.cpp',
-    'Services.cpp',
-]
-src_list += [
-    '%s/xpcom/build/%s' % (TOPSRCDIR, s) for s in xpcom_build_src
-]
-
-xpcom_components_src = [
-    'nsCategoryManager.cpp',
-    'nsComponentManager.cpp',
-]
-src_list += [
-    '%s/xpcom/components/%s' % (TOPSRCDIR, s) for s in xpcom_components_src
-]
-
-xpcom_ds_src = [
-    'nsObserverList.cpp',
-    'nsObserverService.cpp',
-    'nsStringEnumerator.cpp',
-    'nsSupportsPrimitives.cpp',
-]
-if CONFIG['OS_ARCH'] == 'WINNT':
-    xpcom_ds_src += [
-        'TimeStamp_windows.cpp',
-    ]
-elif CONFIG['HAVE_CLOCK_MONOTONIC']:
-    xpcom_ds_src += [
-        'TimeStamp_posix.cpp',
-    ]
-elif CONFIG['OS_ARCH'] == 'Darwin':
-    xpcom_ds_src += [
-        'TimeStamp_darwin.cpp',
-    ]
-elif CONFIG['COMPILE_ENVIRONMENT']:
-    error('No TimeStamp implementation on this platform.  Build will not succeed')
-src_list += [
-    '%s/xpcom/ds/%s' % (TOPSRCDIR, s) for s in xpcom_ds_src
-]
-
-xpcom_glue_src = [
-    'BlockingResourceBase.cpp',
-    'nsArrayEnumerator.cpp',
-    'nsClassInfoImpl.cpp',
-    'nsCOMArray.cpp',
-    'nsCOMPtr.cpp',
-    'nsCRTGlue.cpp',
-    'nsComponentManagerUtils.cpp',
-    'nsEnumeratorUtils.cpp',
-    'GenericFactory.cpp',
-    'nsID.cpp',
-    'nsISupportsImpl.cpp',
-    'nsMemory.cpp',
-    'nsProxyRelease.cpp',
-    'nsQuickSort.cpp',
-    'nsTArray.cpp',
-    'nsTHashtable.cpp',
-    'nsTObserverArray.cpp',
-    'nsThreadUtils.cpp',
-    'nsWeakReference.cpp',
-    'pldhash.cpp',
-]
-src_list += [
-    '%s/xpcom/glue/%s' % (TOPSRCDIR, s) for s in xpcom_glue_src
-]
-
-xpcom_io_src = [
-    'nsNativeCharsetUtils.cpp',
-]
-src_list += [
-    '%s/xpcom/io/%s' % (TOPSRCDIR, s) for s in xpcom_io_src
-]
-
-xpcom_string_src = [
-    'nsDependentSubstring.cpp',
-    'nsPromiseFlatString.cpp',
-    'nsReadableUtils.cpp',
-    'nsString.cpp',
-    'nsStringComparator.cpp',
-    'nsStringObsolete.cpp',
-    'nsSubstring.cpp',
-    'nsSubstringTuple.cpp',
-]
-if CONFIG['INTEL_ARCHITECTURE']:
-    xpcom_string_src += ['nsUTF8UtilsSSE2.cpp']
-src_list += [
-    '%s/xpcom/string/%s' % (TOPSRCDIR, s) for s in xpcom_string_src
-]
-
-xpcom_threads_src = [
-    'LazyIdleThread.cpp',
-    'nsEnvironment.cpp',
-    'nsEventQueue.cpp',
-    'nsMemoryPressure.cpp',
-    'nsProcessCommon.cpp',
-    'nsThread.cpp',
-    'nsThreadManager.cpp',
-    'nsThreadPool.cpp',
-    'nsTimerImpl.cpp',
-    'TimerThread.cpp',
-]
-src_list += [
-    '%s/xpcom/threads/%s' % (TOPSRCDIR, s) for s in xpcom_threads_src
-]
-
-
-SOURCES += sorted(src_list)
-
-if CONFIG['INTEL_ARCHITECTURE']:
-    sse_string_path = '%s/xpcom/string/nsUTF8UtilsSSE2.cpp' % TOPSRCDIR
-    SOURCES[sse_string_path].flags += CONFIG['SSE2_FLAGS']
-
-GENERATED_INCLUDES += ['..']
-LOCAL_INCLUDES = [
-    '../base',
-    '../build',
-    '../components',
-    '../ds',
-    '../glue',
-    '../threads',
-    '/xpcom/reflect/xptinfo/',
-]
-
-DEFINES['MOZILLA_INTERNAL_API'] = True
-DEFINES['MOZILLA_XPCOMRT_API'] = True
-DEFINES['MOZILLA_EXTERNAL_LINKAGE'] = True
-
-include('/ipc/chromium/chromium-config.mozbuild')
-
-SPHINX_TREES['libxpcomrt'] = 'docs'
--- a/xpcom/moz.build
+++ b/xpcom/moz.build
@@ -19,17 +19,16 @@ DIRS += [
     'ds',
     'io',
     'components',
     'threads',
     'reflect',
     'system',
     '../chrome',
     'build',
-    'libxpcomrt',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_DEBUG']:
     DIRS += ['windbgdlg']
 
 TEST_DIRS += [
     'tests',
     'typelib/xpt/tests',
--- a/xpcom/string/nsSubstring.cpp
+++ b/xpcom/string/nsSubstring.cpp
@@ -109,19 +109,21 @@ static nsStringStats gStringStats;
 void
 ReleaseData(void* aData, uint32_t aFlags)
 {
   if (aFlags & nsSubstring::F_SHARED) {
     nsStringBuffer::FromData(aData)->Release();
   } else if (aFlags & nsSubstring::F_OWNED) {
     free(aData);
     STRING_STAT_INCREMENT(AdoptFree);
+#ifdef NS_BUILD_REFCNT_LOGGING
     // Treat this as destruction of a "StringAdopt" object for leak
     // tracking purposes.
-    MOZ_LOG_DTOR(aData, "StringAdopt", 1);
+    NS_LogDtor(aData, "StringAdopt", 1);
+#endif // NS_BUILD_REFCNT_LOGGING
   }
   // otherwise, nothing to do.
 }
 
 // ---------------------------------------------------------------------------
 
 // XXX or we could make nsStringBuffer be a friend of nsTAString
 
--- a/xpcom/string/nsTSubstring.cpp
+++ b/xpcom/string/nsTSubstring.cpp
@@ -13,17 +13,19 @@ using double_conversion::DoubleToStringC
 nsTSubstring_CharT::nsTSubstring_CharT(char_type* aData, size_type aLength,
                                        uint32_t aFlags)
   : mData(aData),
     mLength(aLength),
     mFlags(aFlags)
 {
   if (aFlags & F_OWNED) {
     STRING_STAT_INCREMENT(Adopt);
-    MOZ_LOG_CTOR(mData, "StringAdopt", 1);
+#ifdef NS_BUILD_REFCNT_LOGGING
+    NS_LogCtor(mData, "StringAdopt", 1);
+#endif
   }
 }
 #endif /* XPCOM_STRING_CONSTRUCTOR_OUT_OF_LINE */
 
 /**
  * helper function for down-casting a nsTSubstring to a nsTFixedString.
  */
 inline const nsTFixedString_CharT*
@@ -453,19 +455,21 @@ nsTSubstring_CharT::Adopt(char_type* aDa
       aLength = char_traits::length(aData);
     }
 
     mData = aData;
     mLength = aLength;
     SetDataFlags(F_TERMINATED | F_OWNED);
 
     STRING_STAT_INCREMENT(Adopt);
+#ifdef NS_BUILD_REFCNT_LOGGING
     // Treat this as construction of a "StringAdopt" object for leak
     // tracking purposes.
-    MOZ_LOG_CTOR(mData, "StringAdopt", 1);
+    NS_LogCtor(mData, "StringAdopt", 1);
+#endif // NS_BUILD_REFCNT_LOGGING
   } else {
     SetIsVoid(true);
   }
 }
 
 
 // This version of Replace is optimized for single-character replacement.
 void
--- a/xpcom/threads/LazyIdleThread.cpp
+++ b/xpcom/threads/LazyIdleThread.cpp
@@ -174,20 +174,18 @@ LazyIdleThread::EnsureThread()
   }
 
   return NS_OK;
 }
 
 void
 LazyIdleThread::InitThread()
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   char aLocal;
   profiler_register_thread(mName.get(), &aLocal);
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
   PR_SetCurrentThreadName(mName.get());
 
   // Happens on mThread but mThread may not be set yet...
 
   nsCOMPtr<nsIThreadInternal> thread(do_QueryInterface(NS_GetCurrentThread()));
   MOZ_ASSERT(thread, "This should always succeed!");
 
@@ -208,19 +206,17 @@ LazyIdleThread::CleanupThread()
 
   {
     MutexAutoLock lock(mMutex);
 
     MOZ_ASSERT(!mThreadIsShuttingDown, "Shouldn't be true ever!");
     mThreadIsShuttingDown = true;
   }
 
-#if !defined(MOZILLA_XPCOMRT_API)
   profiler_unregister_thread();
-#endif // !defined(MOZILLA_XPCOMRT_API)
 }
 
 void
 LazyIdleThread::ScheduleTimer()
 {
   ASSERT_OWNING_THREAD();
 
   bool shouldSchedule;
--- a/xpcom/threads/nsThread.cpp
+++ b/xpcom/threads/nsThread.cpp
@@ -1,44 +1,39 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsThread.h"
 
-#if !defined(MOZILLA_XPCOMRT_API)
 #include "base/message_loop.h"
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
 // Chromium's logging can sometimes leak through...
 #ifdef LOG
 #undef LOG
 #endif
 
 #include "nsMemoryPressure.h"
 #include "nsThreadManager.h"
 #include "nsIClassInfoImpl.h"
 #include "nsIProgrammingLanguage.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "pratom.h"
 #include "prlog.h"
 #include "nsIObserverService.h"
-#if !defined(MOZILLA_XPCOMRT_API)
 #include "mozilla/HangMonitor.h"
 #include "mozilla/IOInterposer.h"
 #include "mozilla/ipc/MessageChannel.h"
-#include "mozilla/ipc/BackgroundChild.h"
-#endif // defined(MOZILLA_XPCOMRT_API)
 #include "mozilla/Services.h"
 #include "nsXPCOMPrivate.h"
 #include "mozilla/ChaosMode.h"
-#include "mozilla/TimeStamp.h"
+#include "mozilla/ipc/BackgroundChild.h"
 
 #ifdef MOZ_CRASHREPORTER
 #include "nsServiceManagerUtils.h"
 #include "nsICrashReporter.h"
 #endif
 
 #ifdef XP_LINUX
 #include <sys/time.h>
@@ -265,19 +260,17 @@ public:
   nsThreadShutdownEvent(nsThread* aThr, nsThreadShutdownContext* aCtx)
     : mThread(aThr)
     , mShutdownContext(aCtx)
   {
   }
   NS_IMETHOD Run()
   {
     mThread->mShutdownContext = mShutdownContext;
-#if !defined(MOZILLA_XPCOMRT_API)
     MessageLoop::current()->Quit();
-#endif // !defined(MOZILLA_XPCOMRT_API)
     return NS_OK;
   }
 private:
   nsRefPtr<nsThread>       mThread;
   nsThreadShutdownContext* mShutdownContext;
 };
 
 //-----------------------------------------------------------------------------
@@ -318,59 +311,49 @@ SetupCurrentThreadForChaosMode()
     sched_setaffinity(0, sizeof(cpus), &cpus);
   }
 #endif
 }
 
 /*static*/ void
 nsThread::ThreadFunc(void* aArg)
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   using mozilla::ipc::BackgroundChild;
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
   nsThread* self = static_cast<nsThread*>(aArg);  // strong reference
   self->mThread = PR_GetCurrentThread();
   SetupCurrentThreadForChaosMode();
 
   // Inform the ThreadManager
   nsThreadManager::get()->RegisterCurrentThread(self);
 #ifdef MOZ_NUWA_PROCESS
   self->mThreadStatusInfo =
     static_cast<void*>(nsThreadManager::get()->GetCurrentThreadStatusInfo());
 #endif
 
-#if !defined(MOZILLA_XPCOMRT_API)
   mozilla::IOInterposer::RegisterCurrentThread();
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
   // Wait for and process startup event
   nsCOMPtr<nsIRunnable> event;
   if (!self->GetEvent(true, getter_AddRefs(event))) {
     NS_WARNING("failed waiting for thread startup event");
     return;
   }
   event->Run();  // unblocks nsThread::Init
   event = nullptr;
 
   {
-#if defined(MOZILLA_XPCOMRT_API)
-    while(!self->mShutdownContext) {
-      NS_ProcessNextEvent();
-    }
-#else
     // Scope for MessageLoop.
     nsAutoPtr<MessageLoop> loop(
       new MessageLoop(MessageLoop::TYPE_MOZILLA_NONMAINTHREAD));
 
     // Now, process incoming events...
     loop->Run();
 
     BackgroundChild::CloseForCurrentThread();
-#endif // defined(MOZILLA_XPCOMRT_API)
 
     // Do NS_ProcessPendingEvents but with special handling to set
     // mEventsAreDoomed atomically with the removal of the last event. The key
     // invariant here is that we will never permit PutEvent to succeed if the
     // event would be left in the queue after our final call to
     // NS_ProcessPendingEvents.
     while (true) {
       {
@@ -383,19 +366,17 @@ nsThread::ThreadFunc(void* aArg)
           self->mEventsAreDoomed = true;
           break;
         }
       }
       NS_ProcessPendingEvents(self);
     }
   }
 
-#if !defined(MOZILLA_XPCOMRT_API)
   mozilla::IOInterposer::UnregisterCurrentThread();
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
   // Inform the threadmanager that this thread is going away
   nsThreadManager::get()->UnregisterCurrentThread(self);
 
   // Dispatch shutdown ACK
   event = new nsThreadShutdownAckEvent(self->mShutdownContext);
   self->mShutdownContext->joiningThread->Dispatch(event, NS_DISPATCH_NORMAL);
 
@@ -757,41 +738,37 @@ void canary_alarm_handler(int signum)
     }                                                                          \
   PR_END_MACRO
 
 NS_IMETHODIMP
 nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
 {
   LOG(("THRD(%p) ProcessNextEvent [%u %u]\n", this, aMayWait, mRunningEvent));
 
-#if !defined(MOZILLA_XPCOMRT_API)
   // If we're on the main thread, we shouldn't be dispatching CPOWs.
   MOZ_RELEASE_ASSERT(mIsMainThread != MAIN_THREAD ||
                      !ipc::ParentProcessIsBlocked());
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
   if (NS_WARN_IF(PR_GetCurrentThread() != mThread)) {
     return NS_ERROR_NOT_SAME_THREAD;
   }
 
   // The toplevel event loop normally blocks waiting for the next event, but
   // if we're trying to shut this thread down, we must exit the event loop when
   // the event queue is empty.
   // This only applys to the toplevel event loop! Nested event loops (e.g.
   // during sync dispatch) are waiting for some state change and must be able
   // to block even if something has requested shutdown of the thread. Otherwise
   // we'll just busywait as we endlessly look for an event, fail to find one,
   // and repeat the nested event loop since its state change hasn't happened yet.
   bool reallyWait = aMayWait && (mRunningEvent > 0 || !ShuttingDown());
 
-#if !defined(MOZILLA_XPCOMRT_API)
   if (MAIN_THREAD == mIsMainThread && reallyWait) {
     HangMonitor::Suspend();
   }
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
   // Fire a memory pressure notification, if we're the main thread and one is
   // pending.
   if (MAIN_THREAD == mIsMainThread && !ShuttingDown()) {
     MemoryPressureState mpPending = NS_GetPendingMemoryPressure();
     if (mpPending != MemPressure_None) {
       nsCOMPtr<nsIObserverService> os = services::GetObserverService();
 
@@ -860,21 +837,19 @@ nsThread::ProcessNextEvent(bool aMayWait
     // If we are shutting down, then do not wait for new events.
     nsCOMPtr<nsIRunnable> event;
     mEvents->GetEvent(reallyWait, getter_AddRefs(event));
 
     *aResult = (event.get() != nullptr);
 
     if (event) {
       LOG(("THRD(%p) running [%p]\n", this, event.get()));
-#if !defined(MOZILLA_XPCOMRT_API)
       if (MAIN_THREAD == mIsMainThread) {
         HangMonitor::NotifyActivity();
       }
-#endif // !defined(MOZILLA_XPCOMRT_API)
       event->Run();
     } else if (aMayWait) {
       MOZ_ASSERT(ShuttingDown(),
                  "This should only happen when shutting down");
       rv = NS_ERROR_UNEXPECTED;
     }
   }
 
--- a/xpcom/threads/nsTimerImpl.cpp
+++ b/xpcom/threads/nsTimerImpl.cpp
@@ -561,20 +561,18 @@ nsTimerImpl::Fire()
 
 #ifdef MOZ_NUWA_PROCESS
   if (IsNuwaProcess() && IsNuwaReady()) {
     // A timer event fired after Nuwa frozen can freeze main thread.
     return;
   }
 #endif
 
-#if !defined(MOZILLA_XPCOMRT_API)
   PROFILER_LABEL("Timer", "Fire",
                  js::ProfileEntry::Category::OTHER);
-#endif
 
 #ifdef MOZ_TASK_TRACER
   // mTracedTask is an instance of FakeTracedTask created by
   // DispatchTracedTask(). AutoRunFakeTracedTask logs the begin/end time of the
   // timer/FakeTracedTask instance in ctor/dtor.
   mozilla::tasktracer::AutoRunFakeTracedTask runTracedTask(mTracedTask);
 #endif