Skip to content

Commit

Permalink
DOM: use a single exception for name validation
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Apr 20, 2017
1 parent 40fe4a9 commit 85470b4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions dom/nodes/DOMImplementation-createDocumentType.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
["(", "", "", "INVALID_CHARACTER_ERR"],
[")", "", "", "INVALID_CHARACTER_ERR"],
["f:oo", "", "", null],
[":foo", "", "", "NAMESPACE_ERR"],
["foo:", "", "", "NAMESPACE_ERR"],
["prefix::local", "", "", "NAMESPACE_ERR"],
[":foo", "", "", "INVALID_CHARACTER_ERR"],
["foo:", "", "", "INVALID_CHARACTER_ERR"],
["prefix::local", "", "", "INVALID_CHARACTER_ERR"],
["foo", "foo", "", null],
["foo", "", "foo", null],
["foo", "f'oo", "", null],
Expand Down
50 changes: 25 additions & 25 deletions dom/nodes/Document-createElementNS.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ var createElementNS_tests = [
[null, "fo o", "INVALID_CHARACTER_ERR"],
[null, "-foo", "INVALID_CHARACTER_ERR"],
[null, ".foo", "INVALID_CHARACTER_ERR"],
[null, ":foo", "NAMESPACE_ERR"],
[null, "f:oo", "NAMESPACE_ERR"],
[null, "foo:", "NAMESPACE_ERR"],
[null, "f:o:o", "NAMESPACE_ERR"],
[null, ":", "NAMESPACE_ERR"],
[null, ":foo", "INVALID_CHARACTER_ERR"],
[null, "f:oo", "INVALID_CHARACTER_ERR"],
[null, "foo:", "INVALID_CHARACTER_ERR"],
[null, "f:o:o", "INVALID_CHARACTER_ERR"],
[null, ":", "INVALID_CHARACTER_ERR"],
[null, "xml", null],
[null, "xmlns", "NAMESPACE_ERR"],
[null, "xmlfoo", null],
Expand All @@ -38,19 +38,19 @@ var createElementNS_tests = [
[null, "xmlfoo:bar", "NAMESPACE_ERR"],
[null, "null:xml", "NAMESPACE_ERR"],
["", null, null],
["", ":foo", "NAMESPACE_ERR"],
["", ":foo", "INVALID_CHARACTER_ERR"],
["", "f:oo", "NAMESPACE_ERR"],
["", "foo:", "NAMESPACE_ERR"],
["", "foo:", "INVALID_CHARACTER_ERR"],
[undefined, null, null],
[undefined, undefined, null],
[undefined, "foo", null],
[undefined, "1foo", "INVALID_CHARACTER_ERR"],
[undefined, "f1oo", null],
[undefined, "foo1", null],
[undefined, ":foo", "NAMESPACE_ERR"],
[undefined, ":foo", "INVALID_CHARACTER_ERR"],
[undefined, "f:oo", "NAMESPACE_ERR"],
[undefined, "foo:", "NAMESPACE_ERR"],
[undefined, "f::oo", "NAMESPACE_ERR"],
[undefined, "foo:", "INVALID_CHARACTER_ERR"],
[undefined, "f::oo", "INVALID_CHARACTER_ERR"],
[undefined, "xml", null],
[undefined, "xmlns", "NAMESPACE_ERR"],
[undefined, "xmlfoo", null],
Expand All @@ -65,15 +65,15 @@ var createElementNS_tests = [
["http://example.com/", ".foo", "INVALID_CHARACTER_ERR"],
["http://example.com/", "f1oo", null],
["http://example.com/", "foo1", null],
["http://example.com/", ":foo", "NAMESPACE_ERR"],
["http://example.com/", ":foo", "INVALID_CHARACTER_ERR"],
["http://example.com/", "f:oo", null],
["http://example.com/", "f:o:o", "NAMESPACE_ERR"],
["http://example.com/", "foo:", "NAMESPACE_ERR"],
["http://example.com/", "f::oo", "NAMESPACE_ERR"],
["http://example.com/", "a:0", "NAMESPACE_ERR"],
["http://example.com/", "f:o:o", "INVALID_CHARACTER_ERR"],
["http://example.com/", "foo:", "INVALID_CHARACTER_ERR"],
["http://example.com/", "f::oo", "INVALID_CHARACTER_ERR"],
["http://example.com/", "a:0", "INVALID_CHARACTER_ERR"],
["http://example.com/", "0:a", "INVALID_CHARACTER_ERR"],
["http://example.com/", "a:_", null],
["http://example.com/", "a:\u0BC6", "NAMESPACE_ERR"],
["http://example.com/", "a:\u0BC6", "INVALID_CHARACTER_ERR"],
["http://example.com/", "\u0BC6:a", "INVALID_CHARACTER_ERR"],
["http://example.com/", "a:a\u0BC6", null],
["http://example.com/", "a\u0BC6:a", null],
Expand All @@ -98,7 +98,7 @@ var createElementNS_tests = [
["http://example.com/", "xmlns:foo", "NAMESPACE_ERR"],
["http://example.com/", "XMLNS:foo", null],
["http://example.com/", "xmlfoo:bar", null],
["http://example.com/", "prefix::local", "NAMESPACE_ERR"],
["http://example.com/", "prefix::local", "INVALID_CHARACTER_ERR"],
["http://example.com/", "namespaceURI:{", "INVALID_CHARACTER_ERR"],
["http://example.com/", "namespaceURI:}", "INVALID_CHARACTER_ERR"],
["http://example.com/", "namespaceURI:~", "INVALID_CHARACTER_ERR"],
Expand Down Expand Up @@ -130,9 +130,9 @@ var createElementNS_tests = [
["/", "1foo", "INVALID_CHARACTER_ERR"],
["/", "f1oo", null],
["/", "foo1", null],
["/", ":foo", "NAMESPACE_ERR"],
["/", ":foo", "INVALID_CHARACTER_ERR"],
["/", "f:oo", null],
["/", "foo:", "NAMESPACE_ERR"],
["/", "foo:", "INVALID_CHARACTER_ERR"],
["/", "xml", null],
["/", "xmlns", "NAMESPACE_ERR"],
["/", "xmlfoo", null],
Expand All @@ -143,9 +143,9 @@ var createElementNS_tests = [
["http://www.w3.org/XML/1998/namespace", "1foo", "INVALID_CHARACTER_ERR"],
["http://www.w3.org/XML/1998/namespace", "f1oo", null],
["http://www.w3.org/XML/1998/namespace", "foo1", null],
["http://www.w3.org/XML/1998/namespace", ":foo", "NAMESPACE_ERR"],
["http://www.w3.org/XML/1998/namespace", ":foo", "INVALID_CHARACTER_ERR"],
["http://www.w3.org/XML/1998/namespace", "f:oo", null],
["http://www.w3.org/XML/1998/namespace", "foo:", "NAMESPACE_ERR"],
["http://www.w3.org/XML/1998/namespace", "foo:", "INVALID_CHARACTER_ERR"],
["http://www.w3.org/XML/1998/namespace", "xml", null],
["http://www.w3.org/XML/1998/namespace", "xmlns", "NAMESPACE_ERR"],
["http://www.w3.org/XML/1998/namespace", "xmlfoo", null],
Expand All @@ -158,9 +158,9 @@ var createElementNS_tests = [
["http://www.w3.org/2000/xmlns/", "1foo", "INVALID_CHARACTER_ERR"],
["http://www.w3.org/2000/xmlns/", "f1oo", "NAMESPACE_ERR"],
["http://www.w3.org/2000/xmlns/", "foo1", "NAMESPACE_ERR"],
["http://www.w3.org/2000/xmlns/", ":foo", "NAMESPACE_ERR"],
["http://www.w3.org/2000/xmlns/", ":foo", "INVALID_CHARACTER_ERR"],
["http://www.w3.org/2000/xmlns/", "f:oo", "NAMESPACE_ERR"],
["http://www.w3.org/2000/xmlns/", "foo:", "NAMESPACE_ERR"],
["http://www.w3.org/2000/xmlns/", "foo:", "INVALID_CHARACTER_ERR"],
["http://www.w3.org/2000/xmlns/", "xml", "NAMESPACE_ERR"],
["http://www.w3.org/2000/xmlns/", "xmlns", null],
["http://www.w3.org/2000/xmlns/", "xmlfoo", "NAMESPACE_ERR"],
Expand All @@ -172,9 +172,9 @@ var createElementNS_tests = [
["foo:", "1foo", "INVALID_CHARACTER_ERR"],
["foo:", "f1oo", null],
["foo:", "foo1", null],
["foo:", ":foo", "NAMESPACE_ERR"],
["foo:", ":foo", "INVALID_CHARACTER_ERR"],
["foo:", "f:oo", null],
["foo:", "foo:", "NAMESPACE_ERR"],
["foo:", "foo:", "INVALID_CHARACTER_ERR"],
["foo:", "xml", null],
["foo:", "xmlns", "NAMESPACE_ERR"],
["foo:", "xmlfoo", null],
Expand Down
4 changes: 2 additions & 2 deletions dom/nodes/attributes.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@
test(function() {
var el = document.createElement("foo")
for (var i = 0, il = invalid_qnames.length; i < il; ++i) {
assert_throws("NAMESPACE_ERR",
assert_throws("INVALID_CHARACTER_ERR",
function() { el.setAttributeNS("a", invalid_qnames[i], "fail") },
"Expected exception for " + invalid_qnames[i] + ".")
}
}, "When qualifiedName does not match the QName production, an " +
"NAMESPACE_ERR exception is to be thrown.")
"INVALID_CHARACTER_ERR exception is to be thrown.")

// Step 3
test(function() {
Expand Down

0 comments on commit 85470b4

Please sign in to comment.