Bug 918105 - Minimize the #includes in xpcom/ds; r=bsmedberg
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 19 Sep 2013 15:31:21 -0400
changeset 161795 b0d8ceeede143feb79da2ab69bbd06268621dd3a
parent 161794 ae180b16eda7b404086e25aa9924c6879c573040
child 161796 01e5e4697b36bc746c8a8c820370ba6448708a9b
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs918105
milestone27.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 918105 - Minimize the #includes in xpcom/ds; r=bsmedberg
modules/libjar/nsJARProtocolHandler.cpp
xpcom/ds/TimeStamp.h
xpcom/ds/TimeStamp_darwin.cpp
xpcom/ds/TimeStamp_posix.cpp
xpcom/ds/nsArray.cpp
xpcom/ds/nsAtomTable.cpp
xpcom/ds/nsAtomTable.h
xpcom/ds/nsCRT.cpp
xpcom/ds/nsCRT.h
xpcom/ds/nsHashPropertyBag.cpp
xpcom/ds/nsHashPropertyBag.h
xpcom/ds/nsHashtable.cpp
xpcom/ds/nsHashtable.h
xpcom/ds/nsINIParserImpl.cpp
xpcom/ds/nsObserverService.cpp
xpcom/ds/nsPersistentProperties.cpp
xpcom/ds/nsPersistentProperties.h
xpcom/ds/nsProperties.cpp
xpcom/ds/nsProperties.h
xpcom/ds/nsStaticNameTable.cpp
xpcom/ds/nsStaticNameTable.h
xpcom/ds/nsStringEnumerator.cpp
xpcom/ds/nsStringEnumerator.h
xpcom/ds/nsSupportsArray.cpp
xpcom/ds/nsSupportsPrimitives.cpp
xpcom/ds/nsSupportsPrimitives.h
xpcom/ds/nsVariant.cpp
xpcom/ds/nsVariant.h
--- a/modules/libjar/nsJARProtocolHandler.cpp
+++ b/modules/libjar/nsJARProtocolHandler.cpp
@@ -16,16 +16,17 @@
 #include "nsString.h"
 #include "nsNetCID.h"
 #include "nsIMIMEService.h"
 #include "nsMimeTypes.h"
 #include "nsIRemoteOpenFileListener.h"
 #include "nsIHashable.h"
 #include "nsThreadUtils.h"
 #include "nsXULAppAPI.h"
+#include "nsTArray.h"
 
 static NS_DEFINE_CID(kZipReaderCacheCID, NS_ZIPREADERCACHE_CID);
 
 #define NS_JAR_CACHE_SIZE 32
 
 //-----------------------------------------------------------------------------
 
 nsJARProtocolHandler *gJarHandler = nullptr;
--- a/xpcom/ds/TimeStamp.h
+++ b/xpcom/ds/TimeStamp.h
@@ -2,21 +2,20 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_TimeStamp_h
 #define mozilla_TimeStamp_h
 
+#include <stdint.h>
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
-
-#include "prinrval.h"
-#include "nsDebug.h"
+#include "nscore.h"
 
 namespace IPC {
 template <typename T> struct ParamTraits;
 }
 
 #ifdef XP_WIN
 // defines TimeStampValue as a complex value keeping both
 // GetTickCount and QueryPerformanceCounter values
@@ -256,17 +255,17 @@ public:
   static void RecordProcessRestart();
 
   /**
    * Compute the difference between two timestamps. Both must be non-null.
    */
   TimeDuration operator-(const TimeStamp& aOther) const {
     MOZ_ASSERT(!IsNull(), "Cannot compute with a null value");
     MOZ_ASSERT(!aOther.IsNull(), "Cannot compute with aOther null value");
-    PR_STATIC_ASSERT(-INT64_MAX > INT64_MIN);
+    static_assert(-INT64_MAX > INT64_MIN, "int64_t sanity check");
     int64_t ticks = int64_t(mValue - aOther.mValue);
     // Check for overflow.
     if (mValue > aOther.mValue) {
       if (ticks < 0) {
         ticks = INT64_MAX;
       }
     } else {
       if (ticks > 0) {
--- a/xpcom/ds/TimeStamp_darwin.cpp
+++ b/xpcom/ds/TimeStamp_darwin.cpp
@@ -12,24 +12,22 @@
 //
 // This code is inspired by Chromium's time_mac.cc. The biggest
 // differences are that we explicitly initialize using
 // TimeStamp::Initialize() instead of lazily in Now() and that
 // we store the time value in ticks and convert when needed instead
 // of storing the time value in nanoseconds.
 
 #include <mach/mach_time.h>
-#include <sys/param.h>
 #include <sys/time.h>
 #include <sys/sysctl.h>
 #include <time.h>
 
 #include "mozilla/TimeStamp.h"
-#include "nsCRT.h"
-#include "prprf.h"
+#include "nsDebug.h"
 
 // Estimate of the smallest duration of time we can measure.
 static uint64_t sResolution;
 static uint64_t sResolutionSigDigs;
 
 static const uint64_t kNsPerMs   =    1000000;
 static const uint64_t kUsPerSec  =    1000000;
 static const uint64_t kNsPerSec  = 1000000000;
--- a/xpcom/ds/TimeStamp_posix.cpp
+++ b/xpcom/ds/TimeStamp_posix.cpp
@@ -45,16 +45,17 @@
 #define KP_START_SEC p_ustart_sec
 #define KP_START_USEC p_ustart_usec
 #endif
 
 #include "mozilla/TimeStamp.h"
 #include "nsCRT.h"
 #include "prprf.h"
 #include "prthread.h"
+#include "nsDebug.h"
 
 // Estimate of the smallest duration of time we can measure.
 static uint64_t sResolution;
 static uint64_t sResolutionSigDigs;
 
 static const uint16_t kNsPerUs   =       1000;
 static const uint64_t kNsPerMs   =    1000000;
 static const uint64_t kNsPerSec  = 1000000000; 
--- a/xpcom/ds/nsArray.cpp
+++ b/xpcom/ds/nsArray.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsArray.h"
 #include "nsArrayEnumerator.h"
-#include "nsWeakReference.h"
+#include "nsIWeakReference.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsThreadUtils.h"
 
 // used by IndexOf()
 struct findIndexOfClosure
 {
     nsISupports *targetElement;
     uint32_t startIndex;
     uint32_t resultIndex;
--- a/xpcom/ds/nsAtomTable.cpp
+++ b/xpcom/ds/nsAtomTable.cpp
@@ -6,31 +6,26 @@
 
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/HashFunctions.h"
 #include "mozilla/MemoryReporting.h"
 
 #include "nsAtomTable.h"
 #include "nsStaticAtom.h"
-#include "nsString.h"
-#include "nsReadableUtils.h"
-#include "nsUTF8Utils.h"
+#include "nsStringGlue.h"
 #include "nsCRT.h"
 #include "pldhash.h"
 #include "prenv.h"
 #include "nsThreadUtils.h"
 #include "nsDataHashtable.h"
 #include "nsHashKeys.h"
 #include "nsAutoPtr.h"
 #include "nsUnicharUtils.h"
 
-#define PL_ARENA_CONST_ALIGN_MASK 3
-#include "plarena.h"
-
 using namespace mozilla;
 
 /**
  * The shared hash table for atom lookups.
  *
  * XXX This should be manipulated in a threadsafe way or we should make
  * sure it's only manipulated from the main thread.  Probably the latter
  * is better, since the former would hurt performance.
--- a/xpcom/ds/nsAtomTable.h
+++ b/xpcom/ds/nsAtomTable.h
@@ -2,16 +2,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/. */
 
 #ifndef nsAtomTable_h__
 #define nsAtomTable_h__
 
 #include "mozilla/MemoryReporting.h"
-#include <stdlib.h>
-#include "nscore.h"
+#include <stddef.h>
 
 void NS_PurgeAtomTable();
 
 size_t NS_SizeOfAtomTablesIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
 
 #endif // nsAtomTable_h__
--- a/xpcom/ds/nsCRT.cpp
+++ b/xpcom/ds/nsCRT.cpp
@@ -15,19 +15,17 @@
  * us to fail.
  *
  * In general, if you pass a null into any of these string compare
  * routines, we simply return 0.
  */
 
 
 #include "nsCRT.h"
-#include "nsIServiceManager.h"
-#include "nsCharTraits.h"
-#include "nsUTF8Utils.h"
+#include "nsDebug.h"
 
 //----------------------------------------------------------------------
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // My lovely strtok routine
 
 #define IS_DELIM(m, c)          ((m)[(c) >> 3] & (1 << ((c) & 7)))
--- a/xpcom/ds/nsCRT.h
+++ b/xpcom/ds/nsCRT.h
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #ifndef nsCRT_h___
 #define nsCRT_h___
 
 #include <stdlib.h>
-#include <string.h>
 #include <ctype.h>
 #include "plstr.h"
 #include "nscore.h"
 #include "nsCRTGlue.h"
 
 #if defined(XP_WIN) || defined(XP_OS2)
 #  define NS_LINEBREAK           "\015\012"
 #  define NS_LINEBREAK_LEN       2
--- a/xpcom/ds/nsHashPropertyBag.cpp
+++ b/xpcom/ds/nsHashPropertyBag.cpp
@@ -2,17 +2,16 @@
 /* vim:set ts=4 sw=4 sts=4: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsHashPropertyBag.h"
 #include "nsArray.h"
 #include "nsArrayEnumerator.h"
-#include "nsComponentManagerUtils.h"
 #include "nsIVariant.h"
 #include "nsIProperty.h"
 #include "nsVariant.h"
 #include "mozilla/Attributes.h"
 
 nsresult
 NS_NewHashPropertyBag(nsIWritablePropertyBag* *_retval)
 {
--- a/xpcom/ds/nsHashPropertyBag.h
+++ b/xpcom/ds/nsHashPropertyBag.h
@@ -1,19 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsHashPropertyBag_h___
 #define nsHashPropertyBag_h___
 
-#include "nsCOMPtr.h"
-#include "nsCOMArray.h"
-
 #include "nsIVariant.h"
 #include "nsIWritablePropertyBag.h"
 #include "nsIWritablePropertyBag2.h"
 #include "nsInterfaceHashtable.h"
 
 class nsHashPropertyBag : public nsIWritablePropertyBag
                                , public nsIWritablePropertyBag2
 {
--- a/xpcom/ds/nsHashtable.cpp
+++ b/xpcom/ds/nsHashtable.cpp
@@ -10,23 +10,22 @@
  * Modifications to Mozilla code or documentation
  * identified per MPL Section 3.3
  *
  * Date         Modified by     Description of modification
  * 04/20/2000   IBM Corp.       Added PR_CALLBACK for Optlink use in OS2
  */
 
 #include <string.h>
-#include "pratom.h"
 #include "prlog.h"
+#include "prlock.h"
 #include "nsHashtable.h"
-#include "nsReadableUtils.h"
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
-#include "nsCRT.h"
+#include "nsCRTGlue.h"
 #include "mozilla/HashFunctions.h"
 
 using namespace mozilla;
 
 struct HTEntry : PLDHashEntryHdr
 {
     nsHashKey* key;
     void* value;
--- a/xpcom/ds/nsHashtable.h
+++ b/xpcom/ds/nsHashtable.h
@@ -18,25 +18,23 @@
  * nsHashtable is OBSOLETE. Use nsTHashtable or a derivative instead.
  */
 
 #ifndef nsHashtable_h__
 #define nsHashtable_h__
 
 #include "pldhash.h"
 #include "nscore.h"
-#include "nsString.h"
-#include "nsISupportsBase.h"
+#include "nsISupports.h"
 #include "nsTraceRefcnt.h"
+#include "nsStringFwd.h"
 
 class nsIObjectInputStream;
 class nsIObjectOutputStream;
 
-class nsHashtable;
-class nsStringKey;
 struct PRLock;
 
 class nsHashKey {
   protected:
     nsHashKey(void) {
 #ifdef DEBUG
         mKeyType = UnknownKey;
 #endif
@@ -152,18 +150,16 @@ class nsObjectHashtable : public nsHasht
     void*                       mCloneElementClosure;
     nsHashtableEnumFunc         mDestroyElementFun;
     void*                       mDestroyElementClosure;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsSupportsHashtable: an nsHashtable where the elements are nsISupports*
 
-class nsISupports;
-
 class nsSupportsHashtable
   : private nsHashtable
 {
   public:
     nsSupportsHashtable(uint32_t aSize = 16, bool threadSafe = false)
       : nsHashtable(aSize, threadSafe) {}
     ~nsSupportsHashtable();
 
@@ -189,18 +185,16 @@ class nsSupportsHashtable
     static PLDHashOperator EnumerateCopy(PLDHashTable*,
                                          PLDHashEntryHdr* hdr,
                                          uint32_t i, void *arg);
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsISupportsKey: Where keys are nsISupports objects that get refcounted.
 
-#include "nsISupports.h"
-
 class nsISupportsKey : public nsHashKey {
   protected:
     nsISupports* mKey;
     
   public:
     nsISupportsKey(const nsISupportsKey& aKey) : mKey(aKey.mKey) {
 #ifdef DEBUG
         mKeyType = SupportsKey;
@@ -296,18 +290,16 @@ class nsVoidKey : public nsHashKey {
 
     nsHashKey *Clone() const {
         return new nsVoidKey(mKey);
     }
 
     void* GetValue() { return mKey; }
 };
 
-#include "nsString.h"
-
 // for null-terminated c-strings
 class nsCStringKey : public nsHashKey {
   public:
 
     // NB: when serializing, NEVER_OWN keys are deserialized as OWN.
     enum Ownership {
         NEVER_OWN,  // very long lived, even clones don't need to copy it.
         OWN_CLONE,  // as long lived as this key. But clones make a copy.
--- a/xpcom/ds/nsINIParserImpl.cpp
+++ b/xpcom/ds/nsINIParserImpl.cpp
@@ -1,16 +1,14 @@
 /* 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 "nsINIParserImpl.h"
 
-#include "nsIFile.h"
-
 #include "nsINIParser.h"
 #include "nsStringEnumerator.h"
 #include "nsTArray.h"
 #include "mozilla/Attributes.h"
 
 class nsINIParserImpl MOZ_FINAL :
   public nsIINIParser
 {
--- a/xpcom/ds/nsObserverService.cpp
+++ b/xpcom/ds/nsObserverService.cpp
@@ -1,26 +1,20 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "prlog.h"
 #include "nsAutoPtr.h"
-#include "nsIFactory.h"
-#include "nsIServiceManager.h"
-#include "nsIComponentManager.h"
 #include "nsIObserverService.h"
 #include "nsIObserver.h"
-#include "nsISimpleEnumerator.h"
 #include "nsObserverService.h"
 #include "nsObserverList.h"
-#include "nsHashtable.h"
 #include "nsThreadUtils.h"
-#include "nsIWeakReference.h"
 #include "nsEnumeratorUtils.h"
 #include "nsIMemoryReporter.h"
 #include "mozilla/net/NeckoCommon.h"
 #include "mozilla/Services.h"
 
 #define NOTIFY_GLOBAL_OBSERVERS
 
 #if defined(PR_LOGGING)
--- a/xpcom/ds/nsPersistentProperties.cpp
+++ b/xpcom/ds/nsPersistentProperties.cpp
@@ -1,30 +1,22 @@
 /* -*- 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 "nsArrayEnumerator.h"
 #include "nsID.h"
 #include "nsCOMArray.h"
-#include "nsCRT.h"
-#include "nsReadableUtils.h"
-#include "nsIInputStream.h"
 #include "nsUnicharInputStream.h"
-#include "pratom.h"
-#include "nsEnumeratorUtils.h"
-#include "nsReadableUtils.h"
 #include "nsPrintfCString.h"
-#include "nsDependentString.h"
 
 #define PL_ARENA_CONST_ALIGN_MASK 3
 #include "nsPersistentProperties.h"
 #include "nsIProperties.h"
-#include "nsProperties.h"
 
 struct PropertyTableEntry : public PLDHashEntryHdr
 {
   // both of these are arena-allocated
   const char *mKey;
   const PRUnichar *mValue;
 };
 
--- a/xpcom/ds/nsPersistentProperties.h
+++ b/xpcom/ds/nsPersistentProperties.h
@@ -4,22 +4,21 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsPersistentProperties_h___
 #define nsPersistentProperties_h___
 
 #include "nsIPersistentProperties2.h"
 #include "pldhash.h"
 #include "plarena.h"
-#include "nsString.h"
+#include "nsStringGlue.h"
 #include "nsCOMPtr.h"
 #include "mozilla/Attributes.h"
 
-#include "nsIUnicharInputStream.h"
-
+class nsIUnicharInputStream;
 
 class nsPersistentProperties MOZ_FINAL : public nsIPersistentProperties
 {
 public:
   nsPersistentProperties();
   nsresult Init();
 
   NS_DECL_THREADSAFE_ISUPPORTS
--- a/xpcom/ds/nsProperties.cpp
+++ b/xpcom/ds/nsProperties.cpp
@@ -1,16 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsProperties.h"
-#include "nsString.h"
-#include "nsCRT.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 
 NS_IMPL_AGGREGATED(nsProperties)
 NS_INTERFACE_MAP_BEGIN_AGGREGATED(nsProperties)
     NS_INTERFACE_MAP_ENTRY(nsIProperties)
 NS_INTERFACE_MAP_END
 
--- a/xpcom/ds/nsProperties.h
+++ b/xpcom/ds/nsProperties.h
@@ -15,18 +15,16 @@
 #define NS_PROPERTIES_CID                            \
 { /* 4de2bc90-b1bf-11d3-93b6-00104ba0fd40 */         \
     0x4de2bc90,                                      \
     0xb1bf,                                          \
     0x11d3,                                          \
     {0x93, 0xb6, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
 }
 
-class nsIUnicharInputStream;
-
 typedef nsInterfaceHashtable<nsCharPtrHashKey, nsISupports>
         nsProperties_HashBase;
 
 class nsProperties MOZ_FINAL : public nsIProperties,
                                public nsProperties_HashBase {
 public:
 
   NS_DECL_AGGREGATED
--- a/xpcom/ds/nsStaticNameTable.cpp
+++ b/xpcom/ds/nsStaticNameTable.cpp
@@ -4,19 +4,16 @@
  * 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/. */
 
 /* Class to manage lookup of static names in a table. */
 
 #include "nsCRT.h"
 
 #include "nscore.h"
-#include "nsString.h"
-#include "nsReadableUtils.h"
-#include "prbit.h"
 #include "mozilla/HashFunctions.h"
 #include "nsTraceRefcnt.h"
 
 #define PL_ARENA_CONST_ALIGN_MASK 3
 #include "nsStaticNameTable.h"
 
 using namespace mozilla;
 
--- a/xpcom/ds/nsStaticNameTable.h
+++ b/xpcom/ds/nsStaticNameTable.h
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Classes to manage lookup of static names in a table. */
 
 #ifndef nsStaticNameTable_h___
 #define nsStaticNameTable_h___
 
 #include "pldhash.h"
-#include "nsString.h"
+#include "nsStringGlue.h"
 
 /* This class supports case insensitive lookup.
  *
  * It differs from atom tables:
  * - It supports case insensitive lookup.
  * - It has minimal footprint by not copying the string table.
  * - It does no locking.
  * - It returns zero based indexes and const nsCString& as required by its
--- a/xpcom/ds/nsStringEnumerator.cpp
+++ b/xpcom/ds/nsStringEnumerator.cpp
@@ -1,21 +1,19 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 #include "nsStringEnumerator.h"
-#include "nsCRT.h"
-#include "nsString.h"
-#include "nsReadableUtils.h"
 #include "nsISimpleEnumerator.h"
 #include "nsSupportsPrimitives.h"
 #include "mozilla/Attributes.h"
+#include "nsTArray.h"
 
 //
 // nsStringEnumerator
 //
 
 class nsStringEnumerator MOZ_FINAL : public nsIStringEnumerator,
                                      public nsIUTF8StringEnumerator,
                                      public nsISimpleEnumerator
--- a/xpcom/ds/nsStringEnumerator.h
+++ b/xpcom/ds/nsStringEnumerator.h
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIStringEnumerator.h"
-#include "nsString.h"
-#include "nsTArray.h"
+#include "nsStringFwd.h"
+
+template<class T> class nsTArray;
 
 // nsIStringEnumerator/nsIUTF8StringEnumerator implementations
 //
 // Currently all implementations support both interfaces. The
 // constructors below provide the most common interface for the given
 // type (i.e. nsIStringEnumerator for PRUnichar* strings, and so
 // forth) but any resulting enumerators can be queried to the other
 // type. Internally, the enumerators will hold onto the type that was
--- a/xpcom/ds/nsSupportsArray.cpp
+++ b/xpcom/ds/nsSupportsArray.cpp
@@ -2,17 +2,16 @@
 /* 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 <string.h>
 #include "prbit.h"
 #include "nsSupportsArray.h"
 #include "nsSupportsArrayEnumerator.h"
-#include "nsAString.h"
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
 
 #if DEBUG_SUPPORTSARRAY
 #define MAXSUPPORTS 20
 
 class SupportsStats {
 public:
--- a/xpcom/ds/nsSupportsPrimitives.cpp
+++ b/xpcom/ds/nsSupportsPrimitives.cpp
@@ -1,21 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsSupportsPrimitives.h"
-#include "nsCRT.h"
 #include "nsMemory.h"
 #include "prprf.h"
-#include "nsIInterfaceInfoManager.h"
-#include "nsDependentString.h"
-#include "nsReadableUtils.h"
-#include "nsPromiseFlatString.h"
 
 /***************************************************************************/
 
 NS_IMPL_ISUPPORTS2(nsSupportsIDImpl, nsISupportsID, nsISupportsPrimitive)
 
 nsSupportsIDImpl::nsSupportsIDImpl()
     : mData(nullptr)
 {
--- a/xpcom/ds/nsSupportsPrimitives.h
+++ b/xpcom/ds/nsSupportsPrimitives.h
@@ -5,18 +5,17 @@
 
 #ifndef nsSupportsPrimitives_h__
 #define nsSupportsPrimitives_h__
 
 #include "mozilla/Attributes.h"
 
 #include "nsISupportsPrimitives.h"
 #include "nsCOMPtr.h"
-#include "nsString.h"
-#include "nsDependentString.h"
+#include "nsStringGlue.h"
 
 class nsSupportsIDImpl MOZ_FINAL : public nsISupportsID
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSISUPPORTSPRIMITIVE
     NS_DECL_NSISUPPORTSID
 
--- a/xpcom/ds/nsVariant.cpp
+++ b/xpcom/ds/nsVariant.cpp
@@ -2,22 +2,25 @@
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* The long avoided variant support for xpcom. */
 
 #include "nsVariant.h"
-#include "nsString.h"
 #include "prprf.h"
 #include "prdtoa.h"
 #include <math.h>
-#include "nsCRT.h"
 #include "nsCycleCollectionParticipant.h"
+#include "xpt_struct.h"
+#include "nsReadableUtils.h"
+#include "nsMemory.h"
+#include "nsStringGlue.h"
+#include "nsCRTGlue.h"
 
 /***************************************************************************/
 // Helpers for static convert functions...
 
 static nsresult String2Double(const char* aString, double* retval)
 {
     char* next;
     double value = PR_strtod(aString, &next);
--- a/xpcom/ds/nsVariant.h
+++ b/xpcom/ds/nsVariant.h
@@ -6,17 +6,16 @@
 
 /* The long avoided variant support for xpcom. */
 
 #ifndef nsVariant_h
 #define nsVariant_h
 
 #include "nsIVariant.h"
 #include "nsStringFwd.h"
-#include "xpt_struct.h"
 #include "mozilla/Attributes.h"
 
 class nsCycleCollectionTraversalCallback;
 
 /** 
  * Map the nsAUTF8String, nsUTF8String classes to the nsACString and
  * nsCString classes respectively for now.  These defines need to be removed
  * once Jag lands his nsUTF8String implementation.