Bug 1411893 - Remove some unnecessary (nsAtom***) casts. r=froydnj.
authorNicholas Nethercote <nnethercote@mozilla.com>
Fri, 27 Oct 2017 08:39:55 +1100
changeset 388706 afb8a71fc9723a47b4c5d2bf59654a5eb6bbaf98
parent 388705 5312d9984be1c8f2b18a00d89667985c66e8716a
child 388707 42eb6d46aa300ec8d7e86f38a5be66a197d83f74
push id54227
push userecoal95@gmail.com
push dateFri, 27 Oct 2017 11:01:57 +0000
treeherderautoland@42eb6d46aa30 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1411893
milestone58.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 1411893 - Remove some unnecessary (nsAtom***) casts. r=froydnj. MozReview-Commit-ID: 688BShjWAhe
dom/base/nsTreeSanitizer.cpp
dom/base/nsTreeSanitizer.h
--- a/dom/base/nsTreeSanitizer.cpp
+++ b/dom/base/nsTreeSanitizer.cpp
@@ -990,17 +990,17 @@ nsTreeSanitizer::MustFlatten(int32_t aNa
   }
   if (aNamespace == kNameSpaceID_MathML) {
     return !sElementsMathML->GetEntry(aLocal);
   }
   return true;
 }
 
 bool
-nsTreeSanitizer::IsURL(nsAtom*** aURLs, nsAtom* aLocalName)
+nsTreeSanitizer::IsURL(nsAtom** const* aURLs, nsAtom* aLocalName)
 {
   nsAtom** atomPtrPtr;
   while ((atomPtrPtr = *aURLs)) {
     if (*atomPtrPtr == aLocalName) {
       return true;
     }
     ++aURLs;
   }
@@ -1158,17 +1158,17 @@ nsTreeSanitizer::SanitizeStyleSheet(cons
     }
   }
   return didSanitize;
 }
 
 void
 nsTreeSanitizer::SanitizeAttributes(mozilla::dom::Element* aElement,
                                     nsTHashtable<nsRefPtrHashKey<nsAtom>>* aAllowed,
-                                    nsAtom*** aURLs,
+                                    nsAtom** const* aURLs,
                                     bool aAllowXLink,
                                     bool aAllowStyle,
                                     bool aAllowDangerousSrc)
 {
   uint32_t ac = aElement->GetAttrCount();
 
   for (int32_t i = ac - 1; i >= 0; --i) {
     const nsAttrName* attrName = aElement->GetAttrNameAt(i);
@@ -1423,24 +1423,24 @@ nsTreeSanitizer::SanitizeChildren(nsINod
           nsContentUtils::SetNodeTextContent(node, sanitizedStyle, true);
         } else {
           // If the node had non-text child nodes, this operation zaps those.
           nsContentUtils::SetNodeTextContent(node, styleText, true);
         }
         if (ns == kNameSpaceID_XHTML) {
           SanitizeAttributes(elt,
                              sAttributesHTML,
-                             (nsAtom***)kURLAttributesHTML,
+                             kURLAttributesHTML,
                              false,
                              mAllowStyles,
                              false);
         } else {
           SanitizeAttributes(elt,
                              sAttributesSVG,
-                             (nsAtom***)kURLAttributesSVG,
+                             kURLAttributesSVG,
                              true,
                              mAllowStyles,
                              false);
         }
         node = node->GetNextNonChildNode(aRoot);
         continue;
       }
       if (MustFlatten(ns, localName)) {
@@ -1462,31 +1462,31 @@ nsTreeSanitizer::SanitizeChildren(nsINod
       }
       NS_ASSERTION(ns == kNameSpaceID_XHTML ||
                    ns == kNameSpaceID_SVG ||
                    ns == kNameSpaceID_MathML,
           "Should have only HTML, MathML or SVG here!");
       if (ns == kNameSpaceID_XHTML) {
         SanitizeAttributes(elt,
                            sAttributesHTML,
-                           (nsAtom***)kURLAttributesHTML,
+                           kURLAttributesHTML,
                            false, mAllowStyles,
                            (nsGkAtoms::img == localName) &&
                            !mCidEmbedsOnly);
       } else if (ns == kNameSpaceID_SVG) {
         SanitizeAttributes(elt,
                            sAttributesSVG,
-                           (nsAtom***)kURLAttributesSVG,
+                           kURLAttributesSVG,
                            true,
                            mAllowStyles,
                            false);
       } else {
         SanitizeAttributes(elt,
                            sAttributesMathML,
-                           (nsAtom***)kURLAttributesMathML,
+                           kURLAttributesMathML,
                            true,
                            false,
                            false);
       }
       node = node->GetNextNode(aRoot);
       continue;
     }
     NS_ASSERTION(!node->GetFirstChild(), "How come non-element node had kids?");
--- a/dom/base/nsTreeSanitizer.h
+++ b/dom/base/nsTreeSanitizer.h
@@ -108,17 +108,17 @@ class MOZ_STACK_CLASS nsTreeSanitizer {
 
     /**
      * Checks if a given local name (for an attribute) is on the given list
      * of URL attribute names.
      * @param aURLs the list of URL attribute names
      * @param aLocalName the name to search on the list
      * @return true if aLocalName is on the aURLs list and false otherwise
      */
-    bool IsURL(nsAtom*** aURLs, nsAtom* aLocalName);
+    bool IsURL(nsAtom** const* aURLs, nsAtom* aLocalName);
 
     /**
      * Removes dangerous attributes from the element. If the style attribute
      * is allowed, its value is sanitized. The values of URL attributes are
      * sanitized, except src isn't sanitized when it is allowed to remain
      * potentially dangerous.
      *
      * @param aElement the element whose attributes should be sanitized
@@ -126,17 +126,17 @@ class MOZ_STACK_CLASS nsTreeSanitizer {
      * @param aURLs the local names of URL-valued attributes
      * @param aAllowXLink whether XLink attributes are allowed
      * @param aAllowStyle whether the style attribute is allowed
      * @param aAllowDangerousSrc whether to leave the value of the src
      *                           attribute unsanitized
      */
     void SanitizeAttributes(mozilla::dom::Element* aElement,
                             nsTHashtable<nsRefPtrHashKey<nsAtom>>* aAllowed,
-                            nsAtom*** aURLs,
+                            nsAtom** const* aURLs,
                             bool aAllowXLink,
                             bool aAllowStyle,
                             bool aAllowDangerousSrc);
 
     /**
      * Remove the named URL attribute from the element if the URL fails a
      * security check.
      *