<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[161464] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/161464">161464</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-01-07 16:12:03 -0800 (Tue, 07 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>createElementNS handles element name 'xmlns' correctly.
https://bugs.webkit.org/show_bug.cgi?id=126553

Patch by Victor Costan &lt;costan@gmail.com&gt; on 2014-01-07
Reviewed by Alexey Proskuryakov.

Source/WebCore:

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.

LayoutTests:

* 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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomsetAttributeNSexpectedtxt">trunk/LayoutTests/fast/dom/setAttributeNS-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomsetAttributeNShtml">trunk/LayoutTests/fast/dom/setAttributeNS.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomcreateElementNSnamespaceerrorsexpectedtxt">trunk/LayoutTests/fast/dom/createElementNS-namespace-errors-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomcreateElementNSnamespaceerrorshtml">trunk/LayoutTests/fast/dom/createElementNS-namespace-errors.html</a></li>
<li><a href="#trunkLayoutTestsfastdomsetAttributeNSnamespaceerrorsexpectedtxt">trunk/LayoutTests/fast/dom/setAttributeNS-namespace-errors-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomsetAttributeNSnamespaceerrorshtml">trunk/LayoutTests/fast/dom/setAttributeNS-namespace-errors.html</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomscripttestssetAttributeNSprefixandnullnamespacejs">trunk/LayoutTests/fast/dom/script-tests/setAttributeNS-prefix-and-null-namespace.js</a></li>
<li><a href="#trunkLayoutTestsfastdomsetAttributeNSprefixandnullnamespaceexpectedtxt">trunk/LayoutTests/fast/dom/setAttributeNS-prefix-and-null-namespace-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomsetAttributeNSprefixandnullnamespacehtml">trunk/LayoutTests/fast/dom/setAttributeNS-prefix-and-null-namespace.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (161463 => 161464)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-01-08 00:09:44 UTC (rev 161463)
+++ trunk/LayoutTests/ChangeLog        2014-01-08 00:12:03 UTC (rev 161464)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-01-07  Victor Costan  &lt;costan@gmail.com&gt;
+
+        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.
+
</ins><span class="cx"> 2014-01-06  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         HTML5 video tag Does Not Load in Apache htaccess/htpasswd Protected Directory
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomcreateElementNSnamespaceerrorsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/createElementNS-namespace-errors-expected.txt (0 => 161464)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+Test that calling createElementNS() throws an error when the DOM spec says it should.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+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 &quot;http://www.w3.org/XML/1998/namespace&quot;
+PASS document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc').nodeName is &quot;xml:abc&quot;
+PASS document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc').prefix is &quot;xml&quot;
+PASS document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc').localName is &quot;abc&quot;
+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 &quot;http://www.w3.org/2000/xmlns/&quot;
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns').nodeName is &quot;xmlns&quot;
+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 &quot;xmlns&quot;
+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 &quot;http://www.w3.org/2000/xmlns/&quot;
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc').nodeName is &quot;xmlns:abc&quot;
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc').prefix is &quot;xmlns&quot;
+PASS document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc').localName is &quot;abc&quot;
+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
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomcreateElementNSnamespaceerrorshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/createElementNS-namespace-errors.html (0 => 161464)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+
+&lt;script&gt;
+description('Test that calling createElementNS() throws an error when &lt;a href=&quot;http://www.w3.org/TR/dom/#dom-document-createelementns&quot;&gt;the DOM spec&lt;/a&gt; says it should.');
+
+// Spec: http://www.w3.org/TR/dom/#dom-document-createelementns
+
+// Step 5.
+shouldThrow(&quot;document.createElementNS(null, 'foo:bar')&quot;, '&quot;Error: NamespaceError: DOM Exception 14&quot;');
+
+// Step 6.
+shouldNotThrow(&quot;document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc')&quot;);
+shouldBe(&quot;document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc').namespaceURI&quot;, '&quot;http://www.w3.org/XML/1998/namespace&quot;');
+shouldBe(&quot;document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc').nodeName&quot;, '&quot;xml:abc&quot;');
+shouldBe(&quot;document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc').prefix&quot;, '&quot;xml&quot;');
+shouldBe(&quot;document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc').localName&quot;, '&quot;abc&quot;');
+shouldThrow(&quot;document.createElementNS('http://www.w3.org/not-XML/1998/namespace', 'xml:abc')&quot;, '&quot;Error: NamespaceError: DOM Exception 14&quot;');
+
+// Step 7.
+shouldNotThrow(&quot;document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns')&quot;);
+shouldBe(&quot;document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns').namespaceURI&quot;, '&quot;http://www.w3.org/2000/xmlns/&quot;');
+shouldBe(&quot;document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns').nodeName&quot;, '&quot;xmlns&quot;');
+shouldBe(&quot;document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns').prefix&quot;, 'null');
+shouldBe(&quot;document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns').localName&quot;, '&quot;xmlns&quot;');
+shouldThrow(&quot;document.createElementNS('http://www.w3.org/2000/not-xmlns/', 'xmlns')&quot;, '&quot;Error: NamespaceError: DOM Exception 14&quot;');
+
+shouldNotThrow(&quot;document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc')&quot;);
+shouldBe(&quot;document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc').namespaceURI&quot;, '&quot;http://www.w3.org/2000/xmlns/&quot;');
+shouldBe(&quot;document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc').nodeName&quot;, '&quot;xmlns:abc&quot;');
+shouldBe(&quot;document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc').prefix&quot;, '&quot;xmlns&quot;');
+shouldBe(&quot;document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc').localName&quot;, '&quot;abc&quot;');
+shouldThrow(&quot;document.createElementNS('http://www.w3.org/2000/not-xmlns/', 'xmlns:abc')&quot;, '&quot;Error: NamespaceError: DOM Exception 14&quot;');
+
+// Step 8.
+shouldThrow(&quot;document.createElementNS('http://www.w3.org/2000/xmlns/', 'badprefix:xmlns')&quot;, '&quot;Error: NamespaceError: DOM Exception 14&quot;');
+
+shouldThrow(&quot;document.createElementNS('http://www.w3.org/2000/xmlns/', 'notxmlns')&quot;, '&quot;Error: NamespaceError: DOM Exception 14&quot;');
+&lt;/script&gt;
+
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomscripttestssetAttributeNSprefixandnullnamespacejs"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/dom/script-tests/setAttributeNS-prefix-and-null-namespace.js (161463 => 161464)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +0,0 @@
</span><del>-description(&quot;Test that calling setAttributeNS() with a prefixed qualifiedName and null NS throws NAMESPACE_ERR.&quot;);
-
-shouldThrow(&quot;document.createElement('test').setAttributeNS(null, 'foo:bar', 'baz')&quot;, &quot;'Error: NamespaceError: DOM Exception 14'&quot;);
</del></span></pre></div>
<a id="trunkLayoutTestsfastdomsetAttributeNSexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/setAttributeNS-expected.txt (161463 => 161464)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,10 @@
</span><del>-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 &quot;SUCCESS&quot;.
-SUCCESS
</del><ins>+Test that setAttributeNS with a null namespaceURI actually sets it to the value null and not a string with the contents 'null'.
</ins><span class="cx"> 
</span><ins>+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS elem.attributes[0].namespaceURI is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomsetAttributeNSnamespaceerrorsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/setAttributeNS-namespace-errors-expected.txt (0 => 161464)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+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 &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+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
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomsetAttributeNSnamespaceerrorshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/setAttributeNS-namespace-errors.html (0 => 161464)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+
+&lt;script&gt;
+description(&quot;Test that calling setAttributeNS() throws an error when http://www.w3.org/TR/dom/#dom-element-setattributens says it should.&quot;);
+
+window.elem = document.createElement('test');
+
+// Spec: http://www.w3.org/TR/dom/#dom-element-setattributens
+
+// Step 5.
+shouldThrow(&quot;elem.setAttributeNS(null, 'foo:bar', 'baz')&quot;, '&quot;Error: NamespaceError: DOM Exception 14&quot;');
+
+// Step 6.
+shouldNotThrow(&quot;elem.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:abc', 'foo')&quot;);
+shouldThrow(&quot;elem.setAttributeNS('http://www.w3.org/not-XML/1998/namespace', 'xml:abc', 'foo')&quot;, '&quot;Error: NamespaceError: DOM Exception 14&quot;');
+
+// Step 7.
+shouldNotThrow(&quot;elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns', 'http://wwww.example.org')&quot;);
+shouldThrow(&quot;elem.setAttributeNS('http://www.w3.org/2000/not-xmlns/', 'xmlns', 'http://wwww.example.org')&quot;, '&quot;Error: NamespaceError: DOM Exception 14&quot;');
+shouldNotThrow(&quot;elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc', 'http://wwww.example.org')&quot;);
+shouldThrow(&quot;elem.setAttributeNS('http://www.w3.org/2000/not-xmlns/', 'xmlns:abc', 'http://wwww.example.org')&quot;, '&quot;Error: NamespaceError: DOM Exception 14&quot;');
+
+// Step 8.
+shouldThrow(&quot;elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'badprefix:xmlns', 'http://wwww.example.org')&quot;, '&quot;Error: NamespaceError: DOM Exception 14&quot;');
+shouldThrow(&quot;elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'notxmlns', 'http://wwww.example.org')&quot;, '&quot;Error: NamespaceError: DOM Exception 14&quot;');
+&lt;/script&gt;
+
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomsetAttributeNSprefixandnullnamespaceexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/dom/setAttributeNS-prefix-and-null-namespace-expected.txt (161463 => 161464)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,10 +0,0 @@
</span><del>-Test that calling setAttributeNS() with a prefixed qualifiedName and null NS throws NAMESPACE_ERR.
-
-On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
-
-
-PASS document.createElement('test').setAttributeNS(null, 'foo:bar', 'baz') threw exception Error: NamespaceError: DOM Exception 14.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="trunkLayoutTestsfastdomsetAttributeNSprefixandnullnamespacehtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/dom/setAttributeNS-prefix-and-null-namespace.html (161463 => 161464)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,10 +0,0 @@
</span><del>-&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
-&lt;html&gt;
-&lt;head&gt;
-&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
-&lt;/head&gt;
-&lt;body&gt;
-&lt;script src=&quot;script-tests/setAttributeNS-prefix-and-null-namespace.js&quot;&gt;&lt;/script&gt;
-&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestsfastdomsetAttributeNShtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/setAttributeNS.html (161463 => 161464)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,32 +1,12 @@
</span><del>-&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
-        &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
-&lt;html&gt;
-&lt;head&gt;
</del><ins>+&lt;!DOCTYPE html&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+
</ins><span class="cx"> &lt;script&gt;
</span><del>-function debug(str) {
-    pre = document.getElementById('console');
-    text = document.createTextNode(str + '\n');
-    pre.appendChild(text);
-}
</del><ins>+description(&quot;Test that setAttributeNS with a null namespaceURI actually sets it to the value null and not a string with the contents 'null'.&quot;);
</ins><span class="cx"> 
</span><del>-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')
-}
-
</del><ins>+window.elem = document.createElementNS('http://www.example.org', 'test');
+elem.setAttributeNS(null, 'name', 'value');
+shouldBeNull('elem.attributes[0].namespaceURI');
</ins><span class="cx"> &lt;/script&gt;
</span><del>-&lt;/head&gt;
-&lt;body onload=&quot;runTests();&quot;&gt;
-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 &quot;SUCCESS&quot;.
-&lt;pre id=&quot;console&quot;&gt;
-&lt;/pre&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del><ins>+
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (161463 => 161464)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-01-07  Victor Costan  &lt;costan@gmail.com&gt;
+
+        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.
+
</ins><span class="cx"> 2014-01-07  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         PlatformLayer containing scrollbars does not disappear when setting overflow:hidden on page root, until resize.
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (161463 => 161464)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1036,21 +1036,14 @@
</span><span class="cx"> 
</span><span class="cx">     // Required by DOM Level 3 Core and unspecified by DOM Level 2 Core:
</span><span class="cx">     // http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-DocCrElNS
</span><del>-    // createElementNS(&quot;http://www.w3.org/2000/xmlns/&quot;, &quot;foo:bar&quot;), createElementNS(null, &quot;xmlns:bar&quot;)
-    if ((qName.prefix() == xmlnsAtom &amp;&amp; qName.namespaceURI() != XMLNSNames::xmlnsNamespaceURI) || (qName.prefix() != xmlnsAtom &amp;&amp; qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI))
-        return false;
-
-    return true;
</del><ins>+    // createElementNS(&quot;http://www.w3.org/2000/xmlns/&quot;, &quot;foo:bar&quot;), createElementNS(null, &quot;xmlns:bar&quot;), createElementNS(null, &quot;xmlns&quot;)
+    if (qName.prefix() == xmlnsAtom || (qName.prefix().isEmpty() &amp;&amp; qName.localName() == xmlnsAtom))
+        return qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI;
+    return qName.namespaceURI() != XMLNSNames::xmlnsNamespaceURI;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool Document::hasValidNamespaceForAttributes(const QualifiedName&amp; qName)
</span><span class="cx"> {
</span><del>-    // Spec: DOM Level 2 Core: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-ElSetAttrNS
-    if (qName.prefix().isEmpty() &amp;&amp; qName.localName() == xmlnsAtom) {
-        // Note: The case of an &quot;xmlns&quot; qualified name with a namespace of
-        // xmlnsNamespaceURI is specifically allowed (See &lt;http://www.w3.org/2000/xmlns/&gt;).
-        return qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI;
-    }
</del><span class="cx">     return hasValidNamespaceForElements(qName);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>