diff --git a/dom/base/nsTreeSanitizer.cpp b/dom/base/nsTreeSanitizer.cpp index ce6e4db868bf..f54d99468ff9 100644 --- a/dom/base/nsTreeSanitizer.cpp +++ b/dom/base/nsTreeSanitizer.cpp @@ -2424,9 +2424,7 @@ void nsTreeSanitizer::WithWebSanitizerOptions( const Sequence& allowedElements = aOptions.mAllowElements.Value(); mAllowElements = MakeUnique(allowedElements.Length()); for (const nsString& elem : allowedElements) { - nsAutoString lowercaseElem; - nsContentUtils::ASCIIToLower(elem, lowercaseElem); - RefPtr elAsAtom = NS_AtomizeMainThread(lowercaseElem); + RefPtr elAsAtom = NS_AtomizeMainThread(elem); mAllowElements->Insert(elAsAtom); } } @@ -2435,9 +2433,7 @@ void nsTreeSanitizer::WithWebSanitizerOptions( const Sequence& blockedElements = aOptions.mBlockElements.Value(); mBlockElements = MakeUnique(blockedElements.Length()); for (const nsString& elem : blockedElements) { - nsAutoString lowercaseElem; - nsContentUtils::ASCIIToLower(elem, lowercaseElem); - RefPtr elAsAtom = NS_AtomizeMainThread(lowercaseElem); + RefPtr elAsAtom = NS_AtomizeMainThread(elem); mBlockElements->Insert(elAsAtom); } } @@ -2446,9 +2442,7 @@ void nsTreeSanitizer::WithWebSanitizerOptions( const Sequence& dropElements = aOptions.mDropElements.Value(); mDropElements = MakeUnique(dropElements.Length()); for (const nsString& elem : dropElements) { - nsAutoString lowercaseElem; - nsContentUtils::ASCIIToLower(elem, lowercaseElem); - RefPtr elAsAtom = NS_AtomizeMainThread(lowercaseElem); + RefPtr elAsAtom = NS_AtomizeMainThread(elem); mDropElements->Insert(elAsAtom); } } @@ -2462,14 +2456,10 @@ void nsTreeSanitizer::WithWebSanitizerOptions( UniquePtr elems = MakeUnique(allowedAttributes.Entries().Length()); for (const auto& elem : entries.mValue) { - nsAutoString lowercaseElem; - nsContentUtils::ASCIIToLower(elem, lowercaseElem); - RefPtr elAsAtom = NS_Atomize(lowercaseElem); + RefPtr elAsAtom = NS_AtomizeMainThread(elem); elems->Insert(elAsAtom); } - nsAutoString attrName; - nsContentUtils::ASCIIToLower(entries.mKey, attrName); - RefPtr attrAtom = NS_Atomize(attrName); + RefPtr attrAtom = NS_AtomizeMainThread(entries.mKey); mAllowedAttributes->InsertOrUpdate(attrAtom, std::move(elems)); } } @@ -2483,17 +2473,11 @@ void nsTreeSanitizer::WithWebSanitizerOptions( UniquePtr elems = MakeUnique(droppedAttributes.Entries().Length()); for (const auto& elem : entries.mValue) { - nsAutoString lowercaseElem; - nsContentUtils::ASCIIToLower(elem, lowercaseElem); - RefPtr elAsAtom = NS_Atomize(lowercaseElem); + RefPtr elAsAtom = NS_AtomizeMainThread(elem); elems->Insert(elAsAtom); } - nsAutoString attrName; - nsContentUtils::ASCIIToLower(entries.mKey, attrName); - RefPtr attrAtom = NS_Atomize(attrName); + RefPtr attrAtom = NS_AtomizeMainThread(entries.mKey); mDroppedAttributes->InsertOrUpdate(attrAtom, std::move(elems)); } } - - // TODO(freddy) Add handling of other keys in SanitizerConfig } diff --git a/testing/web-platform/meta/sanitizer-api/sanitizer-sanitize.https.tentative.html.ini b/testing/web-platform/meta/sanitizer-api/sanitizer-sanitize.https.tentative.html.ini index 9933bdd18e99..c1f4e4ba4901 100644 --- a/testing/web-platform/meta/sanitizer-api/sanitizer-sanitize.https.tentative.html.ini +++ b/testing/web-platform/meta/sanitizer-api/sanitizer-sanitize.https.tentative.html.ini @@ -33,15 +33,6 @@ [SanitizerAPI with config: HTMLButtonElement with javascript formaction start with space, sanitize from document function for ] expected: FAIL - [SanitizerAPI with config: dropElements list ["I", "DL"\]}, sanitize from document function for ] - expected: FAIL - - [SanitizerAPI with config: dropAttributes list {"ID": ["*"\]} with id attribute, sanitize from document function for ] - expected: FAIL - - [SanitizerAPI with config: dropAttributes list {"ID": ["*"\]} with ID attribute, sanitize from document function for ] - expected: FAIL - [SanitizerAPI with config: allowAttributes unknown attributes and with allowUnknownMarkup, sanitize from document function for ] expected: FAIL @@ -78,14 +69,5 @@ [SanitizerAPI with config: HTMLButtonElement with javascript formaction start with space, sanitize from document fragment function for