Bug 1431964 part 1. Remove the XPCOM versions of GetAttributeNode(NS). r=mccr8
authorBoris Zbarsky <bzbarsky@mit.edu>
Sat, 20 Jan 2018 18:12:20 -0500
changeset 454449 22a83c38a0d73453946a2d175d313e72063f71e6
parent 454448 df07eaf643a3c348ef876c3e4b569f49b0b896aa
child 454450 aac9cf730d20124ee5304ad69211347e60e1f8dc
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 1. Remove the XPCOM versions of GetAttributeNode(NS). r=mccr8 MozReview-Commit-ID: 5VTrCvHmMWi
dom/base/Element.h
dom/interfaces/core/nsIDOMElement.idl
layout/inspector/inDOMView.cpp
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -2223,24 +2223,10 @@ NS_IMETHOD SetAttribute(const nsAString&
   return rv.StealNSResult();                                                  \
 }                                                                             \
 using Element::HasAttribute;                                                  \
 NS_IMETHOD HasAttribute(const nsAString& name,                                \
                            bool* _retval) final override                      \
 {                                                                             \
   *_retval = HasAttribute(name);                                              \
   return NS_OK;                                                               \
-}                                                                             \
-NS_IMETHOD GetAttributeNode(const nsAString& name,                            \
-                            nsIDOMAttr** _retval) final override              \
-{                                                                             \
-  NS_IF_ADDREF(*_retval = Element::GetAttributeNode(name));                   \
-  return NS_OK;                                                               \
-}                                                                             \
-NS_IMETHOD GetAttributeNodeNS(const nsAString& namespaceURI,                  \
-                              const nsAString& localName,                     \
-                              nsIDOMAttr** _retval) final override            \
-{                                                                             \
-  NS_IF_ADDREF(*_retval = Element::GetAttributeNodeNS(namespaceURI,           \
-                                                      localName));            \
-  return NS_OK;                                                               \
 }
 #endif // mozilla_dom_Element_h__
--- a/dom/interfaces/core/nsIDOMElement.idl
+++ b/dom/interfaces/core/nsIDOMElement.idl
@@ -29,14 +29,9 @@ interface nsIDOMElement : nsIDOMNode
 {
   readonly attribute DOMString        tagName;
 
   readonly attribute nsIDOMMozNamedAttrMap attributes;
   DOMString          getAttribute(in DOMString name);
   void               setAttribute(in DOMString name, 
                                   in DOMString value);
   boolean            hasAttribute(in DOMString name);
-
-  // Obsolete methods.
-  nsIDOMAttr         getAttributeNode(in DOMString name);
-  nsIDOMAttr         getAttributeNodeNS(in DOMString namespaceURI, 
-                                        in DOMString localName);
 };
--- a/layout/inspector/inDOMView.cpp
+++ b/layout/inspector/inDOMView.cpp
@@ -5,29 +5,31 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "inDOMView.h"
 
 #include "inLayoutUtils.h"
 
 #include "nsString.h"
 #include "nsReadableUtils.h"
+#include "nsIAttribute.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeFilter.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMCharacterData.h"
 #include "nsIDOMAttr.h"
 #include "nsIDOMMozNamedAttrMap.h"
 #include "nsIDOMMutationEvent.h"
 #include "nsBindingManager.h"
 #include "nsNameSpaceManager.h"
 #include "nsIDocument.h"
 #include "nsIServiceManager.h"
 #include "nsITreeColumns.h"
 #include "nsITreeBoxObject.h"
+#include "mozilla/dom/Attr.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/Services.h"
 #include "mozilla/dom/InspectorUtils.h"
 
 #ifdef ACCESSIBILITY
 #include "nsAccessibilityService.h"
 #endif
 
@@ -636,32 +638,32 @@ inDOMView::AttributeChanged(nsIDocument*
   if (!(mWhatToShow & nsIDOMNodeFilter::SHOW_ATTRIBUTE)) {
     return;
   }
 
   nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
 
   // get the dom attribute node, if there is any
   nsCOMPtr<nsIDOMElement> el(do_QueryInterface(aElement));
-  nsCOMPtr<nsIDOMAttr> domAttr;
+  RefPtr<dom::Attr> domAttr;
   nsDependentAtomString attrStr(aAttribute);
   if (aNameSpaceID) {
     nsNameSpaceManager* nsm = nsNameSpaceManager::GetInstance();
     if (!nsm) {
       // we can't find out which attribute we want :(
       return;
     }
     nsString attrNS;
     nsresult rv = nsm->GetNameSpaceURI(aNameSpaceID, attrNS);
     if (NS_FAILED(rv)) {
       return;
     }
-    (void)el->GetAttributeNodeNS(attrNS, attrStr, getter_AddRefs(domAttr));
+    domAttr = aElement->GetAttributeNodeNS(attrNS, attrStr);
   } else {
-    (void)el->GetAttributeNode(attrStr, getter_AddRefs(domAttr));
+    domAttr = aElement->GetAttributeNode(attrStr);
   }
 
   if (aModType == nsIDOMMutationEvent::MODIFICATION) {
     // No fancy stuff here, just invalidate the changed row
     if (!domAttr) {
       return;
     }
     int32_t row = 0;
@@ -730,17 +732,18 @@ inDOMView::AttributeChanged(nsIDocument*
     }
 
     // search for the attribute node that was removed
     inDOMViewNode* checkNode = nullptr;
     int32_t row = 0;
     for (row = contentRow+1; row < GetRowCount(); ++row) {
       checkNode = GetNodeAt(row);
       if (checkNode->level == baseLevel+1) {
-        domAttr = do_QueryInterface(checkNode->node);
+        nsCOMPtr<nsIAttribute> attr = do_QueryInterface(checkNode->node);
+        domAttr = static_cast<dom::Attr*>(attr.get());
         if (domAttr) {
           nsAutoString attrName;
           domAttr->GetNodeName(attrName);
           if (attrName.Equals(attrStr)) {
             // we have found the row for the attribute that was removed
             RemoveLink(checkNode);
             RemoveNode(row);
             mTree->RowCountChanged(row, -1);