Bug 1415677 part 1. Remove nsIDOMHTMLCollection::NamedItem. r=qdot
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 13 Nov 2017 10:38:59 -0500
changeset 445851 fc56f1bc49b2d15ee229009bc11a46f041fc9e42
parent 445850 b9aa0fc4f179dbe92419b3b153df170bd1eb697d
child 445852 08cfdc174ee00429948f48e120f49e76587d2f95
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1415677
milestone59.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 1415677 part 1. Remove nsIDOMHTMLCollection::NamedItem. r=qdot MozReview-Commit-ID: EppP6KSYSn6
dom/base/nsContentList.cpp
dom/base/nsDocument.cpp
dom/html/HTMLFormControlsCollection.cpp
dom/html/HTMLOptionsCollection.cpp
dom/html/HTMLTableElement.cpp
dom/html/nsIHTMLCollection.h
dom/interfaces/html/nsIDOMHTMLCollection.idl
--- a/dom/base/nsContentList.cpp
+++ b/dom/base/nsContentList.cpp
@@ -177,23 +177,16 @@ nsEmptyContentList::GetLength(uint32_t* 
 
 NS_IMETHODIMP
 nsEmptyContentList::Item(uint32_t aIndex, nsIDOMNode** aReturn)
 {
   *aReturn = nullptr;
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsEmptyContentList::NamedItem(const nsAString& aName, nsIDOMNode** aReturn)
-{
-  *aReturn = nullptr;
-  return NS_OK;
-}
-
 mozilla::dom::Element*
 nsEmptyContentList::GetElementAt(uint32_t index)
 {
   return nullptr;
 }
 
 mozilla::dom::Element*
 nsEmptyContentList::GetFirstNamedElement(const nsAString& aName, bool& aFound)
@@ -678,30 +671,16 @@ nsContentList::Item(uint32_t aIndex, nsI
     return CallQueryInterface(node, aReturn);
   }
 
   *aReturn = nullptr;
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsContentList::NamedItem(const nsAString& aName, nsIDOMNode** aReturn)
-{
-  nsIContent *content = NamedItem(aName, true);
-
-  if (content) {
-    return CallQueryInterface(content, aReturn);
-  }
-
-  *aReturn = nullptr;
-
-  return NS_OK;
-}
-
 Element*
 nsContentList::GetElementAt(uint32_t aIndex)
 {
   return static_cast<Element*>(Item(aIndex, true));
 }
 
 nsIContent*
 nsContentList::Item(uint32_t aIndex)
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -654,17 +654,16 @@ public:
   virtual JSObject* WrapObject(JSContext *aCx,
                                JS::Handle<JSObject*> aGivenProto) override
   {
     return HTMLCollectionBinding::Wrap(aCx, this, aGivenProto);
   }
 
   using nsBaseContentList::Length;
   using nsBaseContentList::Item;
-  using nsIHTMLCollection::NamedItem;
 
 private:
   virtual ~SimpleHTMLCollection() {}
 };
 
 NS_IMPL_ISUPPORTS_INHERITED(SimpleHTMLCollection, nsSimpleContentList,
                             nsIHTMLCollection, nsIDOMHTMLCollection)
 
@@ -678,24 +677,16 @@ SimpleHTMLCollection::GetLength(uint32_t
 NS_IMETHODIMP
 SimpleHTMLCollection::Item(uint32_t aIdx, nsIDOMNode** aRetVal)
 {
   nsCOMPtr<nsIDOMNode> retVal = Item(aIdx)->AsDOMNode();
   retVal.forget(aRetVal);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-SimpleHTMLCollection::NamedItem(const nsAString& aName, nsIDOMNode** aRetVal)
-{
-  nsCOMPtr<nsIDOMNode> retVal = NamedItem(aName)->AsDOMNode();
-  retVal.forget(aRetVal);
-  return NS_OK;
-}
-
 } // namespace dom
 } // namespace mozilla
 
 void
 nsIdentifierMapEntry::AddNameElement(nsINode* aNode, Element* aElement)
 {
   if (!mNameContentList) {
     mNameContentList = new SimpleHTMLCollection(aNode);
--- a/dom/html/HTMLFormControlsCollection.cpp
+++ b/dom/html/HTMLFormControlsCollection.cpp
@@ -171,53 +171,16 @@ HTMLFormControlsCollection::Item(uint32_
     *aReturn = nullptr;
 
     return NS_OK;
   }
 
   return CallQueryInterface(item, aReturn);
 }
 
-NS_IMETHODIMP
-HTMLFormControlsCollection::NamedItem(const nsAString& aName,
-                                      nsIDOMNode** aReturn)
-{
-  FlushPendingNotifications();
-
-  *aReturn = nullptr;
-
-  nsCOMPtr<nsISupports> supports;
-
-  if (!mNameLookupTable.Get(aName, getter_AddRefs(supports))) {
-    // key not found
-    return NS_OK;
-  }
-
-  if (!supports) {
-    return NS_OK;
-  }
-
-  // We found something, check if it's a node
-  CallQueryInterface(supports, aReturn);
-  if (*aReturn) {
-    return NS_OK;
-  }
-
-  // If not, we check if it's a node list.
-  nsCOMPtr<nsIDOMNodeList> nodeList = do_QueryInterface(supports);
-  NS_ASSERTION(nodeList, "Huh, what's going one here?");
-  if (!nodeList) {
-    return NS_OK;
-  }
-
-  // And since we're only asking for one node here, we return the first
-  // one from the list.
-  return nodeList->Item(0, aReturn);
-}
-
 nsISupports*
 HTMLFormControlsCollection::NamedItemInternal(const nsAString& aName,
                                               bool aFlushContent)
 {
   if (aFlushContent) {
     FlushPendingNotifications();
   }
 
--- a/dom/html/HTMLOptionsCollection.cpp
+++ b/dom/html/HTMLOptionsCollection.cpp
@@ -241,25 +241,16 @@ HTMLOptionsCollection::NamedGetter(const
 }
 
 nsINode*
 HTMLOptionsCollection::GetParentObject()
 {
   return mSelect;
 }
 
-NS_IMETHODIMP
-HTMLOptionsCollection::NamedItem(const nsAString& aName,
-                                 nsIDOMNode** aReturn)
-{
-  NS_IF_ADDREF(*aReturn = GetNamedItem(aName));
-
-  return NS_OK;
-}
-
 void
 HTMLOptionsCollection::GetSupportedNames(nsTArray<nsString>& aNames)
 {
   AutoTArray<nsAtom*, 8> atoms;
   for (uint32_t i = 0; i < mElements.Length(); ++i) {
     HTMLOptionElement* content = mElements.ElementAt(i);
     if (content) {
       // Note: HasName means the names is exposed on the document,
--- a/dom/html/HTMLTableElement.cpp
+++ b/dom/html/HTMLTableElement.cpp
@@ -302,31 +302,16 @@ TableRowsCollection::GetSupportedNames(n
         }
       }
     }
   }
 }
 
 
 NS_IMETHODIMP
-TableRowsCollection::NamedItem(const nsAString& aName,
-                               nsIDOMNode** aReturn)
-{
-  bool found;
-  nsISupports* node = GetFirstNamedElement(aName, found);
-  if (!node) {
-    *aReturn = nullptr;
-
-    return NS_OK;
-  }
-
-  return CallQueryInterface(node, aReturn);
-}
-
-NS_IMETHODIMP
 TableRowsCollection::ParentDestroyed()
 {
   CleanUp();
   return NS_OK;
 }
 
 bool
 TableRowsCollection::InterestingContainer(nsIContent* aContainer)
--- a/dom/html/nsIHTMLCollection.h
+++ b/dom/html/nsIHTMLCollection.h
@@ -36,17 +36,16 @@ public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_IHTMLCOLLECTION_IID)
 
   /**
    * Get the root node for this HTML collection.
    */
   virtual nsINode* GetParentObject() = 0;
 
   using nsIDOMHTMLCollection::Item;
-  using nsIDOMHTMLCollection::NamedItem;
 
   uint32_t Length()
   {
     uint32_t length;
     GetLength(&length);
     return length;
   }
   virtual mozilla::dom::Element* GetElementAt(uint32_t index) = 0;
--- a/dom/interfaces/html/nsIDOMHTMLCollection.idl
+++ b/dom/interfaces/html/nsIDOMHTMLCollection.idl
@@ -17,10 +17,9 @@
  */
 
 [uuid(bb07f567-5b37-4172-92aa-7d00ceed4809)]
 interface nsIDOMHTMLCollection : nsISupports
 {
   readonly attribute unsigned long    length;
 
   nsIDOMNode item(in unsigned long index);
-  nsIDOMNode namedItem(in DOMString name);
 };