Bug 1410281 - Use GetBaseURIForStyleAttr for style attribute base URI in nsTreeSanitizer. r=xidorn
MozReview-Commit-ID: IBc7zEHTDAQ
--- a/dom/base/nsTreeSanitizer.cpp
+++ b/dom/base/nsTreeSanitizer.cpp
@@ -1155,26 +1155,26 @@ nsTreeSanitizer::SanitizeAttributes(mozi
for (int32_t i = ac - 1; i >= 0; --i) {
const nsAttrName* attrName = aElement->GetAttrNameAt(i);
int32_t attrNs = attrName->NamespaceID();
RefPtr<nsAtom> attrLocal = attrName->LocalName();
if (kNameSpaceID_None == attrNs) {
if (aAllowStyle && nsGkAtoms::style == attrLocal) {
- nsCOMPtr<nsIURI> baseURI = aElement->GetBaseURI();
nsIDocument* document = aElement->OwnerDoc();
// Pass the CSS Loader object to the parser, to allow parser error
// reports to include the outer window ID.
nsCSSParser parser(document->CSSLoader());
nsAutoString value;
aElement->GetAttr(attrNs, attrLocal, value);
RefPtr<mozilla::css::Declaration> decl =
parser.ParseStyleAttribute(value, document->GetDocumentURI(),
- baseURI, document->NodePrincipal());
+ aElement->GetBaseURIForStyleAttr(),
+ document->NodePrincipal());
if (decl) {
nsAutoString cleanValue;
if (SanitizeStyleDeclaration(decl, cleanValue)) {
aElement->SetAttr(kNameSpaceID_None,
nsGkAtoms::style,
cleanValue,
false);
}