Diff
Modified: trunk/LayoutTests/ChangeLog (161463 => 161464)
--- trunk/LayoutTests/ChangeLog 2014-01-08 00:09:44 UTC (rev 161463)
+++ trunk/LayoutTests/ChangeLog 2014-01-08 00:12:03 UTC (rev 161464)
@@ -1,3 +1,20 @@
+2014-01-07 Victor Costan <cos...@gmail.com>
+
+ createElementNS handles element name 'xmlns' correctly.
+ https://bugs.webkit.org/show_bug.cgi?id=126553
+
+ Reviewed by Alexey Proskuryakov.
+
+ * fast/dom/createElementNS-namespace-errors-expected.txt: Added.
+ * fast/dom/createElementNS-namespace-errors.html: Added. Covers all the corner cases in the DOM4 spec.
+ * fast/dom/script-tests/setAttributeNS-prefix-and-null-namespace.js: Removed.
+ * fast/dom/setAttributeNS-expected.txt: Updated to match cleaned up test.
+ * fast/dom/setAttributeNS-namespace-errors-expected.txt: Added.
+ * fast/dom/setAttributeNS-namespace-errors.html: Added. Covers all the corner cases in the DOM4 spec.
+ * fast/dom/setAttributeNS-prefix-and-null-namespace-expected.txt: Removed.
+ * fast/dom/setAttributeNS-prefix-and-null-namespace.html: Removed. Subsumed by setAttributeNS-namespace-errors.
+ * fast/dom/setAttributeNS.html: Cleaned up.
+
2014-01-06 Jer Noble <jer.no...@apple.com>
HTML5 video tag Does Not Load in Apache htaccess/htpasswd Protected Directory
Added: trunk/LayoutTests/fast/dom/createElementNS-namespace-errors-expected.txt (0 => 161464)
--- trunk/LayoutTests/fast/dom/createElementNS-namespace-errors-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/createElementNS-namespace-errors-expected.txt 2014-01-08 00:12:03 UTC (rev 161464)
@@ -0,0 +1,30 @@
+Test that calling createElementNS() throws an error when the DOM spec says it should.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.createElementNS(null, 'foo:bar') threw exception Error: NamespaceError: DOM Exception 14.
+PASS document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc') did not throw exception.
+PASS document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc').namespaceURI is "http://www.w3.org/XML/1998/namespace"
+PASS document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc').nodeName is "xml:abc"
+PASS document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc').prefix is "xml"
+PASS document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc').localName is "abc"
+PASS document.createElementNS('http://www.w3.org/not-XML/1998/namespace', 'xml:abc') threw exception Error: NamespaceError: DOM Exception 14.
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns') did not throw exception.
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns').namespaceURI is "http://www.w3.org/2000/xmlns/"
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns').nodeName is "xmlns"
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns').prefix is null
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns').localName is "xmlns"
+PASS document.createElementNS('http://www.w3.org/2000/not-xmlns/', 'xmlns') threw exception Error: NamespaceError: DOM Exception 14.
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc') did not throw exception.
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc').namespaceURI is "http://www.w3.org/2000/xmlns/"
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc').nodeName is "xmlns:abc"
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc').prefix is "xmlns"
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc').localName is "abc"
+PASS document.createElementNS('http://www.w3.org/2000/not-xmlns/', 'xmlns:abc') threw exception Error: NamespaceError: DOM Exception 14.
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'badprefix:xmlns') threw exception Error: NamespaceError: DOM Exception 14.
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'notxmlns') threw exception Error: NamespaceError: DOM Exception 14.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/createElementNS-namespace-errors.html (0 => 161464)
--- trunk/LayoutTests/fast/dom/createElementNS-namespace-errors.html (rev 0)
+++ trunk/LayoutTests/fast/dom/createElementNS-namespace-errors.html 2014-01-08 00:12:03 UTC (rev 161464)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<script src=""
+
+<script>
+description('Test that calling createElementNS() throws an error when <a href="" DOM spec</a> says it should.');
+
+// Spec: http://www.w3.org/TR/dom/#dom-document-createelementns
+
+// Step 5.
+shouldThrow("document.createElementNS(null, 'foo:bar')", '"Error: NamespaceError: DOM Exception 14"');
+
+// Step 6.
+shouldNotThrow("document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc')");
+shouldBe("document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc').namespaceURI", '"http://www.w3.org/XML/1998/namespace"');
+shouldBe("document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc').nodeName", '"xml:abc"');
+shouldBe("document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc').prefix", '"xml"');
+shouldBe("document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc').localName", '"abc"');
+shouldThrow("document.createElementNS('http://www.w3.org/not-XML/1998/namespace', 'xml:abc')", '"Error: NamespaceError: DOM Exception 14"');
+
+// Step 7.
+shouldNotThrow("document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns')");
+shouldBe("document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns').namespaceURI", '"http://www.w3.org/2000/xmlns/"');
+shouldBe("document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns').nodeName", '"xmlns"');
+shouldBe("document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns').prefix", 'null');
+shouldBe("document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns').localName", '"xmlns"');
+shouldThrow("document.createElementNS('http://www.w3.org/2000/not-xmlns/', 'xmlns')", '"Error: NamespaceError: DOM Exception 14"');
+
+shouldNotThrow("document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc')");
+shouldBe("document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc').namespaceURI", '"http://www.w3.org/2000/xmlns/"');
+shouldBe("document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc').nodeName", '"xmlns:abc"');
+shouldBe("document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc').prefix", '"xmlns"');
+shouldBe("document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc').localName", '"abc"');
+shouldThrow("document.createElementNS('http://www.w3.org/2000/not-xmlns/', 'xmlns:abc')", '"Error: NamespaceError: DOM Exception 14"');
+
+// Step 8.
+shouldThrow("document.createElementNS('http://www.w3.org/2000/xmlns/', 'badprefix:xmlns')", '"Error: NamespaceError: DOM Exception 14"');
+
+shouldThrow("document.createElementNS('http://www.w3.org/2000/xmlns/', 'notxmlns')", '"Error: NamespaceError: DOM Exception 14"');
+</script>
+
+<script src=""
Deleted: trunk/LayoutTests/fast/dom/script-tests/setAttributeNS-prefix-and-null-namespace.js (161463 => 161464)
--- trunk/LayoutTests/fast/dom/script-tests/setAttributeNS-prefix-and-null-namespace.js 2014-01-08 00:09:44 UTC (rev 161463)
+++ trunk/LayoutTests/fast/dom/script-tests/setAttributeNS-prefix-and-null-namespace.js 2014-01-08 00:12:03 UTC (rev 161464)
@@ -1,3 +0,0 @@
-description("Test that calling setAttributeNS() with a prefixed qualifiedName and null NS throws NAMESPACE_ERR.");
-
-shouldThrow("document.createElement('test').setAttributeNS(null, 'foo:bar', 'baz')", "'Error: NamespaceError: DOM Exception 14'");
Modified: trunk/LayoutTests/fast/dom/setAttributeNS-expected.txt (161463 => 161464)
--- trunk/LayoutTests/fast/dom/setAttributeNS-expected.txt 2014-01-08 00:09:44 UTC (rev 161463)
+++ trunk/LayoutTests/fast/dom/setAttributeNS-expected.txt 2014-01-08 00:12:03 UTC (rev 161464)
@@ -1,3 +1,10 @@
-This tests that setAttributeNS with a null namespaceURI actually sets it to the value null and not a string with the contents 'null'. If the test is sucessful, the text below should say "SUCCESS".
-SUCCESS
+Test that setAttributeNS with a null namespaceURI actually sets it to the value null and not a string with the contents 'null'.
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS elem.attributes[0].namespaceURI is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/setAttributeNS-namespace-errors-expected.txt (0 => 161464)
--- trunk/LayoutTests/fast/dom/setAttributeNS-namespace-errors-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/setAttributeNS-namespace-errors-expected.txt 2014-01-08 00:12:03 UTC (rev 161464)
@@ -0,0 +1,18 @@
+Test that calling setAttributeNS() throws an error when http://www.w3.org/TR/dom/#dom-element-setattributens says it should.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS elem.setAttributeNS(null, 'foo:bar', 'baz') threw exception Error: NamespaceError: DOM Exception 14.
+PASS elem.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:abc', 'foo') did not throw exception.
+PASS elem.setAttributeNS('http://www.w3.org/not-XML/1998/namespace', 'xml:abc', 'foo') threw exception Error: NamespaceError: DOM Exception 14.
+PASS elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns', 'http://wwww.example.org') did not throw exception.
+PASS elem.setAttributeNS('http://www.w3.org/2000/not-xmlns/', 'xmlns', 'http://wwww.example.org') threw exception Error: NamespaceError: DOM Exception 14.
+PASS elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc', 'http://wwww.example.org') did not throw exception.
+PASS elem.setAttributeNS('http://www.w3.org/2000/not-xmlns/', 'xmlns:abc', 'http://wwww.example.org') threw exception Error: NamespaceError: DOM Exception 14.
+PASS elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'badprefix:xmlns', 'http://wwww.example.org') threw exception Error: NamespaceError: DOM Exception 14.
+PASS elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'notxmlns', 'http://wwww.example.org') threw exception Error: NamespaceError: DOM Exception 14.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/setAttributeNS-namespace-errors.html (0 => 161464)
--- trunk/LayoutTests/fast/dom/setAttributeNS-namespace-errors.html (rev 0)
+++ trunk/LayoutTests/fast/dom/setAttributeNS-namespace-errors.html 2014-01-08 00:12:03 UTC (rev 161464)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<script src=""
+
+<script>
+description("Test that calling setAttributeNS() throws an error when http://www.w3.org/TR/dom/#dom-element-setattributens says it should.");
+
+window.elem = document.createElement('test');
+
+// Spec: http://www.w3.org/TR/dom/#dom-element-setattributens
+
+// Step 5.
+shouldThrow("elem.setAttributeNS(null, 'foo:bar', 'baz')", '"Error: NamespaceError: DOM Exception 14"');
+
+// Step 6.
+shouldNotThrow("elem.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:abc', 'foo')");
+shouldThrow("elem.setAttributeNS('http://www.w3.org/not-XML/1998/namespace', 'xml:abc', 'foo')", '"Error: NamespaceError: DOM Exception 14"');
+
+// Step 7.
+shouldNotThrow("elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns', 'http://wwww.example.org')");
+shouldThrow("elem.setAttributeNS('http://www.w3.org/2000/not-xmlns/', 'xmlns', 'http://wwww.example.org')", '"Error: NamespaceError: DOM Exception 14"');
+shouldNotThrow("elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc', 'http://wwww.example.org')");
+shouldThrow("elem.setAttributeNS('http://www.w3.org/2000/not-xmlns/', 'xmlns:abc', 'http://wwww.example.org')", '"Error: NamespaceError: DOM Exception 14"');
+
+// Step 8.
+shouldThrow("elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'badprefix:xmlns', 'http://wwww.example.org')", '"Error: NamespaceError: DOM Exception 14"');
+shouldThrow("elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'notxmlns', 'http://wwww.example.org')", '"Error: NamespaceError: DOM Exception 14"');
+</script>
+
+<script src=""
Deleted: trunk/LayoutTests/fast/dom/setAttributeNS-prefix-and-null-namespace-expected.txt (161463 => 161464)
--- trunk/LayoutTests/fast/dom/setAttributeNS-prefix-and-null-namespace-expected.txt 2014-01-08 00:09:44 UTC (rev 161463)
+++ trunk/LayoutTests/fast/dom/setAttributeNS-prefix-and-null-namespace-expected.txt 2014-01-08 00:12:03 UTC (rev 161464)
@@ -1,10 +0,0 @@
-Test that calling setAttributeNS() with a prefixed qualifiedName and null NS throws NAMESPACE_ERR.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS document.createElement('test').setAttributeNS(null, 'foo:bar', 'baz') threw exception Error: NamespaceError: DOM Exception 14.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Deleted: trunk/LayoutTests/fast/dom/setAttributeNS-prefix-and-null-namespace.html (161463 => 161464)
--- trunk/LayoutTests/fast/dom/setAttributeNS-prefix-and-null-namespace.html 2014-01-08 00:09:44 UTC (rev 161463)
+++ trunk/LayoutTests/fast/dom/setAttributeNS-prefix-and-null-namespace.html 2014-01-08 00:12:03 UTC (rev 161464)
@@ -1,10 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src=""
-</head>
-<body>
-<script src=""
-<script src=""
-</body>
-</html>
Modified: trunk/LayoutTests/fast/dom/setAttributeNS.html (161463 => 161464)
--- trunk/LayoutTests/fast/dom/setAttributeNS.html 2014-01-08 00:09:44 UTC (rev 161463)
+++ trunk/LayoutTests/fast/dom/setAttributeNS.html 2014-01-08 00:12:03 UTC (rev 161464)
@@ -1,32 +1,12 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
+<!DOCTYPE html>
+<script src=""
+
<script>
-function debug(str) {
- pre = document.getElementById('console');
- text = document.createTextNode(str + '\n');
- pre.appendChild(text);
-}
+description("Test that setAttributeNS with a null namespaceURI actually sets it to the value null and not a string with the contents 'null'.");
-function runTests() {
- if (window.testRunner)
- testRunner.dumpAsText();
-
- elem = document.createElementNS('http://www.example.org', 'test')
- attr = elem.setAttributeNS(null, 'name', 'value')
-
- if (elem.attributes[0].namespaceURI == null)
- debug('SUCCESS')
- else
- debug('FAILURE')
-}
-
+window.elem = document.createElementNS('http://www.example.org', 'test');
+elem.setAttributeNS(null, 'name', 'value');
+shouldBeNull('elem.attributes[0].namespaceURI');
</script>
-</head>
-<body _onload_="runTests();">
-This tests that setAttributeNS with a null namespaceURI actually sets it to the value null and not a string with the contents 'null'. If the test is sucessful, the text below should say "SUCCESS".
-<pre id="console">
-</pre>
-</body>
-</html>
+
+<script src=""
Modified: trunk/Source/WebCore/ChangeLog (161463 => 161464)
--- trunk/Source/WebCore/ChangeLog 2014-01-08 00:09:44 UTC (rev 161463)
+++ trunk/Source/WebCore/ChangeLog 2014-01-08 00:12:03 UTC (rev 161464)
@@ -1,3 +1,17 @@
+2014-01-07 Victor Costan <cos...@gmail.com>
+
+ createElementNS handles element name 'xmlns' correctly.
+ https://bugs.webkit.org/show_bug.cgi?id=126553
+
+ Reviewed by Alexey Proskuryakov.
+
+ Tests: fast/dom/createElementNS-namespace-errors.html
+ fast/dom/setAttributeNS-namespace-errors.html
+
+ * dom/Document.cpp:
+ (WebCore::Document::hasValidNamespaceForElements): updated to match DOM3/DOM4 spec.
+ (WebCore::Document::hasValidNamespaceForAttributes): updated to match DOM3/DOM4 spec.
+
2014-01-07 Jer Noble <jer.no...@apple.com>
PlatformLayer containing scrollbars does not disappear when setting overflow:hidden on page root, until resize.
Modified: trunk/Source/WebCore/dom/Document.cpp (161463 => 161464)
--- trunk/Source/WebCore/dom/Document.cpp 2014-01-08 00:09:44 UTC (rev 161463)
+++ trunk/Source/WebCore/dom/Document.cpp 2014-01-08 00:12:03 UTC (rev 161464)
@@ -1036,21 +1036,14 @@
// Required by DOM Level 3 Core and unspecified by DOM Level 2 Core:
// http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-DocCrElNS
- // createElementNS("http://www.w3.org/2000/xmlns/", "foo:bar"), createElementNS(null, "xmlns:bar")
- if ((qName.prefix() == xmlnsAtom && qName.namespaceURI() != XMLNSNames::xmlnsNamespaceURI) || (qName.prefix() != xmlnsAtom && qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI))
- return false;
-
- return true;
+ // createElementNS("http://www.w3.org/2000/xmlns/", "foo:bar"), createElementNS(null, "xmlns:bar"), createElementNS(null, "xmlns")
+ if (qName.prefix() == xmlnsAtom || (qName.prefix().isEmpty() && qName.localName() == xmlnsAtom))
+ return qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI;
+ return qName.namespaceURI() != XMLNSNames::xmlnsNamespaceURI;
}
bool Document::hasValidNamespaceForAttributes(const QualifiedName& qName)
{
- // Spec: DOM Level 2 Core: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-ElSetAttrNS
- if (qName.prefix().isEmpty() && qName.localName() == xmlnsAtom) {
- // Note: The case of an "xmlns" qualified name with a namespace of
- // xmlnsNamespaceURI is specifically allowed (See <http://www.w3.org/2000/xmlns/>).
- return qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI;
- }
return hasValidNamespaceForElements(qName);
}