Bug 1251482 - Remove remaining references to MOZILLA_XPCOMRT_API from xpcom. r=froydnj
☠☠ backed out by 22424f6eeb30 ☠ ☠
authorEric Rahm <erahm@mozilla.com>
Fri, 26 Feb 2016 15:31:19 -0800
changeset 322239 9e33adec1aa6ad104fda36cd417d33043fe47a08
parent 322238 ab0347657e25475064c29a193d5505075500901a
child 322240 f064a5efbb8c8d40bebef0ff0f142cc17ea40ad5
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1251482
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1251482 - Remove remaining references to MOZILLA_XPCOMRT_API from xpcom. r=froydnj
xpcom/base/Logging.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/nsObserverService.cpp
xpcom/glue/BlockingResourceBase.cpp
xpcom/glue/nsISupportsImpl.h
xpcom/threads/LazyIdleThread.cpp
xpcom/threads/nsThread.cpp
xpcom/threads/nsTimerImpl.cpp
--- a/xpcom/base/Logging.h
+++ b/xpcom/base/Logging.h
@@ -60,22 +60,17 @@ public:
 
   /**
    * Retrieves the module with the given name. If it does not already exist
    * it will be created.
    *
    * @param aName The name of the module.
    * @return A log module for the given name. This may be shared.
    */
-#if !defined(MOZILLA_XPCOMRT_API)
   static LogModule* Get(const char* aName);
-#else
-  // For simplicity, libxpcomrt doesn't supoort logging.
-  static LogModule* Get(const char* aName) { return nullptr; }
-#endif
 
   static void Init();
 
   /**
    * Indicates whether or not the given log level is enabled.
    */
   bool ShouldLog(LogLevel aLevel) const { return mLevel >= aLevel; }
 
@@ -171,23 +166,19 @@ void log_print(const PRLogModuleInfo* aM
                       LogLevel aLevel,
                       const char* aFmt, ...);
 
 inline bool log_test(const LogModule* module, LogLevel level) {
   MOZ_ASSERT(level != LogLevel::Disabled);
   return module && module->ShouldLog(level);
 }
 
-#if !defined(MOZILLA_XPCOMRT_API)
 void log_print(const LogModule* aModule,
                LogLevel aLevel,
                const char* aFmt, ...);
-#else
-inline void log_print(const LogModule* aModule, LogLevel aLevel, const char* aFmt, ...) {}
-#endif
 } // namespace detail
 
 } // namespace mozilla
 
 
 #define MOZ_LOG_TEST(_module,_level) mozilla::detail::log_test(_module, _level)
 
 // Helper macro used convert MOZ_LOG's third parameter, |_args|, from a
--- a/xpcom/base/nsDebugImpl.cpp
+++ b/xpcom/base/nsDebugImpl.cpp
@@ -328,19 +328,18 @@ 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);
@@ -376,34 +375,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_IsParentProcess()) {
         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)
+#if defined(DEBUG)
       nsTraceRefcnt::WalkTheStack(stderr);
 #endif
       Abort(buf.buffer);
       return;
     }
   }
 
   // Now we deal with assertions
@@ -418,25 +417,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
       MOZ_FALLTHROUGH;
 
     case NS_ASSERT_ABORT:
       Abort(buf.buffer);
       return;
 
     case NS_ASSERT_TRAP:
@@ -598,13 +593,13 @@ 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)
+#if defined(MOZ_CRASHREPORTER)
   CrashReporter::AnnotateOOMAllocationSize(aSize);
 #endif
   MOZ_CRASH();
 }
--- a/xpcom/base/nsIMemoryReporter.idl
+++ b/xpcom/base/nsIMemoryReporter.idl
@@ -510,17 +510,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)
 #if !defined(MOZ_MEMORY)
 #error "MOZ_DMD requires MOZ_MEMORY"
 #endif
 
 #include "DMD.h"
 
 #define MOZ_REPORT(ptr)          mozilla::dmd::Report(ptr)
 #define MOZ_REPORT_ON_ALLOC(ptr) mozilla::dmd::ReportOnAlloc(ptr)
--- a/xpcom/build/FileLocation.cpp
+++ b/xpcom/build/FileLocation.cpp
@@ -1,19 +1,17 @@
 /* -*- 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 "FileLocation.h"
-#if !defined(MOZILLA_XPCOMRT_API)
 #include "nsZipArchive.h"
 #include "nsURLHelper.h"
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
 namespace mozilla {
 
 FileLocation::FileLocation()
 {
 }
 
 FileLocation::~FileLocation()
@@ -31,21 +29,19 @@ FileLocation::FileLocation(nsIFile* aFil
 }
 
 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 {
       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;
@@ -73,73 +69,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) {
     RefPtr<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) {
     RefPtr<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
 {
@@ -149,47 +135,43 @@ 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) {
     RefPtr<nsZipHandle> handler = a->mBaseZip->GetFD();
     a = &handler->mFile;
   }
   if (b->mBaseZip) {
     RefPtr<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;
@@ -199,22 +181,20 @@ 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) {
     *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;) {
@@ -222,25 +202,23 @@ FileLocation::Data::Copy(char* aBuf, uin
                              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) {
     nsZipCursor cursor(mItem, mZip, reinterpret_cast<uint8_t*>(aBuf),
                        aLen, true);
     uint32_t readLen;
     cursor.Copy(&readLen);
     if (readLen != aLen) {
       nsZipArchive::sFileCorruptedReason = "FileLocation::Data: insufficient data";
       return NS_ERROR_FILE_CORRUPTED;
     }
     return NS_OK;
   }
-#endif // !defined(MOZILLA_XPCOMRT_API)
   return NS_ERROR_NOT_INITIALIZED;
 }
 
 } /* namespace mozilla */
--- a/xpcom/build/FileLocation.h
+++ b/xpcom/build/FileLocation.h
@@ -84,21 +84,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)
-  explicit operator bool() const { return mBaseFile; }
-#else
   explicit 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.
@@ -112,31 +108,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)
     RefPtr<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)
   RefPtr<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,34 +1,31 @@
 /* -*- 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/. */
 // 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");
@@ -46,9 +43,8 @@ namespace mozilla {
 #endif
 
 MOZ_SERVICE(HistoryService, IHistory,
             "@mozilla.org/browser/history;1")
 
 #ifdef MOZ_USE_NAMESPACE
 } // namespace mozilla
 #endif
-#endif // !defined(MOZILLA_XPCOMRT_API)
--- a/xpcom/build/Services.cpp
+++ b/xpcom/build/Services.cpp
@@ -6,17 +6,16 @@
 
 #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 "nsIStringBundle.h"
 #include "nsIToolkitChromeRegistry.h"
@@ -24,17 +23,16 @@
 #include "IHistory.h"
 #include "nsIXPConnect.h"
 #include "inIDOMUtils.h"
 #include "nsIPermissionManager.h"
 #include "nsIServiceWorkerManager.h"
 #include "nsIAsyncShutdown.h"
 #include "nsIUUIDGenerator.h"
 #include "nsIGfxInfo.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
@@ -3,19 +3,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"
 
 void ParseManifest(NSLocationType aType, mozilla::FileLocation& aFile,
                    char* aBuf, bool aChromeOnly, bool aXPTOnly = false);
 
 void LogMessage(const char* aMsg, ...);
 
 void LogMessageWithContext(mozilla::FileLocation& aFile,
--- a/xpcom/components/nsCategoryManager.cpp
+++ b/xpcom/components/nsCategoryManager.cpp
@@ -413,19 +413,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();
@@ -800,29 +798,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,20 +53,18 @@
 #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"
@@ -249,17 +247,16 @@ public:
 
 private:
   SafeMutex& mMutex;
   bool mLocked;
 };
 
 } // 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));
@@ -286,17 +283,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)
@@ -319,43 +315,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()
 {
@@ -369,47 +361,36 @@ nsComponentManagerImpl::InitializeModule
 nsresult
 nsComponentManagerImpl::Init()
 {
   PR_ASSERT(NOT_INITIALIZED == mStatus);
 
   // 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);
-  RegisterModule(&kNeckoStandaloneModule, nullptr);
-  RegisterModule(&kStunUDPSocketFilterHandlerModule, 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();
@@ -458,17 +439,16 @@ nsComponentManagerImpl::Init()
   // We can't initialize the preference watcher when the log module manager is
   // initialized, as a number of things attempt to start logging before the
   // preference system is initialized.
   //
   // The preference system is registered as a component so at this point during
   // component manager initialization we know it is setup and we can register
   // for notifications.
   LogModulePrefWatcher::RegisterPrefWatcher();
-#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();
 
   MOZ_LOG(nsComponentManagerLog, LogLevel::Debug,
@@ -567,22 +547,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
@@ -598,29 +576,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);
@@ -853,30 +828,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;
@@ -923,38 +895,34 @@ nsresult nsComponentManagerImpl::Shutdow
   PR_ASSERT(NORMAL == mStatus);
 
   mStatus = SHUTDOWN_IN_PROGRESS;
 
   // Shutdown the component manager
   MOZ_LOG(nsComponentManagerLog, LogLevel::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;
 
   MOZ_LOG(nsComponentManagerLog, LogLevel::Debug,
          ("nsComponentManager: Shutdown complete."));
@@ -1615,34 +1583,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) {
@@ -1705,22 +1671,18 @@ nsComponentManagerImpl::UnregisterFactor
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsComponentManagerImpl::AutoRegister(nsIFile* aLocation)
 {
-#if !defined(MOZILLA_XPCOMRT_API)
   XRE_AddManifestLocation(NS_EXTENSION_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;
 }
@@ -2028,39 +1990,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);
@@ -2080,25 +2037,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();
@@ -2112,19 +2065,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)
@@ -2163,17 +2113,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);
@@ -2204,10 +2153,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
@@ -64,23 +64,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;
-extern const mozilla::Module kNeckoStandaloneModule;
-extern const mozilla::Module kStunUDPSocketFilterHandlerModule;
-#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/nsObserverService.cpp
+++ b/xpcom/ds/nsObserverService.cpp
@@ -167,27 +167,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,
@@ -317,24 +313,22 @@ NS_IMETHODIMP nsObserverService::NotifyO
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsObserverService::UnmarkGrayStrongObservers()
 {
   NS_ENSURE_VALIDCALL
 
-#if !defined(MOZILLA_XPCOMRT_API)
   nsCOMArray<nsIObserver> strongObservers;
   for (auto iter = mObserverTopicTable.Iter(); !iter.Done(); iter.Next()) {
     nsObserverList* aObserverList = iter.Get();
     if (aObserverList) {
       aObserverList->AppendStrongObservers(strongObservers);
     }
   }
 
   for (uint32_t i = 0; i < strongObservers.Length(); ++i) {
     xpc_TryUnmarkWrappedGrayObject(strongObservers[i]);
   }
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
   return NS_OK;
 }
--- 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)
+#if defined(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)
+#if defined(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)
+#if defined(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
@@ -123,17 +123,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)
+#if defined(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"
--- 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,19 +1,17 @@
 /* -*- 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 "mozilla/ReentrantMonitor.h"
 #include "nsMemoryPressure.h"
@@ -21,22 +19,20 @@
 #include "nsIClassInfoImpl.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsQueryObject.h"
 #include "pratom.h"
 #include "mozilla/CycleCollectedJSRuntime.h"
 #include "mozilla/Logging.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/unused.h"
 #include "nsThreadSyncDispatch.h"
 #include "LeakRefPtr.h"
 
@@ -292,19 +288,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:
   RefPtr<nsThread>       mThread;
   nsThreadShutdownContext* mShutdownContext;
 };
 
 //-----------------------------------------------------------------------------
@@ -365,58 +359,48 @@ SetupCurrentThreadForChaosMode()
   if (ChaosMode::randomUint32LessThan(2)) {
     SetThreadAffinity(0);
   }
 }
 
 /*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);
 
-#if !defined(MOZILLA_XPCOMRT_API)
   mozilla::IOInterposer::RegisterCurrentThread();
-#endif // !defined(MOZILLA_XPCOMRT_API)
 
   // Wait for and process startup event
   nsCOMPtr<nsIRunnable> event;
   {
     MutexAutoLock lock(self->mLock);
     if (!self->mEvents->GetEvent(true, getter_AddRefs(event), lock)) {
       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)
 
     // NB: The main thread does not shut down here!  It shuts down via
     // nsThreadManager::Shutdown.
 
     // 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
@@ -436,19 +420,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
   MOZ_ASSERT(self->mShutdownContext->terminatingThread == self);
   event = do_QueryObject(new nsThreadShutdownAckEvent(self->mShutdownContext));
   self->mShutdownContext->joiningThread->Dispatch(event, NS_DISPATCH_NORMAL);
@@ -900,42 +882,38 @@ 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,
        mNestedEventLoopDepth));
 
-#if !defined(MOZILLA_XPCOMRT_API)
   // If we're on the main thread, we shouldn't be dispatching CPOWs.
   if (mIsMainThread == MAIN_THREAD) {
     ipc::CancelCPOWs();
   }
-#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 && (mNestedEventLoopDepth > 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();
 
@@ -1005,21 +983,19 @@ nsThread::ProcessNextEvent(bool aMayWait
       MutexAutoLock lock(mLock);
       mEvents->GetEvent(reallyWait, getter_AddRefs(event), lock);
     }
 
     *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
@@ -459,20 +459,18 @@ nsTimerImpl::SetTarget(nsIEventTarget* a
 
 void
 nsTimerImpl::Fire()
 {
   if (mCanceled) {
     return;
   }
 
-#if !defined(MOZILLA_XPCOMRT_API)
   PROFILER_LABEL("Timer", "Fire",
                  js::ProfileEntry::Category::OTHER);
-#endif
 
   TimeStamp now = TimeStamp::Now();
   if (MOZ_LOG_TEST(GetTimerLog(), LogLevel::Debug)) {
     TimeDuration   a = now - mStart; // actual delay in intervals
     TimeDuration   b = TimeDuration::FromMilliseconds(mDelay); // expected delay in intervals
     TimeDuration   delta = (a > b) ? a - b : b - a;
     uint32_t       d = delta.ToMilliseconds(); // delta in ms
     sDeltaSum += d;