зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1596458 part 1. Fix CreateContextualFragment in XML to not accidentally trigger custom element constructors. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D53076 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
1a46f0b6a3
Коммит
39eb418bd8
|
@ -4616,7 +4616,22 @@ already_AddRefed<DocumentFragment> nsContentUtils::CreateContextualFragment(
|
|||
|
||||
while (content && content->IsElement()) {
|
||||
nsString& tagName = *tagStack.AppendElement();
|
||||
tagName = content->NodeInfo()->QualifiedName();
|
||||
// It mostly doesn't actually matter what tag name we use here: XML doesn't
|
||||
// have parsing that depends on the open tag stack, apart from namespace
|
||||
// declarations. So this whole tagStack bit is just there to get the right
|
||||
// namespace declarations to the XML parser. That said, the parser _is_
|
||||
// going to create elements with the tag names we provide here, so we need
|
||||
// to make sure they are not names that can trigger custom element
|
||||
// constructors. Just make up a name that is never going to be a valid
|
||||
// custom element name.
|
||||
//
|
||||
// The principled way to do this would probably be to add a new FromParser
|
||||
// value and make sure we use it when creating the context elements, then
|
||||
// make sure we teach all FromParser consumers (and in particular the custom
|
||||
// element code) about it as needed. But right now the XML parser never
|
||||
// actually uses FromParser values other than NOT_FROM_PARSER, and changing
|
||||
// that is pretty complicated.
|
||||
tagName.AssignLiteral("notacustomelement");
|
||||
|
||||
// see if we need to add xmlns declarations
|
||||
uint32_t count = content->AsElement()->GetAttrCount();
|
||||
|
|
Загрузка…
Ссылка в новой задаче