Bug 181137 - part 7: Get rid of nsIContentIterator interface r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 11 Jan 2019 01:51:42 +0000
changeset 510541 2a320da37ca0e1f47828e346f6b5e09ff2196ea8
parent 510540 61f2c3b1b36815443550ebb9378294c3b5a61ea8
child 510542 dbf919528d9794a0570b6805a45e9baeac42629f
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs181137
milestone66.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 181137 - part 7: Get rid of nsIContentIterator interface r=smaug Now, nobody requires nsIContentIterator interface. So, we can get rid of it. Unfortunately, there is no macro to keep the inherited class, ContentSubtreeIterator, in the cycle collection to make it keep managing ContentSubtreeIterator::mRange without nsISupports interface. Therefore, this patch moves it into ContentIteratorBase temporarily. Anyway, the following patch makes those classes not refcountable. At that time, this issue will be fixed. Differential Revision: https://phabricator.services.mozilla.com/D15927
dom/base/ContentIterator.cpp
dom/base/ContentIterator.h
dom/base/Element.cpp
dom/base/FragmentOrElement.cpp
dom/base/moz.build
dom/base/nsContentCID.h
dom/base/nsDOMWindowUtils.cpp
dom/base/nsIContentIterator.h
dom/base/nsINode.cpp
dom/base/nsIScriptableContentIterator.idl
layout/generic/nsFrameSelection.cpp
toolkit/components/find/nsFind.cpp
toolkit/components/find/nsFind.h
--- a/dom/base/ContentIterator.cpp
+++ b/dom/base/ContentIterator.cpp
@@ -63,28 +63,21 @@ static bool NodeIsInTraversalRange(nsINo
   }
 
   // Pre mode: start <= node < end.
   RawRangeBoundary beforeNode(parent, aNode->GetPreviousSibling());
   return nsContentUtils::ComparePoints(aStart, beforeNode) <= 0 &&
          nsContentUtils::ComparePoints(aEnd, beforeNode) > 0;
 }
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(ContentIteratorBase)
-NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(ContentIteratorBase,
-                                                   LastRelease())
+NS_IMPL_CYCLE_COLLECTION(ContentIteratorBase, mCurNode, mFirst, mLast,
+                         mCommonParent, mRange)
 
-NS_INTERFACE_MAP_BEGIN(ContentIteratorBase)
-  NS_INTERFACE_MAP_ENTRY(nsIContentIterator)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContentIterator)
-  NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(ContentIteratorBase)
-NS_INTERFACE_MAP_END
-
-NS_IMPL_CYCLE_COLLECTION(ContentIteratorBase, mCurNode, mFirst, mLast,
-                         mCommonParent)
+NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(ContentIteratorBase, AddRef)
+NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(ContentIteratorBase, Release)
 
 void ContentIteratorBase::LastRelease() {
   mCurNode = nullptr;
   mFirst = nullptr;
   mLast = nullptr;
   mCommonParent = nullptr;
 }
 
@@ -632,42 +625,41 @@ nsINode* ContentIteratorBase::GetCurrent
 
   return mCurNode;
 }
 
 /******************************************************
  * PostContentIterator
  ******************************************************/
 
-NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(PostContentIterator,
-                                               ContentIteratorBase)
-NS_IMPL_CYCLE_COLLECTION_INHERITED(PostContentIterator, ContentIteratorBase)
+NS_IMPL_CYCLE_COLLECTING_NATIVE_ADDREF(PostContentIterator)
+NS_IMPL_CYCLE_COLLECTING_NATIVE_RELEASE_WITH_LAST_RELEASE(PostContentIterator,
+                                                          LastRelease())
 
 /******************************************************
  * PreContentIterator
  ******************************************************/
 
-NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(PreContentIterator,
-                                               ContentIteratorBase)
-NS_IMPL_CYCLE_COLLECTION_INHERITED(PreContentIterator, ContentIteratorBase)
+NS_IMPL_CYCLE_COLLECTING_NATIVE_ADDREF(PreContentIterator)
+NS_IMPL_CYCLE_COLLECTING_NATIVE_RELEASE_WITH_LAST_RELEASE(PreContentIterator,
+                                                          LastRelease())
 
 /******************************************************
  * ContentSubtreeIterator
  ******************************************************/
 
-NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(ContentSubtreeIterator,
-                                               ContentIteratorBase)
-NS_IMPL_CYCLE_COLLECTION_INHERITED(ContentSubtreeIterator, ContentIteratorBase,
-                                   mRange)
-
 void ContentSubtreeIterator::LastRelease() {
   mRange = nullptr;
   ContentIteratorBase::LastRelease();
 }
 
+NS_IMPL_CYCLE_COLLECTING_NATIVE_ADDREF(ContentSubtreeIterator)
+NS_IMPL_CYCLE_COLLECTING_NATIVE_RELEASE_WITH_LAST_RELEASE(
+    ContentSubtreeIterator, LastRelease())
+
 /******************************************************
  * Init routines
  ******************************************************/
 
 nsresult ContentSubtreeIterator::Init(nsINode* aRoot) {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
--- a/dom/base/ContentIterator.h
+++ b/dom/base/ContentIterator.h
@@ -6,54 +6,58 @@
 
 #ifndef mozilla_ContentIterator_h
 #define mozilla_ContentIterator_h
 
 #include "mozilla/RangeBoundary.h"
 #include "nsCOMPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsIContent.h"
-#include "nsIContentIterator.h"
 #include "nsRange.h"
 #include "nsTArray.h"
 
 namespace mozilla {
 
 /**
  * ContentIteratorBase is a base class of PostContentIterator,
  * PreContentIterator and ContentSubtreeIterator.  Making each concrete
  * classes "final", compiler can avoid virtual calls if they are treated
  * by the users directly.
  */
-class ContentIteratorBase : public nsIContentIterator {
+class ContentIteratorBase {
+ protected:
+  nsCycleCollectingAutoRefCnt mRefCnt;
+  NS_DECL_OWNINGTHREAD
+
  public:
   ContentIteratorBase() = delete;
   ContentIteratorBase(const ContentIteratorBase&) = delete;
   ContentIteratorBase& operator=(const ContentIteratorBase&) = delete;
 
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_CLASS(ContentIteratorBase)
+  NS_IMETHOD_(MozExternalRefCountType) AddRef() = 0;
+  NS_IMETHOD_(MozExternalRefCountType) Release() = 0;
+  NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(ContentIteratorBase)
 
-  virtual nsresult Init(nsINode* aRoot) override;
-  virtual nsresult Init(nsRange* aRange) override;
+  virtual nsresult Init(nsINode* aRoot);
+  virtual nsresult Init(nsRange* aRange);
   virtual nsresult Init(nsINode* aStartContainer, uint32_t aStartOffset,
-                        nsINode* aEndContainer, uint32_t aEndOffset) override;
+                        nsINode* aEndContainer, uint32_t aEndOffset);
   virtual nsresult Init(const RawRangeBoundary& aStart,
-                        const RawRangeBoundary& aEnd) override;
+                        const RawRangeBoundary& aEnd);
 
-  virtual void First() override;
-  virtual void Last() override;
-  virtual void Next() override;
-  virtual void Prev() override;
+  virtual void First();
+  virtual void Last();
+  virtual void Next();
+  virtual void Prev();
 
-  virtual nsINode* GetCurrentNode() override;
+  virtual nsINode* GetCurrentNode();
 
-  virtual bool IsDone() override;
+  virtual bool IsDone();
 
-  virtual nsresult PositionAt(nsINode* aCurNode) override;
+  virtual nsresult PositionAt(nsINode* aCurNode);
 
  protected:
   explicit ContentIteratorBase(bool aPre);
   virtual ~ContentIteratorBase() = default;
 
   /**
    * Callers must guarantee that:
    * - Neither aStartContainer nor aEndContainer is nullptr.
@@ -83,66 +87,68 @@ class ContentIteratorBase : public nsICo
 
   virtual void LastRelease();
 
   nsCOMPtr<nsINode> mCurNode;
   nsCOMPtr<nsINode> mFirst;
   nsCOMPtr<nsINode> mLast;
   nsCOMPtr<nsINode> mCommonParent;
 
+  // Used only by ContentSubtreeIterator class but we need to put this here
+  // for cycle collection because macros to implement classes in cycle
+  // collection do not support inherited classes without nsISupports interface.
+  RefPtr<nsRange> mRange;
+
   bool mIsDone;
   bool mPre;
 };
 
 /**
  * A simple iterator class for traversing the content in "close tag" order.
  */
 class PostContentIterator final : public ContentIteratorBase {
  public:
   PostContentIterator() : ContentIteratorBase(false) {}
   PostContentIterator(const PostContentIterator&) = delete;
   PostContentIterator& operator=(const PostContentIterator&) = delete;
 
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PostContentIterator,
-                                           ContentIteratorBase)
+  NS_IMETHOD_(MozExternalRefCountType) AddRef() override;
+  NS_IMETHOD_(MozExternalRefCountType) Release() override;
 
  protected:
   virtual ~PostContentIterator() = default;
 };
 
 /**
  * A simple iterator class for traversing the content in "start tag" order.
  */
 class PreContentIterator final : public ContentIteratorBase {
  public:
   PreContentIterator() : ContentIteratorBase(true) {}
   PreContentIterator(const PreContentIterator&) = delete;
   PreContentIterator& operator=(const PreContentIterator&) = delete;
 
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PreContentIterator,
-                                           ContentIteratorBase)
+  NS_IMETHOD_(MozExternalRefCountType) AddRef() override;
+  NS_IMETHOD_(MozExternalRefCountType) Release() override;
 
  protected:
   virtual ~PreContentIterator() = default;
 };
 
 /**
  *  A simple iterator class for traversing the content in "top subtree" order.
  */
 class ContentSubtreeIterator final : public ContentIteratorBase {
  public:
   ContentSubtreeIterator() : ContentIteratorBase(true) {}
   ContentSubtreeIterator(const ContentSubtreeIterator&) = delete;
   ContentSubtreeIterator& operator=(const ContentSubtreeIterator&) = delete;
 
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ContentSubtreeIterator,
-                                           ContentIteratorBase)
+  NS_IMETHOD_(MozExternalRefCountType) AddRef() override;
+  NS_IMETHOD_(MozExternalRefCountType) Release() override;
 
   virtual nsresult Init(nsINode* aRoot) override;
   virtual nsresult Init(nsRange* aRange) override;
   virtual nsresult Init(nsINode* aStartContainer, uint32_t aStartOffset,
                         nsINode* aEndContainer, uint32_t aEndOffset) override;
   virtual nsresult Init(const RawRangeBoundary& aStart,
                         const RawRangeBoundary& aEnd) override;
 
@@ -167,16 +173,14 @@ class ContentSubtreeIterator final : pub
   // (possibly aNode itself).  Returns null if aNode is null, or is not itself
   // in the range.  A node is in the range if (node, 0) comes strictly after
   // the range endpoint, and (node, node.length) comes strictly before it, so
   // the range's start and end nodes will never be considered "in" it.
   nsIContent* GetTopAncestorInRange(nsINode* aNode);
 
   virtual void LastRelease() override;
 
-  RefPtr<nsRange> mRange;
-
   AutoTArray<nsIContent*, 8> mEndNodes;
 };
 
 }  // namespace mozilla
 
 #endif  // #ifndef mozilla_ContentIterator_h
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -22,17 +22,16 @@
 #include "mozilla/dom/ScriptLoader.h"
 #include "mozilla/dom/Text.h"
 #include "mozilla/gfx/Matrix.h"
 #include "nsAtom.h"
 #include "nsDOMAttributeMap.h"
 #include "nsIContentInlines.h"
 #include "mozilla/dom/NodeInfo.h"
 #include "mozilla/dom/DocumentTimeline.h"
-#include "nsIContentIterator.h"
 #include "nsFlexContainerFrame.h"
 #include "nsFocusManager.h"
 #include "nsILinkHandler.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIURL.h"
 #include "nsContainerFrame.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsIPresShell.h"
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -31,17 +31,16 @@
 #include "nsAtom.h"
 #include "mozilla/dom/NodeInfo.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/ScriptLoader.h"
 #include "mozilla/dom/TouchEvent.h"
 #include "mozilla/dom/Document.h"
 #include "mozilla/dom/DocumentInlines.h"
 #include "nsIDocumentEncoder.h"
-#include "nsIContentIterator.h"
 #include "nsFocusManager.h"
 #include "nsILinkHandler.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIURL.h"
 #include "nsNetUtil.h"
 #include "nsIFrame.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsIPresShell.h"
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -69,17 +69,16 @@ EXPORTS += [
     'nsFrameLoader.h',  # Because binding headers include it.
     'nsFrameMessageManager.h',
     'nsGlobalWindow.h',  # Because binding headers include it.
     'nsGlobalWindowInner.h',  # Because binding headers include it.
     'nsGlobalWindowOuter.h',  # Because binding headers include it.
     'nsIAnimationObserver.h',
     'nsIContent.h',
     'nsIContentInlines.h',
-    'nsIContentIterator.h',
     'nsIContentSerializer.h',
     'nsIDocumentObserver.h',
     'nsIGlobalObject.h',
     'nsImageLoadingContent.h',
     'nsIMutationObserver.h',
     'nsINode.h',
     'nsINodeList.h',
     'nsIScriptContext.h',
--- a/dom/base/nsContentCID.h
+++ b/dom/base/nsContentCID.h
@@ -25,37 +25,16 @@
 
 #define NS_NAMESPACEMANAGER_CID                      \
   { /* d9783472-8fe9-11d2-9d3c-0060088f9ff7 */       \
     0xd9783472, 0x8fe9, 0x11d2, {                    \
       0x9d, 0x3c, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7 \
     }                                                \
   }
 
-#define NS_CONTENTITERATOR_CID                       \
-  { /* {a6cf90e3-15b3-11d2-932e-00805f8add32}*/      \
-    0xa6cf90e3, 0x15b3, 0x11d2, {                    \
-      0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 \
-    }                                                \
-  }
-
-#define NS_PRECONTENTITERATOR_CID                    \
-  { /* {80D7E247-D4B8-45d7-BB59-6F1DD56F384C} */     \
-    0x80d7e247, 0xd4b8, 0x45d7, {                    \
-      0xbb, 0x59, 0x6f, 0x1d, 0xd5, 0x6f, 0x38, 0x4c \
-    }                                                \
-  }
-
-#define NS_SUBTREEITERATOR_CID                       \
-  { /* {a6cf90e5-15b3-11d2-932e-00805f8add32}*/      \
-    0xa6cf90e5, 0x15b3, 0x11d2, {                    \
-      0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 \
-    }                                                \
-  }
-
 // {09F689E0-B4DA-11d2-A68B-00104BDE6048}
 #define NS_EVENTLISTENERMANAGER_CID                 \
   {                                                 \
     0x9f689e0, 0xb4da, 0x11d2, {                    \
       0xa6, 0x8b, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 \
     }                                               \
   }
 
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -93,17 +93,16 @@
 #include "FrameLayerBuilder.h"
 #include "nsDisplayList.h"
 #include "nsROCSSPrimitiveValue.h"
 #include "nsIBaseWindow.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "GeckoProfiler.h"
 #include "mozilla/Preferences.h"
-#include "nsIContentIterator.h"
 #include "nsIStyleSheetService.h"
 #include "nsContentPermissionHelper.h"
 #include "nsCSSPseudoElements.h"  // for CSSPseudoElementType
 #include "nsNetUtil.h"
 #include "HTMLImageElement.h"
 #include "HTMLCanvasElement.h"
 #include "mozilla/css/ImageLoader.h"
 #include "mozilla/layers/IAPZCTreeManager.h"  // for layers::ZoomToRectBehavior
deleted file mode 100644
--- a/dom/base/nsIContentIterator.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- 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/. */
-
-#ifndef __nsIContentIterator_h___
-#define __nsIContentIterator_h___
-
-#include "nsISupports.h"
-#include "nsCOMPtr.h"
-#include "mozilla/RangeBoundary.h"
-
-class nsINode;
-class nsRange;
-
-#define NS_ICONTENTITERATOR_IID                      \
-  {                                                  \
-    0x2550078e, 0xae87, 0x4914, {                    \
-      0xb3, 0x04, 0xe4, 0xd1, 0x46, 0x19, 0x3d, 0x5f \
-    }                                                \
-  }
-
-class nsIContentIterator : public nsISupports {
- public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTITERATOR_IID)
-
-  /* Initializes an iterator for the subtree rooted by the node aRoot
-   */
-  virtual nsresult Init(nsINode* aRoot) = 0;
-
-  /* Initializes an iterator for the subtree defined by the range aRange
-     Subclasses should make sure they implement both of these!
-   */
-  virtual nsresult Init(nsRange* aRange) = 0;
-
-  /* Initializes an iterator for the subtree between
-     aStartContainer/aStartOffset and aEndContainer/aEndOffset
-     Callers should guarantee that the start point and end point are in
-     document order.
-   */
-  virtual nsresult Init(nsINode* aStartContainer, uint32_t aStartOffset,
-                        nsINode* aEndContainer, uint32_t aEndOffset) = 0;
-
-  /* Initializes an iterator for the subtree between aStart and aEnd.
-     Callers should guarantee that the start point and end point are in
-     document order.
-   */
-  virtual nsresult Init(const mozilla::RawRangeBoundary& aStart,
-                        const mozilla::RawRangeBoundary& aEnd) = 0;
-
-  /** First will reset the list.
-   */
-  virtual void First() = 0;
-
-  /** Last will reset the list to the end.
-   */
-  virtual void Last() = 0;
-
-  /** Next will advance the list.
-   */
-  virtual void Next() = 0;
-
-  /** Prev will decrement the list.
-   */
-  virtual void Prev() = 0;
-
-  /** CurrentItem will return the current item, or null if the list is empty
-   *  @return the current node
-   */
-  virtual nsINode* GetCurrentNode() = 0;
-
-  /** return if the collection is at the end. that is the beginning following a
-   * call to Prev and it is the end of the list following a call to next
-   *  @return if the iterator is done.
-   */
-  virtual bool IsDone() = 0;
-
-  /** PositionAt will position the iterator to the supplied node
-   */
-  virtual nsresult PositionAt(nsINode* aCurNode) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentIterator, NS_ICONTENTITERATOR_IID)
-
-#endif  // __nsIContentIterator_h___
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -55,17 +55,16 @@
 #include "nsFrameSelection.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsAtom.h"
 #include "nsIBaseWindow.h"
 #include "nsICategoryManager.h"
 #include "nsIContentInlines.h"
-#include "nsIContentIterator.h"
 #include "nsIControllers.h"
 #include "mozilla/dom/Document.h"
 #include "nsIDOMEventListener.h"
 #include "nsILinkHandler.h"
 #include "mozilla/dom/NodeInfo.h"
 #include "mozilla/dom/NodeInfoInlines.h"
 #include "nsIPresShell.h"
 #include "nsIScriptError.h"
--- a/dom/base/nsIScriptableContentIterator.idl
+++ b/dom/base/nsIScriptableContentIterator.idl
@@ -5,17 +5,17 @@
 
 #include "nsISupports.idl"
 
 webidl Node;
 webidl Range;
 
 /**
  * nsIScriptableContentIterator is designed to testing concrete classes of
- * nsIContentIterator.
+ * ContentIteratorBase.
  */
 [scriptable, builtinclass, uuid(9f25fb2a-265f-44f9-a122-62bbf443239e)]
 interface nsIScriptableContentIterator : nsISupports
 {
   cenum IteratorType : 8 {
     NOT_INITIALIZED,
     POST_ORDER_ITERATOR,
     PRE_ORDER_ITERATOR,
@@ -25,48 +25,48 @@ interface nsIScriptableContentIterator :
   /**
    * You need to call initWith*() first.  Then, the instance of this interface
    * decides the type of iterator with its aType argument.  You can call
    * initWith*() multiple times, but you need to keep setting same type as
    * previous call.  If you set different type, these method with throw an
    * exception.
    */
 
-  // See nsIContentIterator::Init(nsINode*)
+  // See ContentIteratorBase::Init(nsINode*)
   void initWithRootNode(in nsIScriptableContentIterator_IteratorType aType,
                         in Node aRoot);
 
-  // See nsIContentIterator::Init(nsRange*)
+  // See ContentIteratorBase::Init(nsRange*)
   void initWithRange(in nsIScriptableContentIterator_IteratorType aType,
                      in Range aRange);
 
-  // See nsIContentIterator::Init(nsINode*, uint32_t, nsINode*, uint32_t)
+  // See ContentIteratorBase::Init(nsINode*, uint32_t, nsINode*, uint32_t)
   void initWithPositions(in nsIScriptableContentIterator_IteratorType aType,
                          in Node aStartContainer, in unsigned long aStartOffset,
                          in Node aEndContainer, in unsigned long aEndOffset);
 
-  // See nsIContentIterator::First()
+  // See ContentIteratorBase::First()
   void first();
 
-  // See nsIContentIterator::Last()
+  // See ContentIteratorBase::Last()
   void last();
 
-  // See nsIContentIterator::Next()
+  // See ContentIteratorBase::Next()
   void next();
 
-  // See nsIContentIterator::Prev()
+  // See ContentIteratorBase::Prev()
   void prev();
 
-  // See nsIContentIterator::GetCurrentNode()
+  // See ContentIteratorBase::GetCurrentNode()
   readonly attribute Node currentNode;
 
-  // See nsIContentIterator::IsDone()
+  // See ContentIteratorBase::IsDone()
   readonly attribute bool isDone;
 
-  // See nsIContentIterator::PositionAt(nsINode*)
+  // See ContentIteratorBase::PositionAt(nsINode*)
   void positionAt(in Node aNode);
 };
 
 %{C++
 #define SCRIPTABLE_CONTENT_ITERATOR_CID \
   { 0xf68037ec, 0x2790, 0x44c5, \
     { 0x8e, 0x5f, 0xdf, 0x5d, 0xa5, 0x8b, 0x93, 0xa7 } }
 #define SCRIPTABLE_CONTENT_ITERATOR_CONTRACTID \
--- a/layout/generic/nsFrameSelection.cpp
+++ b/layout/generic/nsFrameSelection.cpp
@@ -24,17 +24,16 @@
 #include "nsIContent.h"
 #include "nsRange.h"
 #include "nsITableCellLayout.h"
 #include "nsTArray.h"
 #include "nsTableWrapperFrame.h"
 #include "nsTableCellFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsCCUncollectableMarker.h"
-#include "nsIContentIterator.h"
 #include "nsIDocumentEncoder.h"
 #include "nsTextFragment.h"
 #include <algorithm>
 #include "nsContentUtils.h"
 #include "nsCSSFrameConstructor.h"
 
 #include "nsGkAtoms.h"
 #include "nsIFrameTraversal.h"
--- a/toolkit/components/find/nsFind.cpp
+++ b/toolkit/components/find/nsFind.cpp
@@ -30,19 +30,16 @@
 #include "mozilla/dom/Text.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 // Yikes!  Casting a char to unichar can fill with ones!
 #define CHAR_TO_UNICHAR(c) ((char16_t)(unsigned char)c)
 
-static NS_DEFINE_CID(kCContentIteratorCID, NS_CONTENTITERATOR_CID);
-static NS_DEFINE_CID(kCPreContentIteratorCID, NS_PRECONTENTITERATOR_CID);
-
 #define CH_QUOTE ((char16_t)0x22)
 #define CH_APOSTROPHE ((char16_t)0x27)
 #define CH_LEFT_SINGLE_QUOTE ((char16_t)0x2018)
 #define CH_RIGHT_SINGLE_QUOTE ((char16_t)0x2019)
 #define CH_LEFT_DOUBLE_QUOTE ((char16_t)0x201C)
 #define CH_RIGHT_DOUBLE_QUOTE ((char16_t)0x201D)
 
 #define CH_SHY ((char16_t)0xAD)
--- a/toolkit/components/find/nsFind.h
+++ b/toolkit/components/find/nsFind.h
@@ -7,17 +7,16 @@
 #ifndef nsFind_h__
 #define nsFind_h__
 
 #include "nsIFind.h"
 
 #include "nsCOMPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsINode.h"
-#include "nsIContentIterator.h"
 #include "mozilla/intl/WordBreaker.h"
 
 class nsIContent;
 class nsRange;
 
 #define NS_FIND_CONTRACTID "@mozilla.org/embedcomp/rangefind;1"
 
 #define NS_FIND_CID                                  \