Bug 1431964 part 4. Remove nsIDOMMozNamedAttrMap::GetNamedItemNS. r=mccr8
authorBoris Zbarsky <bzbarsky@mit.edu>
Sat, 20 Jan 2018 18:33:06 -0500
changeset 454452 f42ff3c796bfd00e72507e959d2c06265a2ca684
parent 454451 8149c85354f07a4e609645f092f8e08b32a32376
child 454453 3d7a4d867c9513c8380c5520696062ce9a241e30
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)
reviewersmccr8
bugs1431964
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 1431964 part 4. Remove nsIDOMMozNamedAttrMap::GetNamedItemNS. r=mccr8 MozReview-Commit-ID: 7l8CcT1ntL7
dom/base/nsDOMAttributeMap.cpp
dom/interfaces/core/nsIDOMMozNamedAttrMap.idl
dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
--- a/dom/base/nsDOMAttributeMap.cpp
+++ b/dom/base/nsDOMAttributeMap.cpp
@@ -393,25 +393,16 @@ nsDOMAttributeMap::Length() const
 nsresult
 nsDOMAttributeMap::GetLength(uint32_t *aLength)
 {
   NS_ENSURE_ARG_POINTER(aLength);
   *aLength = Length();
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsDOMAttributeMap::GetNamedItemNS(const nsAString& aNamespaceURI,
-                                  const nsAString& aLocalName,
-                                  nsIDOMAttr** aReturn)
-{
-  NS_IF_ADDREF(*aReturn = GetNamedItemNS(aNamespaceURI, aLocalName));
-  return NS_OK;
-}
-
 Attr*
 nsDOMAttributeMap::GetNamedItemNS(const nsAString& aNamespaceURI,
                                   const nsAString& aLocalName)
 {
   RefPtr<mozilla::dom::NodeInfo> ni = GetAttrNodeInfo(aNamespaceURI, aLocalName);
   if (!ni) {
     return nullptr;
   }
--- a/dom/interfaces/core/nsIDOMMozNamedAttrMap.idl
+++ b/dom/interfaces/core/nsIDOMMozNamedAttrMap.idl
@@ -15,18 +15,15 @@ interface nsIDOMMozNamedAttrMap : nsISup
 {
   nsIDOMAttr                setNamedItem(in nsIDOMAttr arg)
                                   raises(DOMException);
   nsIDOMAttr                removeNamedItem(in DOMString name)
                                   raises(DOMException);
   nsIDOMAttr                item(in unsigned long index);
   readonly attribute  unsigned long        length;
   // Introduced in DOM Level 2:
-  nsIDOMAttr                getNamedItemNS(in DOMString namespaceURI, 
-                                           in DOMString localName);
-  // Introduced in DOM Level 2:
   nsIDOMAttr                setNamedItemNS(in nsIDOMAttr arg)
                                   raises(DOMException);
   // Introduced in DOM Level 2:
   nsIDOMAttr                removeNamedItemNS(in DOMString namespaceURI, 
                                               in DOMString localName)
                                   raises(DOMException);
 };
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -397,34 +397,30 @@ ResourceReader::OnWalkURI(const nsACStri
 }
 
 static nsresult
 ExtractAttribute(nsIDOMNode* aNode,
                  const char* aAttribute,
                  const char* aNamespaceURI,
                  nsCString&  aValue)
 {
-    nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aNode);
+    nsCOMPtr<dom::Element> element = do_QueryInterface(aNode);
     MOZ_ASSERT(element);
 
     // Find the named URI attribute on the (element) node and store
     // a reference to the URI that maps onto a local file name
 
-    nsCOMPtr<nsIDOMMozNamedAttrMap> attrMap;
-    nsresult rv = element->GetAttributes(getter_AddRefs(attrMap));
-    NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
+    RefPtr<nsDOMAttributeMap> attrMap = element->Attributes();
 
     NS_ConvertASCIItoUTF16 namespaceURI(aNamespaceURI);
     NS_ConvertASCIItoUTF16 attribute(aAttribute);
-    nsCOMPtr<nsIDOMAttr> attr;
-    rv = attrMap->GetNamedItemNS(namespaceURI, attribute, getter_AddRefs(attr));
-    NS_ENSURE_SUCCESS(rv, rv);
+    RefPtr<dom::Attr> attr = attrMap->GetNamedItemNS(namespaceURI, attribute);
     if (attr) {
         nsAutoString value;
-        rv = attr->GetValue(value);
+        nsresult rv = attr->GetValue(value);
         NS_ENSURE_SUCCESS(rv, rv);
         aValue = NS_ConvertUTF16toUTF8(value);
     } else {
         aValue.Truncate();
     }
     return NS_OK;
 }
 
@@ -685,27 +681,25 @@ PersistNodeFixup::FixupURI(nsAString &aU
     return NS_OK;
 }
 
 nsresult
 PersistNodeFixup::FixupAttribute(nsIDOMNode* aNode,
                                  const char* aAttribute,
                                  const char* aNamespaceURI)
 {
-    nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aNode);
+    nsCOMPtr<dom::Element> element = do_QueryInterface(aNode);
     MOZ_ASSERT(element);
 
-    nsCOMPtr<nsIDOMMozNamedAttrMap> attrMap;
-    nsresult rv = element->GetAttributes(getter_AddRefs(attrMap));
-    NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
+    RefPtr<nsDOMAttributeMap> attrMap = element->Attributes();
 
     NS_ConvertASCIItoUTF16 attribute(aAttribute);
     NS_ConvertASCIItoUTF16 namespaceURI(aNamespaceURI);
-    nsCOMPtr<nsIDOMAttr> attr;
-    rv = attrMap->GetNamedItemNS(namespaceURI, attribute, getter_AddRefs(attr));
+    RefPtr<dom::Attr> attr = attrMap->GetNamedItemNS(namespaceURI, attribute);
+    nsresult rv = NS_OK;
     if (attr) {
         nsString uri;
         attr->GetValue(uri);
         rv = FixupURI(uri);
         if (NS_SUCCEEDED(rv)) {
             attr->SetValue(uri);
         }
     }