Bug 1510167. Mark some nsGkAtom* arguments as const in DOM code. r=baku
authorJonathan Watt <jwatt@jwatt.org>
Tue, 13 Nov 2018 12:48:21 +0000
changeset 507498 e3ca695c95b2f5f69e6be409e8be394ade8932b3
parent 507497 9ec6a81e695aef5d519d0e8a79927a9d6e915c03
child 507499 2b4844c3f4d88f746755c49d8d41de016ef8f2cb
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1510167
milestone65.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 1510167. Mark some nsGkAtom* arguments as const in DOM code. r=baku Differential Revision: https://phabricator.services.mozilla.com/D13049
accessible/generic/DocAccessible.h
dom/base/AttrArray.cpp
dom/base/AttrArray.h
dom/base/Element.cpp
dom/base/Element.h
dom/base/NodeInfo.h
dom/base/NodeInfoInlines.h
dom/base/nsAttrName.h
dom/base/nsAttrValue.cpp
dom/base/nsAttrValue.h
dom/base/nsIContent.h
dom/base/nsINode.cpp
dom/base/nsINode.h
dom/base/nsMappedAttributes.cpp
dom/base/nsMappedAttributes.h
dom/base/nsPropertyTable.cpp
dom/base/nsPropertyTable.h
--- a/accessible/generic/DocAccessible.h
+++ b/accessible/generic/DocAccessible.h
@@ -638,17 +638,17 @@ protected:
   nsCOMPtr<nsIContent> mAnchorJumpElm;
 
   /**
    * A generic state (see items below) before the attribute value was changed.
    * @see AttributeWillChange and AttributeChanged notifications.
    */
   union {
     // ARIA attribute value
-    nsAtom* mARIAAttrOldValue;
+    const nsAtom* mARIAAttrOldValue;
 
     // True if the accessible state bit was on
     bool mStateBitWasOn;
   };
 
   nsTArray<RefPtr<DocAccessible> > mChildDocuments;
 
   /**
--- a/dom/base/AttrArray.cpp
+++ b/dom/base/AttrArray.cpp
@@ -29,17 +29,17 @@ AttrArray::Impl::~Impl()
   for (InternalAttr& attr : NonMappedAttrs()) {
     attr.~InternalAttr();
   }
 
   NS_IF_RELEASE(mMappedAttrs);
 }
 
 const nsAttrValue*
-AttrArray::GetAttr(nsAtom* aLocalName, int32_t aNamespaceID) const
+AttrArray::GetAttr(const nsAtom* aLocalName, int32_t aNamespaceID) const
 {
   if (aNamespaceID == kNameSpaceID_None) {
     // This should be the common case so lets make an optimized loop
     for (const InternalAttr& attr : NonMappedAttrs()) {
       if (attr.mName.Equals(aLocalName)) {
         return &attr.mValue;
       }
     }
@@ -268,17 +268,17 @@ AttrArray::GetExistingAttrNameFromQName(
   if (mImpl && mImpl->mMappedAttrs) {
     return mImpl->mMappedAttrs->GetExistingAttrNameFromQName(aName);
   }
 
   return nullptr;
 }
 
 int32_t
-AttrArray::IndexOfAttr(nsAtom* aLocalName, int32_t aNamespaceID) const
+AttrArray::IndexOfAttr(const nsAtom* aLocalName, int32_t aNamespaceID) const
 {
   if (!mImpl) {
     return -1;
   }
 
   int32_t idx;
   if (mImpl->mMappedAttrs && aNamespaceID == kNameSpaceID_None) {
     idx = mImpl->mMappedAttrs->IndexOfAttr(aLocalName);
--- a/dom/base/AttrArray.h
+++ b/dom/base/AttrArray.h
@@ -41,17 +41,17 @@ public:
     return NonMappedAttrCount() || MappedAttrCount();
   }
 
   uint32_t AttrCount() const
   {
     return NonMappedAttrCount() + MappedAttrCount();
   }
 
-  const nsAttrValue* GetAttr(nsAtom* aLocalName,
+  const nsAttrValue* GetAttr(const nsAtom* aLocalName,
                              int32_t aNamespaceID = kNameSpaceID_None) const;
   // As above but using a string attr name and always using
   // kNameSpaceID_None.  This is always case-sensitive.
   const nsAttrValue* GetAttr(const nsAString& aName) const;
   // Get an nsAttrValue by qualified name.  Can optionally do
   // ASCII-case-insensitive name matching.
   const nsAttrValue* GetAttr(const nsAString& aName,
                              nsCaseTreatment aCaseSensitive) const;
@@ -74,17 +74,17 @@ public:
 
   // Returns the attribute info at a given position, *not* out-of-bounds safe
   BorrowedAttrInfo AttrInfoAt(uint32_t aPos) const;
 
   // Returns attribute name at given position or null if aPos is out-of-bounds
   const nsAttrName* GetSafeAttrNameAt(uint32_t aPos) const;
 
   const nsAttrName* GetExistingAttrNameFromQName(const nsAString& aName) const;
-  int32_t IndexOfAttr(nsAtom* aLocalName, int32_t aNamespaceID = kNameSpaceID_None) const;
+  int32_t IndexOfAttr(const nsAtom* aLocalName, int32_t aNamespaceID = kNameSpaceID_None) const;
 
   // SetAndSwapMappedAttr swaps the current attribute value with aValue.
   // If the attribute was unset, an empty value will be swapped into aValue
   // and aHadValue will be set to false. Otherwise, aHadValue will be set to
   // true.
   nsresult SetAndSwapMappedAttr(nsAtom* aLocalName, nsAttrValue& aValue,
                                 nsMappedAttributeElement* aContent,
                                 nsHTMLStyleSheet* aSheet,
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -2415,18 +2415,18 @@ Element::InternalGetAttrNameFromQName(co
     }
   }
 
   return val;
 }
 
 bool
 Element::MaybeCheckSameAttrVal(int32_t aNamespaceID,
-                               nsAtom* aName,
-                               nsAtom* aPrefix,
+                               const nsAtom* aName,
+                               const nsAtom* aPrefix,
                                const nsAttrValueOrString& aValue,
                                bool aNotify,
                                nsAttrValue& aOldValue,
                                uint8_t* aModType,
                                bool* aHasListeners,
                                bool* aOldValueSet)
 {
   bool modification = false;
@@ -2900,28 +2900,28 @@ EventListenerManager*
 Element::GetEventListenerManagerForAttr(nsAtom* aAttrName,
                                         bool* aDefer)
 {
   *aDefer = true;
   return GetOrCreateListenerManager();
 }
 
 bool
-Element::GetAttr(int32_t aNameSpaceID, nsAtom* aName,
+Element::GetAttr(int32_t aNameSpaceID, const nsAtom* aName,
                  nsAString& aResult) const
 {
   DOMString str;
   bool haveAttr = GetAttr(aNameSpaceID, aName, str);
   str.ToString(aResult);
   return haveAttr;
 }
 
 int32_t
 Element::FindAttrValueIn(int32_t aNameSpaceID,
-                         nsAtom* aName,
+                         const nsAtom* aName,
                          AttrValuesArray* aValues,
                          nsCaseTreatment aCaseSensitive) const
 {
   NS_ASSERTION(aName, "Must have attr name");
   NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, "Must have namespace");
   NS_ASSERTION(aValues, "Null value array");
 
   const nsAttrValue* val = mAttrs.GetAttr(aName, aNameSpaceID);
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -702,18 +702,19 @@ public:
    *   nsAttrValue::eString or nsAttrValue::eAtom.
    * @param aModType [out] Set to MutationEvent_Binding::MODIFICATION or to
    *   MutationEvent_Binding::ADDITION, but only if this helper returns true
    * @param aHasListeners [out] Set to true if there are mutation event
    *   listeners listening for NS_EVENT_BITS_MUTATION_ATTRMODIFIED
    * @param aOldValueSet [out] Indicates whether an old attribute value has been
    *   stored in aOldValue. The bool will be set to true if a value was stored.
    */
-  bool MaybeCheckSameAttrVal(int32_t aNamespaceID, nsAtom* aName,
-                             nsAtom* aPrefix,
+  bool MaybeCheckSameAttrVal(int32_t aNamespaceID,
+                             const nsAtom* aName,
+                             const nsAtom* aPrefix,
                              const nsAttrValueOrString& aValue,
                              bool aNotify, nsAttrValue& aOldValue,
                              uint8_t* aModType, bool* aHasListeners,
                              bool* aOldValueSet);
 
   /**
    * Notifies mutation listeners if aNotify is true, there are mutation
    * listeners, and the attribute value is changing.
@@ -760,65 +761,65 @@ public:
                          kNameSpaceID_None in the overload that omits this arg)
    * @param aName the name of the attr
    * @param aResult the value (may legitimately be the empty string) [OUT]
    * @returns true if the attribute was set (even when set to empty string)
    *          false when not set.
    * GetAttr is not inlined on purpose, to keep down codesize from all the
    * inlined nsAttrValue bits for C++ callers.
    */
-  bool GetAttr(int32_t aNameSpaceID, nsAtom* aName, nsAString& aResult) const;
+  bool GetAttr(int32_t aNameSpaceID, const nsAtom* aName, nsAString& aResult) const;
 
-  bool GetAttr(nsAtom* aName, nsAString& aResult) const
+  bool GetAttr(const nsAtom* aName, nsAString& aResult) const
   {
     return GetAttr(kNameSpaceID_None, aName, aResult);
   }
 
   /**
    * Determine if an attribute has been set (empty string or otherwise).
    *
    * @param aNameSpaceId the namespace id of the attribute (defaults to
                          kNameSpaceID_None in the overload that omits this arg)
    * @param aAttr the attribute name
    * @return whether an attribute exists
    */
-  inline bool HasAttr(int32_t aNameSpaceID, nsAtom* aName) const;
+  inline bool HasAttr(int32_t aNameSpaceID, const nsAtom* aName) const;
 
-  bool HasAttr(nsAtom* aAttr) const
+  bool HasAttr(const nsAtom* aAttr) const
   {
     return HasAttr(kNameSpaceID_None, aAttr);
   }
 
   /**
    * Test whether this Element's given attribute has the given value.  If the
    * attribute is not set at all, this will return false.
    *
    * @param aNameSpaceID The namespace ID of the attribute.  Must not
    *                     be kNameSpaceID_Unknown.
    * @param aName The name atom of the attribute.  Must not be null.
    * @param aValue The value to compare to.
    * @param aCaseSensitive Whether to do a case-sensitive compare on the value.
    */
-  inline bool AttrValueIs(int32_t aNameSpaceID, nsAtom* aName,
+  inline bool AttrValueIs(int32_t aNameSpaceID, const nsAtom* aName,
                           const nsAString& aValue,
                           nsCaseTreatment aCaseSensitive) const;
 
   /**
    * Test whether this Element's given attribute has the given value.  If the
    * attribute is not set at all, this will return false.
    *
    * @param aNameSpaceID The namespace ID of the attribute.  Must not
    *                     be kNameSpaceID_Unknown.
    * @param aName The name atom of the attribute.  Must not be null.
    * @param aValue The value to compare to.  Must not be null.
    * @param aCaseSensitive Whether to do a case-sensitive compare on the value.
    */
   bool AttrValueIs(int32_t aNameSpaceID,
-                   nsAtom* aName,
-                   nsAtom* aValue,
+                   const nsAtom* aName,
+                   const nsAtom* aValue,
                    nsCaseTreatment aCaseSensitive) const;
 
   enum {
     ATTR_MISSING = -1,
     ATTR_VALUE_NO_MATCH = -2
   };
   /**
    * Check whether this Element's given attribute has one of a given list of
@@ -833,17 +834,17 @@ public:
    * @param aValues a nullptr-terminated array of pointers to atom values to test
    *                against.
    * @param aCaseSensitive Whether to do a case-sensitive compare on the values.
    * @return ATTR_MISSING, ATTR_VALUE_NO_MATCH or the non-negative index
    * indicating the first value of aValues that matched
    */
   typedef nsStaticAtom* const AttrValuesArray;
   int32_t FindAttrValueIn(int32_t aNameSpaceID,
-                                  nsAtom* aName,
+                                  const nsAtom* aName,
                                   AttrValuesArray* aValues,
                                   nsCaseTreatment aCaseSensitive) const;
 
   /**
    * Set attribute values. All attribute values are assumed to have a
    * canonical string representation that can be used for these
    * methods. The SetAttr method is assumed to perform a translation
    * of the canonical form into the underlying content specific
@@ -1009,17 +1010,17 @@ private:
   void DescribeAttribute(uint32_t index, nsAString& aOutDescription) const;
 
   static bool
   FindAttributeDependence(const nsAtom* aAttribute,
                           const MappedAttributeEntry* const aMaps[],
                           uint32_t aMapCount);
 
 protected:
-  inline bool GetAttr(int32_t aNameSpaceID, nsAtom* aName,
+  inline bool GetAttr(int32_t aNameSpaceID, const nsAtom* aName,
                       DOMString& aResult) const
   {
     NS_ASSERTION(nullptr != aName, "must have attribute name");
     NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
                  "must have a real namespace ID!");
     MOZ_ASSERT(aResult.IsEmpty(), "Should have empty string coming in");
     const nsAttrValue* val = mAttrs.GetAttr(aName, aNameSpaceID);
     if (val) {
@@ -1458,22 +1459,22 @@ public:
   // Work around silly C++ name hiding stuff
   nsIFrame* GetPrimaryFrame() const { return nsIContent::GetPrimaryFrame(); }
 
   bool IsDisplayContents() const
   {
     return HasServoData() && Servo_Element_IsDisplayContents(this);
   }
 
-  const nsAttrValue* GetParsedAttr(nsAtom* aAttr) const
+  const nsAttrValue* GetParsedAttr(const nsAtom* aAttr) const
   {
     return mAttrs.GetAttr(aAttr);
   }
 
-  const nsAttrValue* GetParsedAttr(nsAtom* aAttr, int32_t aNameSpaceID) const
+  const nsAttrValue* GetParsedAttr(const nsAtom* aAttr, int32_t aNameSpaceID) const
   {
     return mAttrs.GetAttr(aAttr, aNameSpaceID);
   }
 
   /**
    * Returns the attribute map, if there is one.
    *
    * @return existing attribute map or nullptr.
@@ -1492,17 +1493,17 @@ public:
   /**
    * Get the attr info for the given namespace ID and attribute name.  The
    * namespace ID must not be kNameSpaceID_Unknown and the name must not be
    * null.  Note that this can only return info on attributes that actually
    * live on this element (and is only virtual to handle XUL prototypes).  That
    * is, this should only be called from methods that only care about attrs
    * that effectively live in mAttrs.
    */
-  BorrowedAttrInfo GetAttrInfo(int32_t aNamespaceID, nsAtom* aName) const
+  BorrowedAttrInfo GetAttrInfo(int32_t aNamespaceID, const nsAtom* aName) const
   {
     NS_ASSERTION(aName, "must have attribute name");
     NS_ASSERTION(aNamespaceID != kNameSpaceID_Unknown,
                  "must have a real namespace ID!");
 
     int32_t index = mAttrs.IndexOfAttr(aName, aNamespaceID);
     if (index < 0) {
       return BorrowedAttrInfo(nullptr, nullptr);
@@ -2013,42 +2014,42 @@ private:
   RefPtr<nsBindingManager> mManager;
   RefPtr<nsIContent> mContent;
   nsCOMPtr<nsIDocument> mDoc;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(Element, NS_ELEMENT_IID)
 
 inline bool
-Element::HasAttr(int32_t aNameSpaceID, nsAtom* aName) const
+Element::HasAttr(int32_t aNameSpaceID, const nsAtom* aName) const
 {
   NS_ASSERTION(nullptr != aName, "must have attribute name");
   NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
                "must have a real namespace ID!");
 
   return mAttrs.IndexOfAttr(aName, aNameSpaceID) >= 0;
 }
 
 inline bool
 Element::AttrValueIs(int32_t aNameSpaceID,
-                     nsAtom* aName,
+                     const nsAtom* aName,
                      const nsAString& aValue,
                      nsCaseTreatment aCaseSensitive) const
 {
   NS_ASSERTION(aName, "Must have attr name");
   NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, "Must have namespace");
 
   const nsAttrValue* val = mAttrs.GetAttr(aName, aNameSpaceID);
   return val && val->Equals(aValue, aCaseSensitive);
 }
 
 inline bool
 Element::AttrValueIs(int32_t aNameSpaceID,
-                     nsAtom* aName,
-                     nsAtom* aValue,
+                     const nsAtom* aName,
+                     const nsAtom* aValue,
                      nsCaseTreatment aCaseSensitive) const
 {
   NS_ASSERTION(aName, "Must have attr name");
   NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, "Must have namespace");
   NS_ASSERTION(aValue, "Null value atom");
 
   const nsAttrValue* val = mAttrs.GetAttr(aName, aNameSpaceID);
   return val && val->Equals(aValue, aCaseSensitive);
--- a/dom/base/NodeInfo.h
+++ b/dom/base/NodeInfo.h
@@ -149,33 +149,33 @@ public:
    * Utility functions that can be used to check if a nodeinfo holds a specific
    * name, name and prefix, name and prefix and namespace ID, or just
    * namespace ID.
    */
   inline bool Equals(NodeInfo* aNodeInfo) const;
 
   bool NameAndNamespaceEquals(NodeInfo* aNodeInfo) const;
 
-  bool Equals(nsAtom* aNameAtom) const
+  bool Equals(const nsAtom* aNameAtom) const
   {
     return mInner.mName == aNameAtom;
   }
 
-  bool Equals(nsAtom* aNameAtom, nsAtom* aPrefixAtom) const
+  bool Equals(const nsAtom* aNameAtom, const nsAtom* aPrefixAtom) const
   {
     return (mInner.mName == aNameAtom) && (mInner.mPrefix == aPrefixAtom);
   }
 
-  bool Equals(nsAtom* aNameAtom, int32_t aNamespaceID) const
+  bool Equals(const nsAtom* aNameAtom, int32_t aNamespaceID) const
   {
     return ((mInner.mName == aNameAtom) &&
             (mInner.mNamespaceID == aNamespaceID));
   }
 
-  bool Equals(nsAtom* aNameAtom, nsAtom* aPrefixAtom, int32_t aNamespaceID) const
+  bool Equals(const nsAtom* aNameAtom, const nsAtom* aPrefixAtom, int32_t aNamespaceID) const
   {
     return ((mInner.mName == aNameAtom) &&
             (mInner.mPrefix == aPrefixAtom) &&
             (mInner.mNamespaceID == aNamespaceID));
   }
 
   bool NamespaceEquals(int32_t aNamespaceID) const
   {
@@ -187,17 +187,17 @@ public:
   inline bool Equals(const nsAString& aName, const nsAString& aPrefix) const;
 
   inline bool Equals(const nsAString& aName, int32_t aNamespaceID) const;
 
   inline bool Equals(const nsAString& aName, const nsAString& aPrefix, int32_t aNamespaceID) const;
 
   bool NamespaceEquals(const nsAString& aNamespaceURI) const;
 
-  inline bool QualifiedNameEquals(nsAtom* aNameAtom) const;
+  inline bool QualifiedNameEquals(const nsAtom* aNameAtom) const;
 
   bool QualifiedNameEquals(const nsAString& aQualifiedName) const
   {
     return mQualifiedName == aQualifiedName;
   }
 
   /*
    * Retrieve a pointer to the document that owns this node info.
--- a/dom/base/NodeInfoInlines.h
+++ b/dom/base/NodeInfoInlines.h
@@ -53,32 +53,32 @@ inline bool
 NodeInfo::Equals(const nsAString& aName, const nsAString& aPrefix,
                  int32_t aNamespaceID) const
 {
   return mInner.mName->Equals(aName) && mInner.mNamespaceID == aNamespaceID &&
     (mInner.mPrefix ? mInner.mPrefix->Equals(aPrefix) : aPrefix.IsEmpty());
 }
 
 inline bool
-NodeInfo::QualifiedNameEquals(nsAtom* aNameAtom) const
+NodeInfo::QualifiedNameEquals(const nsAtom* aNameAtom) const
 {
   MOZ_ASSERT(aNameAtom, "Must have name atom");
   if (!GetPrefixAtom()) {
     return Equals(aNameAtom);
   }
 
   return aNameAtom->Equals(mQualifiedName);
 }
 
 } // namespace dom
 } // namespace mozilla
 
 inline void
-CheckValidNodeInfo(uint16_t aNodeType, nsAtom *aName, int32_t aNamespaceID,
-                   nsAtom* aExtraName)
+CheckValidNodeInfo(uint16_t aNodeType, const nsAtom *aName,
+                   int32_t aNamespaceID, const nsAtom* aExtraName)
 {
   MOZ_ASSERT(aNodeType == nsINode::ELEMENT_NODE ||
              aNodeType == nsINode::ATTRIBUTE_NODE ||
              aNodeType == nsINode::TEXT_NODE ||
              aNodeType == nsINode::CDATA_SECTION_NODE ||
              aNodeType == nsINode::PROCESSING_INSTRUCTION_NODE ||
              aNodeType == nsINode::COMMENT_NODE ||
              aNodeType == nsINode::DOCUMENT_NODE ||
--- a/dom/base/nsAttrName.h
+++ b/dom/base/nsAttrName.h
@@ -100,28 +100,28 @@ public:
     return mBits == aOther.mBits;
   }
 
   // Faster comparison in the case we know the namespace is null
   // Note that some callers such as AttrArray::IndexOfAttr() will
   // call this function on nsAttrName structs with 0 mBits, so no attempt
   // must be made to do anything with mBits besides comparing it with the
   // incoming aAtom argument.
-  bool Equals(nsAtom* aAtom) const
+  bool Equals(const nsAtom* aAtom) const
   {
     return reinterpret_cast<uintptr_t>(aAtom) == mBits;
   }
 
   // And the same but without forcing callers to atomize
   bool Equals(const nsAString& aLocalName) const
   {
     return IsAtom() && Atom()->Equals(aLocalName);
   }
 
-  bool Equals(nsAtom* aLocalName, int32_t aNamespaceID) const
+  bool Equals(const nsAtom* aLocalName, int32_t aNamespaceID) const
   {
     if (aNamespaceID == kNameSpaceID_None) {
       return Equals(aLocalName);
     }
     return !IsAtom() && NodeInfo()->Equals(aLocalName, aNamespaceID);
   }
 
   bool Equals(mozilla::dom::NodeInfo* aNodeInfo) const
@@ -182,17 +182,17 @@ public:
   uint32_t HashValue() const
   {
     // mBits and uint32_t might have different size. This should silence
     // any warnings or compile-errors. This is what the implementation of
     // NS_PTR_TO_INT32 does to take care of the same problem.
     return mBits - 0;
   }
 
-  bool IsSmaller(nsAtom* aOther) const
+  bool IsSmaller(const nsAtom* aOther) const
   {
     return mBits < reinterpret_cast<uintptr_t>(aOther);
   }
 
 private:
 
   void AddRefInternalName()
   {
--- a/dom/base/nsAttrValue.cpp
+++ b/dom/base/nsAttrValue.cpp
@@ -1094,17 +1094,17 @@ nsAttrValue::Equals(const nsAString& aVa
 
   nsAutoString val;
   ToString(val);
   return aCaseSensitive == eCaseMatters ? val.Equals(aValue) :
     nsContentUtils::EqualsIgnoreASCIICase(val, aValue);
 }
 
 bool
-nsAttrValue::Equals(nsAtom* aValue, nsCaseTreatment aCaseSensitive) const
+nsAttrValue::Equals(const nsAtom* aValue, nsCaseTreatment aCaseSensitive) const
 {
   if (aCaseSensitive != eCaseMatters) {
     // Need a better way to handle this!
     nsAutoString value;
     aValue->ToString(value);
     return Equals(value, aCaseSensitive);
   }
 
--- a/dom/base/nsAttrValue.h
+++ b/dom/base/nsAttrValue.h
@@ -214,17 +214,17 @@ public:
   // Returns the atom at aIndex (0-based).  Do not call this with
   // aIndex >= GetAtomCount().
   nsAtom* AtomAt(int32_t aIndex) const;
 
   uint32_t HashValue() const;
   bool Equals(const nsAttrValue& aOther) const;
   // aCaseSensitive == eIgnoreCase means ASCII case-insenstive matching
   bool Equals(const nsAString& aValue, nsCaseTreatment aCaseSensitive) const;
-  bool Equals(nsAtom* aValue, nsCaseTreatment aCaseSensitive) const;
+  bool Equals(const nsAtom* aValue, nsCaseTreatment aCaseSensitive) const;
 
   /**
    * Compares this object with aOther according to their string representation.
    *
    * For example, when called on an object with type eInteger and value 4, and
    * given aOther of type eString and value "4", EqualsAsStrings will return
    * true (while Equals will return false).
    */
--- a/dom/base/nsIContent.h
+++ b/dom/base/nsIContent.h
@@ -248,65 +248,65 @@ public:
     return mNodeInfo->NamespaceID();
   }
 
   inline bool IsHTMLElement() const
   {
     return IsInNamespace(kNameSpaceID_XHTML);
   }
 
-  inline bool IsHTMLElement(nsAtom* aTag) const
+  inline bool IsHTMLElement(const nsAtom* aTag) const
   {
     return mNodeInfo->Equals(aTag, kNameSpaceID_XHTML);
   }
 
   template<typename First, typename... Args>
   inline bool IsAnyOfHTMLElements(First aFirst, Args... aArgs) const
   {
     return IsHTMLElement() && IsNodeInternal(aFirst, aArgs...);
   }
 
   inline bool IsSVGElement() const
   {
     return IsInNamespace(kNameSpaceID_SVG);
   }
 
-  inline bool IsSVGElement(nsAtom* aTag) const
+  inline bool IsSVGElement(const nsAtom* aTag) const
   {
     return mNodeInfo->Equals(aTag, kNameSpaceID_SVG);
   }
 
   template<typename First, typename... Args>
   inline bool IsAnyOfSVGElements(First aFirst, Args... aArgs) const
   {
     return IsSVGElement() && IsNodeInternal(aFirst, aArgs...);
   }
 
   inline bool IsXULElement() const
   {
     return IsInNamespace(kNameSpaceID_XUL);
   }
 
-  inline bool IsXULElement(nsAtom* aTag) const
+  inline bool IsXULElement(const nsAtom* aTag) const
   {
     return mNodeInfo->Equals(aTag, kNameSpaceID_XUL);
   }
 
   template<typename First, typename... Args>
   inline bool IsAnyOfXULElements(First aFirst, Args... aArgs) const
   {
     return IsXULElement() && IsNodeInternal(aFirst, aArgs...);
   }
 
   inline bool IsMathMLElement() const
   {
     return IsInNamespace(kNameSpaceID_MathML);
   }
 
-  inline bool IsMathMLElement(nsAtom* aTag) const
+  inline bool IsMathMLElement(const nsAtom* aTag) const
   {
     return mNodeInfo->Equals(aTag, kNameSpaceID_MathML);
   }
 
   template<typename First, typename... Args>
   inline bool IsAnyOfMathMLElements(First aFirst, Args... aArgs) const
   {
     return IsMathMLElement() && IsNodeInternal(aFirst, aArgs...);
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -168,17 +168,17 @@ nsINode::nsINode(already_AddRefed<mozill
 
 nsINode::~nsINode()
 {
   MOZ_ASSERT(!HasSlots(), "nsNodeUtils::LastRelease was not called?");
   MOZ_ASSERT(mSubtreeRoot == this, "Didn't restore state properly?");
 }
 
 void*
-nsINode::GetProperty(nsAtom* aPropertyName, nsresult* aStatus) const
+nsINode::GetProperty(const nsAtom* aPropertyName, nsresult* aStatus) const
 {
   if (!HasProperties()) { // a fast HasFlag() test
     if (aStatus) {
       *aStatus = NS_PROPTABLE_PROP_NOT_THERE;
     }
     return nullptr;
   }
   return OwnerDoc()->PropertyTable().GetProperty(this, aPropertyName, aStatus);
@@ -199,23 +199,23 @@ nsINode::SetProperty(nsAtom* aPropertyNa
   if (NS_SUCCEEDED(rv)) {
     SetFlags(NODE_HAS_PROPERTIES);
   }
 
   return rv;
 }
 
 void
-nsINode::DeleteProperty(nsAtom* aPropertyName)
+nsINode::DeleteProperty(const nsAtom* aPropertyName)
 {
   OwnerDoc()->PropertyTable().DeleteProperty(this, aPropertyName);
 }
 
 void*
-nsINode::UnsetProperty(nsAtom* aPropertyName, nsresult* aStatus)
+nsINode::UnsetProperty(const nsAtom* aPropertyName, nsresult* aStatus)
 {
   return OwnerDoc()->PropertyTable().UnsetProperty(this, aPropertyName, aStatus);
 }
 
 nsINode::nsSlots*
 nsINode::CreateSlots()
 {
   return new nsSlots();
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -726,65 +726,65 @@ protected:
   }
 
 public:
   inline bool IsHTMLElement() const
   {
     return IsElement() && IsInNamespace(kNameSpaceID_XHTML);
   }
 
-  inline bool IsHTMLElement(nsAtom* aTag) const
+  inline bool IsHTMLElement(const nsAtom* aTag) const
   {
     return IsElement() && mNodeInfo->Equals(aTag, kNameSpaceID_XHTML);
   }
 
   template<typename First, typename... Args>
   inline bool IsAnyOfHTMLElements(First aFirst, Args... aArgs) const
   {
     return IsHTMLElement() && IsNodeInternal(aFirst, aArgs...);
   }
 
   inline bool IsSVGElement() const
   {
     return IsElement() && IsInNamespace(kNameSpaceID_SVG);
   }
 
-  inline bool IsSVGElement(nsAtom* aTag) const
+  inline bool IsSVGElement(const nsAtom* aTag) const
   {
     return IsElement() && mNodeInfo->Equals(aTag, kNameSpaceID_SVG);
   }
 
   template<typename First, typename... Args>
   inline bool IsAnyOfSVGElements(First aFirst, Args... aArgs) const
   {
     return IsSVGElement() && IsNodeInternal(aFirst, aArgs...);
   }
 
   inline bool IsXULElement() const
   {
     return IsElement() && IsInNamespace(kNameSpaceID_XUL);
   }
 
-  inline bool IsXULElement(nsAtom* aTag) const
+  inline bool IsXULElement(const nsAtom* aTag) const
   {
     return IsElement() && mNodeInfo->Equals(aTag, kNameSpaceID_XUL);
   }
 
   template<typename First, typename... Args>
   inline bool IsAnyOfXULElements(First aFirst, Args... aArgs) const
   {
     return IsXULElement() && IsNodeInternal(aFirst, aArgs...);
   }
 
   inline bool IsMathMLElement() const
   {
     return IsElement() && IsInNamespace(kNameSpaceID_MathML);
   }
 
-  inline bool IsMathMLElement(nsAtom* aTag) const
+  inline bool IsMathMLElement(const nsAtom* aTag) const
   {
     return IsElement() && mNodeInfo->Equals(aTag, kNameSpaceID_MathML);
   }
 
   template<typename First, typename... Args>
   inline bool IsAnyOfMathMLElements(First aFirst, Args... aArgs) const
   {
     return IsMathMLElement() && IsNodeInternal(aFirst, aArgs...);
@@ -860,17 +860,17 @@ public:
    * @param aPropertyName  name of property to get.
    * @param aStatus        out parameter for storing resulting status.
    *                       Set to NS_PROPTABLE_PROP_NOT_THERE if the property
    *                       is not set.
    * @return               the property. Null if the property is not set
    *                       (though a null return value does not imply the
    *                       property was not set, i.e. it can be set to null).
    */
-  void* GetProperty(nsAtom* aPropertyName, nsresult* aStatus = nullptr) const;
+  void* GetProperty(const nsAtom* aPropertyName, nsresult* aStatus = nullptr) const;
 
   /**
    * Set a property to be associated with this node. This will overwrite an
    * existing value if one exists. The existing value is destroyed using the
    * destructor function given when that value was set.
    *
    * @param aPropertyName  name of property to set.
    * @param aValue         new value of property.
@@ -899,32 +899,32 @@ public:
   }
 
   /**
    * Destroys a property associated with this node. The value is destroyed
    * using the destruction function given when that value was set.
    *
    * @param aPropertyName  name of property to destroy.
    */
-  void DeleteProperty(nsAtom* aPropertyName);
+  void DeleteProperty(const nsAtom* aPropertyName);
 
   /**
    * Unset a property associated with this node. The value will not be
    * destroyed but rather returned. It is the caller's responsibility to
    * destroy the value after that point.
    *
    * @param aPropertyName  name of property to unset.
    * @param aStatus        out parameter for storing resulting status.
    *                       Set to NS_PROPTABLE_PROP_NOT_THERE if the property
    *                       is not set.
    * @return               the property. Null if the property is not set
    *                       (though a null return value does not imply the
    *                       property was not set, i.e. it can be set to null).
    */
-  void* UnsetProperty(nsAtom* aPropertyName, nsresult* aStatus = nullptr);
+  void* UnsetProperty(const nsAtom* aPropertyName, nsresult* aStatus = nullptr);
 
   bool HasProperties() const
   {
     return HasFlag(NODE_HAS_PROPERTIES);
   }
 
   /**
    * Return the principal of this node.  This is guaranteed to never be a null
--- a/dom/base/nsMappedAttributes.cpp
+++ b/dom/base/nsMappedAttributes.cpp
@@ -170,17 +170,17 @@ nsMappedAttributes::SetAndSwapAttr(nsAto
 
   new (&Attrs()[i].mName) nsAttrName(aAttrName);
   new (&Attrs()[i].mValue) nsAttrValue();
   Attrs()[i].mValue.SwapValueWith(aValue);
   ++mAttrCount;
 }
 
 const nsAttrValue*
-nsMappedAttributes::GetAttr(nsAtom* aAttrName) const
+nsMappedAttributes::GetAttr(const nsAtom* aAttrName) const
 {
   MOZ_ASSERT(aAttrName, "null name");
 
   for (uint32_t i = 0; i < mAttrCount; ++i) {
     if (Attrs()[i].mName.Equals(aAttrName)) {
       return &Attrs()[i].mValue;
     }
   }
@@ -273,17 +273,17 @@ nsMappedAttributes::GetExistingAttrNameF
       }
     }
   }
 
   return nullptr;
 }
 
 int32_t
-nsMappedAttributes::IndexOfAttr(nsAtom* aLocalName) const
+nsMappedAttributes::IndexOfAttr(const nsAtom* aLocalName) const
 {
   uint32_t i;
   for (i = 0; i < mAttrCount; ++i) {
     if (Attrs()[i].mName.Equals(aLocalName)) {
       return i;
     }
   }
 
--- a/dom/base/nsMappedAttributes.h
+++ b/dom/base/nsMappedAttributes.h
@@ -30,17 +30,17 @@ public:
   // Do not return null.
   void* operator new(size_t size, uint32_t aAttrCount = 1) CPP_THROW_NEW;
   nsMappedAttributes* Clone(bool aWillAddAttr);
 
   NS_INLINE_DECL_REFCOUNTING_WITH_DESTROY(nsMappedAttributes, LastRelease())
 
   void SetAndSwapAttr(nsAtom* aAttrName, nsAttrValue& aValue,
                       bool* aValueWasSet);
-  const nsAttrValue* GetAttr(nsAtom* aAttrName) const;
+  const nsAttrValue* GetAttr(const nsAtom* aAttrName) const;
   const nsAttrValue* GetAttr(const nsAString& aAttrName) const;
 
   uint32_t Count() const
   {
     return mAttrCount;
   }
 
   bool Equals(const nsMappedAttributes* aAttributes) const;
@@ -70,17 +70,17 @@ public:
   {
     NS_ASSERTION(aPos < mAttrCount, "out-of-bounds");
     return &Attrs()[aPos].mValue;
   }
   // Remove the attr at position aPos.  The value of the attr is placed in
   // aValue; any value that was already in aValue is destroyed.
   void RemoveAttrAt(uint32_t aPos, nsAttrValue& aValue);
   const nsAttrName* GetExistingAttrNameFromQName(const nsAString& aName) const;
-  int32_t IndexOfAttr(nsAtom* aLocalName) const;
+  int32_t IndexOfAttr(const nsAtom* aLocalName) const;
 
   // Apply the contained mapper to the contained set of servo rules,
   // unless the servo rules have already been initialized.
   void LazilyResolveServoDeclaration(nsIDocument* aDocument);
 
   // Obtain the contained servo declaration block
   // May return null if called before the inner block
   // has been (lazily) resolved
--- a/dom/base/nsPropertyTable.cpp
+++ b/dom/base/nsPropertyTable.cpp
@@ -36,17 +36,17 @@ public:
 
   // Removes the property associated with the given object, and destroys
   // the property value
   bool DeletePropertyFor(nsPropertyOwner aObject);
 
   // Destroy all remaining properties (without removing them)
   void Destroy();
 
-  bool Equals(nsAtom *aPropertyName)
+  bool Equals(const nsAtom *aPropertyName)
   {
     return mName == aPropertyName;
   }
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
 
   RefPtr<nsAtom>  mName;           // property name
   PLDHashTable       mObjectValueMap; // map of object/value pairs
@@ -131,17 +131,17 @@ nsPropertyTable::EnumerateAll(NSProperty
       aCallBack(const_cast<void*>(entry->key), prop->mName, entry->value,
                 aData);
     }
   }
 }
 
 void*
 nsPropertyTable::GetPropertyInternal(nsPropertyOwner aObject,
-                                     nsAtom* aPropertyName,
+                                     const nsAtom* aPropertyName,
                                      bool aRemove,
                                      nsresult* aResult)
 {
   MOZ_ASSERT(aPropertyName && aObject, "unexpected null param");
   nsresult rv = NS_PROPTABLE_PROP_NOT_THERE;
   void *propValue = nullptr;
 
   PropertyList* propertyList = GetPropertyListFor(aPropertyName);
@@ -211,31 +211,31 @@ nsPropertyTable::SetPropertyInternal(nsP
   entry->key = aObject;
   entry->value = aPropertyValue;
 
   return result;
 }
 
 nsresult
 nsPropertyTable::DeleteProperty(nsPropertyOwner aObject,
-                                nsAtom* aPropertyName)
+                                const nsAtom* aPropertyName)
 {
   MOZ_ASSERT(aPropertyName && aObject, "unexpected null param");
 
   PropertyList* propertyList = GetPropertyListFor(aPropertyName);
   if (propertyList) {
     if (propertyList->DeletePropertyFor(aObject))
       return NS_OK;
   }
 
   return NS_PROPTABLE_PROP_NOT_THERE;
 }
 
 nsPropertyTable::PropertyList*
-nsPropertyTable::GetPropertyListFor(nsAtom* aPropertyName) const
+nsPropertyTable::GetPropertyListFor(const nsAtom* aPropertyName) const
 {
   PropertyList* result;
 
   for (result = mPropertyList; result; result = result->mNext) {
     if (result->Equals(aPropertyName)) {
       break;
     }
   }
--- a/dom/base/nsPropertyTable.h
+++ b/dom/base/nsPropertyTable.h
@@ -56,17 +56,17 @@ private:
 class nsPropertyTable
 {
  public:
   /**
    * Get the value of the property |aPropertyName| for node |aObject|.
    * |aResult|, if supplied, is filled in with a return status code.
    **/
   void* GetProperty(const nsPropertyOwner& aObject,
-                    nsAtom    *aPropertyName,
+                    const nsAtom *aPropertyName,
                     nsresult   *aResult = nullptr)
   {
     return GetPropertyInternal(aObject, aPropertyName, false, aResult);
   }
 
   /**
    * Set the value of the property |aPropertyName| to
    * |aPropertyValue| for node |aObject|.  |aDtor| is a destructor for the
@@ -92,25 +92,25 @@ class nsPropertyTable
     return SetPropertyInternal(aObject, aPropertyName, aPropertyValue,
                                aDtor, aDtorData, aTransfer);
   }
 
   /**
    * Delete the property |aPropertyName| in the global category for object
    * |aObject|. The property's destructor function will be called.
    */
-  nsresult DeleteProperty(nsPropertyOwner aObject, nsAtom* aPropertyName);
+  nsresult DeleteProperty(nsPropertyOwner aObject, const nsAtom* aPropertyName);
 
   /**
    * Unset the property |aPropertyName| in the global category for object
    * |aObject|, but do not call the property's destructor function.  The
    * property value is returned.
    */
   void* UnsetProperty(const nsPropertyOwner& aObject,
-                      nsAtom* aPropertyName,
+                      const nsAtom* aPropertyName,
                       nsresult* aStatus = nullptr)
   {
     return GetPropertyInternal(aObject, aPropertyName, true, aStatus);
   }
 
   /**
    * Deletes all of the properties for object |aObject|, calling the
    * destructor function for each property.
@@ -162,19 +162,19 @@ class nsPropertyTable
 
   class PropertyList;
 
   size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
  private:
   void DestroyPropertyList();
-  PropertyList* GetPropertyListFor(nsAtom* aPropertyName) const;
+  PropertyList* GetPropertyListFor(const nsAtom* aPropertyName) const;
   void* GetPropertyInternal(nsPropertyOwner aObject,
-                            nsAtom* aPropertyName,
+                            const nsAtom* aPropertyName,
                             bool aRemove,
                             nsresult* aStatus);
   nsresult SetPropertyInternal(nsPropertyOwner aObject,
                                nsAtom* aPropertyName,
                                void* aPropertyValue,
                                NSPropertyDtorFunc  aDtor,
                                void* aDtorData,
                                bool aTransfer);