Bug 1411893 - Remove some unnecessary (nsAtom***) casts. r=froydnj.
MozReview-Commit-ID: 688BShjWAhe
--- 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.
*