diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 107daaede6..7dc6ccb990 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -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; } }