[dom] Update noscript serialization to the changed spec.

Make <noscript> escaping conditional on whether scripting is enabled.
This commit is contained in:
Moonchild 2021-02-24 09:05:30 +00:00 committed by roytam1
commit d86d1256bc

View file

@ -9140,10 +9140,6 @@ ShouldEscape(nsIContent* aParent)
nsGkAtoms::style, nsGkAtoms::script, nsGkAtoms::xmp,
nsGkAtoms::iframe, nsGkAtoms::noembed, nsGkAtoms::noframes,
nsGkAtoms::plaintext,
// Per the current spec noscript should be escaped in case
// scripts are disabled or if document doesn't have
// browsing context. However the latter seems to be a spec bug
// and Gecko hasn't traditionally done the former.
nsGkAtoms::noscript
};
static mozilla::BloomFilter<12, nsIAtom> sFilter;
@ -9159,6 +9155,10 @@ ShouldEscape(nsIContent* aParent)
if (sFilter.mightContain(tag)) {
for (uint32_t i = 0; i < ArrayLength(nonEscapingElements); ++i) {
if (tag == nonEscapingElements[i]) {
if (MOZ_UNLIKELY(tag == nsGkAtoms::noscript) &&
MOZ_UNLIKELY(!aParent->OwnerDoc()->IsScriptEnabled())) {
return true;
}
return false;
}
}