mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Fix xml_name_type()
Names with a trailing colon are not qualified names.
This commit is contained in:
parent
1906f835b9
commit
c557736d26
5 changed files with 9 additions and 35 deletions
|
@ -653,7 +653,7 @@ pub fn xml_name_type(name: &str) -> XMLName {
|
||||||
let mut iter = name.chars();
|
let mut iter = name.chars();
|
||||||
let mut non_qname_colons = false;
|
let mut non_qname_colons = false;
|
||||||
let mut seen_colon = false;
|
let mut seen_colon = false;
|
||||||
match iter.next() {
|
let mut last = match iter.next() {
|
||||||
None => return XMLName::InvalidXMLName,
|
None => return XMLName::InvalidXMLName,
|
||||||
Some(c) => {
|
Some(c) => {
|
||||||
if !is_valid_start(c) {
|
if !is_valid_start(c) {
|
||||||
|
@ -662,10 +662,11 @@ pub fn xml_name_type(name: &str) -> XMLName {
|
||||||
if c == ':' {
|
if c == ':' {
|
||||||
non_qname_colons = true;
|
non_qname_colons = true;
|
||||||
}
|
}
|
||||||
|
c
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
for c in name.chars() {
|
for c in iter {
|
||||||
if !is_valid_continuation(c) {
|
if !is_valid_continuation(c) {
|
||||||
return XMLName::InvalidXMLName;
|
return XMLName::InvalidXMLName;
|
||||||
}
|
}
|
||||||
|
@ -675,6 +676,11 @@ pub fn xml_name_type(name: &str) -> XMLName {
|
||||||
false => seen_colon = true
|
false => seen_colon = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
last = c
|
||||||
|
}
|
||||||
|
|
||||||
|
if last == ':' {
|
||||||
|
non_qname_colons = true
|
||||||
}
|
}
|
||||||
|
|
||||||
match non_qname_colons {
|
match non_qname_colons {
|
||||||
|
|
|
@ -6,27 +6,18 @@
|
||||||
[createDocument test 41: undefined,"xmlns",null,"NAMESPACE_ERR"]
|
[createDocument test 41: undefined,"xmlns",null,"NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[createDocument test 52: "http://example.com/","foo:",null,"NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createDocument test 64: "http://example.com/","xmlns",null,"NAMESPACE_ERR"]
|
[createDocument test 64: "http://example.com/","xmlns",null,"NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[createDocument test 69: "http://example.com/","xmlns:foo",null,"NAMESPACE_ERR"]
|
[createDocument test 69: "http://example.com/","xmlns:foo",null,"NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[createDocument test 106: "/","foo:",null,"NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createDocument test 108: "/","xmlns",null,"NAMESPACE_ERR"]
|
[createDocument test 108: "/","xmlns",null,"NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[createDocument test 111: "/","xmlns:foo",null,"NAMESPACE_ERR"]
|
[createDocument test 111: "/","xmlns:foo",null,"NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[createDocument test 119: "http://www.w3.org/XML/1998/namespace","foo:",null,"NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createDocument test 121: "http://www.w3.org/XML/1998/namespace","xmlns",null,"NAMESPACE_ERR"]
|
[createDocument test 121: "http://www.w3.org/XML/1998/namespace","xmlns",null,"NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -36,9 +27,6 @@
|
||||||
[createDocument test 141: "http://www.w3.org/2000/xmlns/","foo:xmlns",null,"NAMESPACE_ERR"]
|
[createDocument test 141: "http://www.w3.org/2000/xmlns/","foo:xmlns",null,"NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[createDocument test 148: "foo:","foo:",null,"NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createDocument test 150: "foo:","xmlns",null,"NAMESPACE_ERR"]
|
[createDocument test 150: "foo:","xmlns",null,"NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[DOMImplementation-createDocumentType.html]
|
|
||||||
type: testharness
|
|
||||||
[createDocumentType("foo:", "", "") should throw NAMESPACE_ERR]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -6,27 +6,18 @@
|
||||||
[createElementNS test 41: undefined,"xmlns","NAMESPACE_ERR"]
|
[createElementNS test 41: undefined,"xmlns","NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[createElementNS test 52: "http://example.com/","foo:","NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createElementNS test 64: "http://example.com/","xmlns","NAMESPACE_ERR"]
|
[createElementNS test 64: "http://example.com/","xmlns","NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[createElementNS test 69: "http://example.com/","xmlns:foo","NAMESPACE_ERR"]
|
[createElementNS test 69: "http://example.com/","xmlns:foo","NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[createElementNS test 106: "/","foo:","NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createElementNS test 108: "/","xmlns","NAMESPACE_ERR"]
|
[createElementNS test 108: "/","xmlns","NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[createElementNS test 111: "/","xmlns:foo","NAMESPACE_ERR"]
|
[createElementNS test 111: "/","xmlns:foo","NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[createElementNS test 119: "http://www.w3.org/XML/1998/namespace","foo:","NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createElementNS test 121: "http://www.w3.org/XML/1998/namespace","xmlns","NAMESPACE_ERR"]
|
[createElementNS test 121: "http://www.w3.org/XML/1998/namespace","xmlns","NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -36,9 +27,6 @@
|
||||||
[createElementNS test 141: "http://www.w3.org/2000/xmlns/","foo:xmlns","NAMESPACE_ERR"]
|
[createElementNS test 141: "http://www.w3.org/2000/xmlns/","foo:xmlns","NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[createElementNS test 148: "foo:","foo:","NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createElementNS test 150: "foo:","xmlns","NAMESPACE_ERR"]
|
[createElementNS test 150: "foo:","xmlns","NAMESPACE_ERR"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
[attributes.html]
|
[attributes.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
[When qualifiedName does not match the QName production, an NAMESPACE_ERR exception is to be thrown.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Attribute with prefix in local name]
|
[Attribute with prefix in local name]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue