mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-07 11:56:51 +00:00
Bug 245274: Be more strict about which names we allow for createElement, even in quirks mode.
r=doron sr=bz a=asa
This commit is contained in:
parent
eea43f64b5
commit
ffa6aac7b7
@ -1230,18 +1230,24 @@ nsHTMLDocument::CreateElement(const nsAString& aTagName,
|
||||
*aReturn = nsnull;
|
||||
nsresult rv;
|
||||
|
||||
// if we are in quirks, don't validate the tag name
|
||||
if (mCompatMode != eCompatibility_NavQuirks) {
|
||||
rv = nsContentUtils::CheckQName(aTagName, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
nsAutoString tagName(aTagName);
|
||||
|
||||
nsAutoString tmp(aTagName);
|
||||
if (!IsXHTML()) {
|
||||
ToLowerCase(tmp);
|
||||
// if we are in quirks, allow surrounding '<' '>' for IE compat
|
||||
if (mCompatMode == eCompatibility_NavQuirks &&
|
||||
tagName.Length() > 2 &&
|
||||
tagName.First() == '<' &&
|
||||
tagName.Last() == '>') {
|
||||
tagName = Substring(tagName, 1, tagName.Length() - 2);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(tmp);
|
||||
rv = nsContentUtils::CheckQName(tagName, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!IsXHTML()) {
|
||||
ToLowerCase(tagName);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(tagName);
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
rv = CreateElem(name, nsnull, GetDefaultNamespaceID(), PR_TRUE,
|
||||
|
Loading…
Reference in New Issue
Block a user