<!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>[189253] 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/189253">189253</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-09-02 10:09:00 -0700 (Wed, 02 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>document.createProcessingInstruction() does not behave according to specification
https://bugs.webkit.org/show_bug.cgi?id=148710

Reviewed by Ryosuke Niwa.

Source/WebCore:

document.createProcessingInstruction() does not behave according to
specification:
https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction

The following changes were made in this patch to match the specification
and the behavior of Firefox / Chrome:
1. document.createProcessingInstruction() now works for HTML documents.
2. Throw an InvalidCharacterError if the data contains &quot;?&gt;&quot; (step 2 of spec)

No new tests, already covered by existing tests that are rebaselined in
this patch.

* dom/Document.cpp:
(WebCore::Document::createProcessingInstruction):

LayoutTests:

Update / rebaseline existing tests.

* dom/html/level1/core/documentinvalidcharacterexceptioncreatepi-expected.txt:
* dom/html/level1/core/documentinvalidcharacterexceptioncreatepi1-expected.txt:
* fast/dom/Node/initial-values-expected.txt:
* fast/dom/Node/script-tests/initial-values.js:
* http/tests/w3c/dom/nodes/CharacterData-remove-expected.txt:
* http/tests/w3c/dom/nodes/Document-createProcessingInstruction-expected.txt:
* http/tests/w3c/dom/nodes/Document-createProcessingInstruction-xhtml-expected.txt:
* http/tests/w3c/dom/nodes/Node-cloneNode-expected.txt:
* http/tests/w3c/dom/nodes/Node-insertBefore-expected.txt:
* http/tests/w3c/dom/nodes/Node-nodeValue-expected.txt:
* http/tests/w3c/dom/nodes/Node-textContent-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsdomhtmllevel1coredocumentinvalidcharacterexceptioncreatepiexpectedtxt">trunk/LayoutTests/dom/html/level1/core/documentinvalidcharacterexceptioncreatepi-expected.txt</a></li>
<li><a href="#trunkLayoutTestsdomhtmllevel1coredocumentinvalidcharacterexceptioncreatepi1expectedtxt">trunk/LayoutTests/dom/html/level1/core/documentinvalidcharacterexceptioncreatepi1-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomNodeinitialvaluesexpectedtxt">trunk/LayoutTests/fast/dom/Node/initial-values-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomNodescripttestsinitialvaluesjs">trunk/LayoutTests/fast/dom/Node/script-tests/initial-values.js</a></li>
<li><a href="#trunkLayoutTestshttptestsw3cdomnodesCharacterDataremoveexpectedtxt">trunk/LayoutTests/http/tests/w3c/dom/nodes/CharacterData-remove-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsw3cdomnodesDocumentcreateProcessingInstructionexpectedtxt">trunk/LayoutTests/http/tests/w3c/dom/nodes/Document-createProcessingInstruction-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsw3cdomnodesDocumentcreateProcessingInstructionxhtmlexpectedtxt">trunk/LayoutTests/http/tests/w3c/dom/nodes/Document-createProcessingInstruction-xhtml-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsw3cdomnodesNodecloneNodeexpectedtxt">trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-cloneNode-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsw3cdomnodesNodeinsertBeforeexpectedtxt">trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-insertBefore-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsw3cdomnodesNodenodeValueexpectedtxt">trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-nodeValue-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsw3cdomnodesNodetextContentexpectedtxt">trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-textContent-expected.txt</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>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (189252 => 189253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-02 17:07:57 UTC (rev 189252)
+++ trunk/LayoutTests/ChangeLog        2015-09-02 17:09:00 UTC (rev 189253)
</span><span class="lines">@@ -1,5 +1,26 @@
</span><span class="cx"> 2015-09-02  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        document.createProcessingInstruction() does not behave according to specification
+        https://bugs.webkit.org/show_bug.cgi?id=148710
+
+        Reviewed by Ryosuke Niwa.
+
+        Update / rebaseline existing tests.
+
+        * dom/html/level1/core/documentinvalidcharacterexceptioncreatepi-expected.txt:
+        * dom/html/level1/core/documentinvalidcharacterexceptioncreatepi1-expected.txt:
+        * fast/dom/Node/initial-values-expected.txt:
+        * fast/dom/Node/script-tests/initial-values.js:
+        * http/tests/w3c/dom/nodes/CharacterData-remove-expected.txt:
+        * http/tests/w3c/dom/nodes/Document-createProcessingInstruction-expected.txt:
+        * http/tests/w3c/dom/nodes/Document-createProcessingInstruction-xhtml-expected.txt:
+        * http/tests/w3c/dom/nodes/Node-cloneNode-expected.txt:
+        * http/tests/w3c/dom/nodes/Node-insertBefore-expected.txt:
+        * http/tests/w3c/dom/nodes/Node-nodeValue-expected.txt:
+        * http/tests/w3c/dom/nodes/Node-textContent-expected.txt:
+
+2015-09-02  Chris Dumez  &lt;cdumez@apple.com&gt;
+
</ins><span class="cx">         http/tests/w3c/dom/nodes/Element-matches.html is flaky
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=148615
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsdomhtmllevel1coredocumentinvalidcharacterexceptioncreatepiexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/dom/html/level1/core/documentinvalidcharacterexceptioncreatepi-expected.txt (189252 => 189253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/dom/html/level1/core/documentinvalidcharacterexceptioncreatepi-expected.txt        2015-09-02 17:07:57 UTC (rev 189252)
+++ trunk/LayoutTests/dom/html/level1/core/documentinvalidcharacterexceptioncreatepi-expected.txt        2015-09-02 17:09:00 UTC (rev 189253)
</span><span class="lines">@@ -1,2 +1,3 @@
</span><del>-Test:        http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi
-Status:        Success
</del><ins>+Test:        http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi        
+Status:        failure
+Detail:        throw_NOT_SUPPORTED_ERR: assertTrue failed
</ins></span></pre></div>
<a id="trunkLayoutTestsdomhtmllevel1coredocumentinvalidcharacterexceptioncreatepi1expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/dom/html/level1/core/documentinvalidcharacterexceptioncreatepi1-expected.txt (189252 => 189253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/dom/html/level1/core/documentinvalidcharacterexceptioncreatepi1-expected.txt        2015-09-02 17:07:57 UTC (rev 189252)
+++ trunk/LayoutTests/dom/html/level1/core/documentinvalidcharacterexceptioncreatepi1-expected.txt        2015-09-02 17:09:00 UTC (rev 189253)
</span><span class="lines">@@ -1,2 +1,3 @@
</span><del>-Test:        http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi1
-Status:        Success
</del><ins>+Test:        http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi1        
+Status:        failure
+Detail:        throw_NOT_SUPPORTED_ERR: assertTrue failed
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomNodeinitialvaluesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Node/initial-values-expected.txt (189252 => 189253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Node/initial-values-expected.txt        2015-09-02 17:07:57 UTC (rev 189252)
+++ trunk/LayoutTests/fast/dom/Node/initial-values-expected.txt        2015-09-02 17:09:00 UTC (rev 189253)
</span><span class="lines">@@ -119,11 +119,14 @@
</span><span class="cx"> PASS entityReference.namespaceURI is null
</span><span class="cx"> PASS entityReference.prefix is null
</span><span class="cx"> PASS entityReference.nodeValue is null
</span><del>-PASS document.createProcessingInstruction('xml-stylesheet', 'type=&quot;text/xsl&quot; href=&quot;missing.xsl&quot;') threw exception Error: NotSupportedError: DOM Exception 9.
</del><span class="cx"> PASS processingInstruction.nodeName is 'xml-stylesheet'
</span><span class="cx"> PASS processingInstruction.localName is null
</span><span class="cx"> PASS processingInstruction.namespaceURI is null
</span><span class="cx"> PASS processingInstruction.prefix is null
</span><ins>+PASS processingInstruction.nodeName is 'xml-stylesheet'
+PASS processingInstruction.localName is null
+PASS processingInstruction.namespaceURI is null
+PASS processingInstruction.prefix is null
</ins><span class="cx"> PASS processingInstruction.nodeValue is 'type=&quot;text/xsl&quot; href=&quot;missing.xsl&quot;'
</span><span class="cx"> PASS processingInstruction.target is 'xml-stylesheet'
</span><span class="cx"> PASS processingInstruction.data is 'type=&quot;text/xsl&quot; href=&quot;missing.xsl&quot;'
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomNodescripttestsinitialvaluesjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Node/script-tests/initial-values.js (189252 => 189253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Node/script-tests/initial-values.js        2015-09-02 17:07:57 UTC (rev 189252)
+++ trunk/LayoutTests/fast/dom/Node/script-tests/initial-values.js        2015-09-02 17:09:00 UTC (rev 189253)
</span><span class="lines">@@ -168,12 +168,17 @@
</span><span class="cx"> 
</span><span class="cx"> // Not possible to create Notation nodes via the DOM, WebKit doesn't create them from parsing
</span><span class="cx"> 
</span><del>-shouldThrow(&quot;document.createProcessingInstruction('xml-stylesheet', 'type=\&quot;text/xsl\&quot; href=\&quot;missing.xsl\&quot;')&quot;);
-var processingInstruction = xmlDoc.createProcessingInstruction('xml-stylesheet', 'type=&quot;text/xsl&quot; href=&quot;missing.xsl&quot;');
</del><ins>+var processingInstruction = document.createProcessingInstruction('xml-stylesheet', 'type=\&quot;text/xsl\&quot; href=\&quot;missing.xsl\&quot;');
</ins><span class="cx"> shouldBe(&quot;processingInstruction.nodeName&quot;, &quot;'xml-stylesheet'&quot;);
</span><span class="cx"> shouldBe(&quot;processingInstruction.localName&quot;, &quot;null&quot;);
</span><span class="cx"> shouldBe(&quot;processingInstruction.namespaceURI&quot;, &quot;null&quot;);
</span><span class="cx"> shouldBe(&quot;processingInstruction.prefix&quot;, &quot;null&quot;);
</span><ins>+
+processingInstruction = xmlDoc.createProcessingInstruction('xml-stylesheet', 'type=&quot;text/xsl&quot; href=&quot;missing.xsl&quot;');
+shouldBe(&quot;processingInstruction.nodeName&quot;, &quot;'xml-stylesheet'&quot;);
+shouldBe(&quot;processingInstruction.localName&quot;, &quot;null&quot;);
+shouldBe(&quot;processingInstruction.namespaceURI&quot;, &quot;null&quot;);
+shouldBe(&quot;processingInstruction.prefix&quot;, &quot;null&quot;);
</ins><span class="cx"> // DOM Core Level 2 and DOM Core Level 3 disagree on ProcessingInstruction.nodeValue
</span><span class="cx"> // L2: entire content excluding the target
</span><span class="cx"> // L3: same as ProcessingInstruction.data
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsw3cdomnodesCharacterDataremoveexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/w3c/dom/nodes/CharacterData-remove-expected.txt (189252 => 189253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/w3c/dom/nodes/CharacterData-remove-expected.txt        2015-09-02 17:07:57 UTC (rev 189252)
+++ trunk/LayoutTests/http/tests/w3c/dom/nodes/CharacterData-remove-expected.txt        2015-09-02 17:09:00 UTC (rev 189253)
</span><span class="lines">@@ -1,2 +1,14 @@
</span><span class="cx"> 
</span><del>-Harness Error. harness_status.status = 1 , harness_status.message = Error: NotSupportedError: DOM Exception 9
</del><ins>+PASS text should support remove() 
+PASS remove() should work if text doesn't have a parent 
+PASS remove() should work if text does have a parent 
+PASS remove() should work if text does have a parent and siblings 
+PASS comment should support remove() 
+PASS remove() should work if comment doesn't have a parent 
+PASS remove() should work if comment does have a parent 
+PASS remove() should work if comment does have a parent and siblings 
+PASS PI should support remove() 
+PASS remove() should work if PI doesn't have a parent 
+PASS remove() should work if PI does have a parent 
+PASS remove() should work if PI does have a parent and siblings 
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsw3cdomnodesDocumentcreateProcessingInstructionexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/w3c/dom/nodes/Document-createProcessingInstruction-expected.txt (189252 => 189253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/w3c/dom/nodes/Document-createProcessingInstruction-expected.txt        2015-09-02 17:07:57 UTC (rev 189252)
+++ trunk/LayoutTests/http/tests/w3c/dom/nodes/Document-createProcessingInstruction-expected.txt        2015-09-02 17:09:00 UTC (rev 189253)
</span><span class="lines">@@ -1,7 +1,6 @@
</span><span class="cx"> 
</span><span class="cx"> PASS Document.createProcessingInstruction in HTML documents 
</span><del>-FAIL Should throw an INVALID_CHARACTER_ERR for target &quot;A&quot; and data &quot;?&gt;&quot;. assert_throws: function &quot;function () {
-        document.createProcessingInstructio...&quot; threw object &quot;Error: NotSupportedError: DOM Exception 9&quot; that is not a DOMException INVALID_CHARACTER_ERR: property &quot;code&quot; is equal to 9, expected 5
</del><ins>+PASS Should throw an INVALID_CHARACTER_ERR for target &quot;A&quot; and data &quot;?&gt;&quot;. 
</ins><span class="cx"> PASS Should throw an INVALID_CHARACTER_ERR for target &quot;·A&quot; and data &quot;x&quot;. 
</span><span class="cx"> PASS Should throw an INVALID_CHARACTER_ERR for target &quot;×A&quot; and data &quot;x&quot;. 
</span><span class="cx"> PASS Should throw an INVALID_CHARACTER_ERR for target &quot;A×&quot; and data &quot;x&quot;. 
</span><span class="lines">@@ -9,7 +8,7 @@
</span><span class="cx"> PASS Should throw an INVALID_CHARACTER_ERR for target &quot;\f&quot; and data &quot;x&quot;. 
</span><span class="cx"> PASS Should throw an INVALID_CHARACTER_ERR for target 0 and data &quot;x&quot;. 
</span><span class="cx"> PASS Should throw an INVALID_CHARACTER_ERR for target &quot;0&quot; and data &quot;x&quot;. 
</span><del>-FAIL Should get a ProcessingInstruction for target &quot;xml:fail&quot; and data &quot;x&quot;. NotSupportedError: DOM Exception 9
-FAIL Should get a ProcessingInstruction for target &quot;A·A&quot; and data &quot;x&quot;. NotSupportedError: DOM Exception 9
-FAIL Should get a ProcessingInstruction for target &quot;a0&quot; and data &quot;x&quot;. NotSupportedError: DOM Exception 9
</del><ins>+PASS Should get a ProcessingInstruction for target &quot;xml:fail&quot; and data &quot;x&quot;. 
+PASS Should get a ProcessingInstruction for target &quot;A·A&quot; and data &quot;x&quot;. 
+PASS Should get a ProcessingInstruction for target &quot;a0&quot; and data &quot;x&quot;. 
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsw3cdomnodesDocumentcreateProcessingInstructionxhtmlexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/w3c/dom/nodes/Document-createProcessingInstruction-xhtml-expected.txt (189252 => 189253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/w3c/dom/nodes/Document-createProcessingInstruction-xhtml-expected.txt        2015-09-02 17:07:57 UTC (rev 189252)
+++ trunk/LayoutTests/http/tests/w3c/dom/nodes/Document-createProcessingInstruction-xhtml-expected.txt        2015-09-02 17:09:00 UTC (rev 189253)
</span><span class="lines">@@ -1,7 +1,6 @@
</span><span class="cx"> 
</span><span class="cx"> PASS Document.createProcessingInstruction in XML documents 
</span><del>-FAIL Should throw an INVALID_CHARACTER_ERR for target &quot;A&quot; and data &quot;?&gt;&quot;. assert_throws: function &quot;function () {
-        document.createProcessingInstructio...&quot; did not throw
</del><ins>+PASS Should throw an INVALID_CHARACTER_ERR for target &quot;A&quot; and data &quot;?&gt;&quot;. 
</ins><span class="cx"> PASS Should throw an INVALID_CHARACTER_ERR for target &quot;·A&quot; and data &quot;x&quot;. 
</span><span class="cx"> PASS Should throw an INVALID_CHARACTER_ERR for target &quot;×A&quot; and data &quot;x&quot;. 
</span><span class="cx"> PASS Should throw an INVALID_CHARACTER_ERR for target &quot;A×&quot; and data &quot;x&quot;. 
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsw3cdomnodesNodecloneNodeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-cloneNode-expected.txt (189252 => 189253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-cloneNode-expected.txt        2015-09-02 17:07:57 UTC (rev 189252)
+++ trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-cloneNode-expected.txt        2015-09-02 17:09:00 UTC (rev 189253)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> PASS createElement with attributes 
</span><span class="cx"> PASS createElementNS HTML 
</span><span class="cx"> PASS createElementNS non-HTML 
</span><del>-FAIL createProcessingInstruction NotSupportedError: DOM Exception 9
</del><ins>+PASS createProcessingInstruction 
</ins><span class="cx"> PASS implementation.createDocumentType 
</span><span class="cx"> PASS implementation.createDocument 
</span><span class="cx"> FAIL implementation.createHTMLDocument assert_equals: expected &quot;&quot; but got &quot;title&quot;
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsw3cdomnodesNodeinsertBeforeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-insertBefore-expected.txt (189252 => 189253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-insertBefore-expected.txt        2015-09-02 17:07:57 UTC (rev 189252)
+++ trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-insertBefore-expected.txt        2015-09-02 17:09:00 UTC (rev 189253)
</span><span class="lines">@@ -6,8 +6,8 @@
</span><span class="cx"> PASS Calling insertBefore an a leaf node Text must throw HIERARCHY_REQUEST_ERR. 
</span><span class="cx"> FAIL Calling insertBefore with a non-Node first argument on a leaf node Comment must throw TypeError. assert_throws: function &quot;function () { node.insertBefore(null, null) }&quot; threw object &quot;Error: HierarchyRequestError: DOM Exception 3&quot; (&quot;HierarchyRequestError&quot;) expected object &quot;TypeError&quot; (&quot;TypeError&quot;)
</span><span class="cx"> PASS Calling insertBefore an a leaf node Comment must throw HIERARCHY_REQUEST_ERR. 
</span><del>-FAIL Calling insertBefore with a non-Node first argument on a leaf node ProcessingInstruction must throw TypeError. NotSupportedError: DOM Exception 9
-FAIL Calling insertBefore an a leaf node ProcessingInstruction must throw HIERARCHY_REQUEST_ERR. NotSupportedError: DOM Exception 9
</del><ins>+FAIL Calling insertBefore with a non-Node first argument on a leaf node ProcessingInstruction must throw TypeError. assert_throws: function &quot;function () { node.insertBefore(null, null) }&quot; threw object &quot;Error: HierarchyRequestError: DOM Exception 3&quot; (&quot;HierarchyRequestError&quot;) expected object &quot;TypeError&quot; (&quot;TypeError&quot;)
+PASS Calling insertBefore an a leaf node ProcessingInstruction must throw HIERARCHY_REQUEST_ERR. 
</ins><span class="cx"> PASS Calling insertBefore with an inclusive ancestor of the context object must throw HIERARCHY_REQUEST_ERR. 
</span><span class="cx"> PASS Calling insertBefore with a reference child whose parent is not the context node must throw a NotFoundError. 
</span><span class="cx"> PASS If the context node is a document, inserting a document or text node should throw a HierarchyRequestError. 
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsw3cdomnodesNodenodeValueexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-nodeValue-expected.txt (189252 => 189253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-nodeValue-expected.txt        2015-09-02 17:07:57 UTC (rev 189252)
+++ trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-nodeValue-expected.txt        2015-09-02 17:09:00 UTC (rev 189253)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> 
</span><span class="cx"> PASS Text.nodeValue 
</span><span class="cx"> PASS Comment.nodeValue 
</span><del>-FAIL ProcessingInstruction.nodeValue NotSupportedError: DOM Exception 9
</del><ins>+PASS ProcessingInstruction.nodeValue 
</ins><span class="cx"> PASS Element.nodeValue 
</span><span class="cx"> PASS Document.nodeValue 
</span><span class="cx"> PASS DocumentFragment.nodeValue 
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsw3cdomnodesNodetextContentexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-textContent-expected.txt (189252 => 189253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-textContent-expected.txt        2015-09-02 17:07:57 UTC (rev 189252)
+++ trunk/LayoutTests/http/tests/w3c/dom/nodes/Node-textContent-expected.txt        2015-09-02 17:09:00 UTC (rev 189253)
</span><span class="lines">@@ -1,15 +1,15 @@
</span><span class="cx"> 
</span><span class="cx"> PASS For an empty Element, textContent should be the empty string 
</span><span class="cx"> PASS For an empty DocumentFragment, textContent should be the empty string 
</span><del>-FAIL Element with children NotSupportedError: DOM Exception 9
-FAIL Element with descendants NotSupportedError: DOM Exception 9
-FAIL DocumentFragment with children NotSupportedError: DOM Exception 9
-FAIL DocumentFragment with descendants NotSupportedError: DOM Exception 9
</del><ins>+PASS Element with children 
+PASS Element with descendants 
+PASS DocumentFragment with children 
+PASS DocumentFragment with descendants 
</ins><span class="cx"> PASS For an empty Text, textContent should be the empty string 
</span><del>-FAIL For an empty ProcessingInstruction, textContent should be the empty string NotSupportedError: DOM Exception 9
</del><ins>+PASS For an empty ProcessingInstruction, textContent should be the empty string 
</ins><span class="cx"> PASS For an empty Comment, textContent should be the empty string 
</span><span class="cx"> PASS For a Text with data, textContent should be that data 
</span><del>-FAIL For a ProcessingInstruction with data, textContent should be that data NotSupportedError: DOM Exception 9
</del><ins>+PASS For a ProcessingInstruction with data, textContent should be that data 
</ins><span class="cx"> PASS For a Comment with data, textContent should be that data 
</span><span class="cx"> PASS For Documents created by parser, textContent should be null 
</span><span class="cx"> PASS For Documents created by createDocument, textContent should be null 
</span><span class="lines">@@ -18,62 +18,62 @@
</span><span class="cx"> PASS For DocumentType created by script, textContent should be null 
</span><span class="cx"> PASS Element without children set to null 
</span><span class="cx"> PASS Element with empty text node as child set to null 
</span><del>-FAIL Element with children set to null NotSupportedError: DOM Exception 9
-FAIL Element with descendants set to null NotSupportedError: DOM Exception 9
</del><ins>+PASS Element with children set to null 
+PASS Element with descendants set to null 
</ins><span class="cx"> PASS DocumentFragment without children set to null 
</span><span class="cx"> PASS DocumentFragment with empty text node as child set to null 
</span><del>-FAIL DocumentFragment with children set to null NotSupportedError: DOM Exception 9
-FAIL DocumentFragment with descendants set to null NotSupportedError: DOM Exception 9
</del><ins>+PASS DocumentFragment with children set to null 
+PASS DocumentFragment with descendants set to null 
</ins><span class="cx"> FAIL Element without children set to undefined assert_equals: expected &quot;&quot; but got &quot;undefined&quot;
</span><span class="cx"> FAIL Element with empty text node as child set to undefined assert_equals: expected &quot;&quot; but got &quot;undefined&quot;
</span><del>-FAIL Element with children set to undefined NotSupportedError: DOM Exception 9
-FAIL Element with descendants set to undefined NotSupportedError: DOM Exception 9
</del><ins>+FAIL Element with children set to undefined assert_equals: expected &quot;&quot; but got &quot;undefined&quot;
+FAIL Element with descendants set to undefined assert_equals: expected &quot;&quot; but got &quot;undefined&quot;
</ins><span class="cx"> FAIL DocumentFragment without children set to undefined assert_equals: expected &quot;&quot; but got &quot;undefined&quot;
</span><span class="cx"> FAIL DocumentFragment with empty text node as child set to undefined assert_equals: expected &quot;&quot; but got &quot;undefined&quot;
</span><del>-FAIL DocumentFragment with children set to undefined NotSupportedError: DOM Exception 9
-FAIL DocumentFragment with descendants set to undefined NotSupportedError: DOM Exception 9
</del><ins>+FAIL DocumentFragment with children set to undefined assert_equals: expected &quot;&quot; but got &quot;undefined&quot;
+FAIL DocumentFragment with descendants set to undefined assert_equals: expected &quot;&quot; but got &quot;undefined&quot;
</ins><span class="cx"> PASS Element without children set to &quot;&quot; 
</span><span class="cx"> PASS Element with empty text node as child set to &quot;&quot; 
</span><del>-FAIL Element with children set to &quot;&quot; NotSupportedError: DOM Exception 9
-FAIL Element with descendants set to &quot;&quot; NotSupportedError: DOM Exception 9
</del><ins>+PASS Element with children set to &quot;&quot; 
+PASS Element with descendants set to &quot;&quot; 
</ins><span class="cx"> PASS DocumentFragment without children set to &quot;&quot; 
</span><span class="cx"> PASS DocumentFragment with empty text node as child set to &quot;&quot; 
</span><del>-FAIL DocumentFragment with children set to &quot;&quot; NotSupportedError: DOM Exception 9
-FAIL DocumentFragment with descendants set to &quot;&quot; NotSupportedError: DOM Exception 9
</del><ins>+PASS DocumentFragment with children set to &quot;&quot; 
+PASS DocumentFragment with descendants set to &quot;&quot; 
</ins><span class="cx"> PASS Element without children set to 42 
</span><span class="cx"> PASS Element with empty text node as child set to 42 
</span><del>-FAIL Element with children set to 42 NotSupportedError: DOM Exception 9
-FAIL Element with descendants set to 42 NotSupportedError: DOM Exception 9
</del><ins>+PASS Element with children set to 42 
+PASS Element with descendants set to 42 
</ins><span class="cx"> PASS DocumentFragment without children set to 42 
</span><span class="cx"> PASS DocumentFragment with empty text node as child set to 42 
</span><del>-FAIL DocumentFragment with children set to 42 NotSupportedError: DOM Exception 9
-FAIL DocumentFragment with descendants set to 42 NotSupportedError: DOM Exception 9
</del><ins>+PASS DocumentFragment with children set to 42 
+PASS DocumentFragment with descendants set to 42 
</ins><span class="cx"> PASS Element without children set to &quot;abc&quot; 
</span><span class="cx"> PASS Element with empty text node as child set to &quot;abc&quot; 
</span><del>-FAIL Element with children set to &quot;abc&quot; NotSupportedError: DOM Exception 9
-FAIL Element with descendants set to &quot;abc&quot; NotSupportedError: DOM Exception 9
</del><ins>+PASS Element with children set to &quot;abc&quot; 
+PASS Element with descendants set to &quot;abc&quot; 
</ins><span class="cx"> PASS DocumentFragment without children set to &quot;abc&quot; 
</span><span class="cx"> PASS DocumentFragment with empty text node as child set to &quot;abc&quot; 
</span><del>-FAIL DocumentFragment with children set to &quot;abc&quot; NotSupportedError: DOM Exception 9
-FAIL DocumentFragment with descendants set to &quot;abc&quot; NotSupportedError: DOM Exception 9
</del><ins>+PASS DocumentFragment with children set to &quot;abc&quot; 
+PASS DocumentFragment with descendants set to &quot;abc&quot; 
</ins><span class="cx"> PASS Element without children set to &quot;&lt;b&gt;xyz&lt;/b&gt;&quot; 
</span><span class="cx"> PASS Element with empty text node as child set to &quot;&lt;b&gt;xyz&lt;/b&gt;&quot; 
</span><del>-FAIL Element with children set to &quot;&lt;b&gt;xyz&lt;/b&gt;&quot; NotSupportedError: DOM Exception 9
-FAIL Element with descendants set to &quot;&lt;b&gt;xyz&lt;/b&gt;&quot; NotSupportedError: DOM Exception 9
</del><ins>+PASS Element with children set to &quot;&lt;b&gt;xyz&lt;/b&gt;&quot; 
+PASS Element with descendants set to &quot;&lt;b&gt;xyz&lt;/b&gt;&quot; 
</ins><span class="cx"> PASS DocumentFragment without children set to &quot;&lt;b&gt;xyz&lt;/b&gt;&quot; 
</span><span class="cx"> PASS DocumentFragment with empty text node as child set to &quot;&lt;b&gt;xyz&lt;/b&gt;&quot; 
</span><del>-FAIL DocumentFragment with children set to &quot;&lt;b&gt;xyz&lt;/b&gt;&quot; NotSupportedError: DOM Exception 9
-FAIL DocumentFragment with descendants set to &quot;&lt;b&gt;xyz&lt;/b&gt;&quot; NotSupportedError: DOM Exception 9
</del><ins>+PASS DocumentFragment with children set to &quot;&lt;b&gt;xyz&lt;/b&gt;&quot; 
+PASS DocumentFragment with descendants set to &quot;&lt;b&gt;xyz&lt;/b&gt;&quot; 
</ins><span class="cx"> PASS Element without children set to &quot;d\0e&quot; 
</span><span class="cx"> PASS Element with empty text node as child set to &quot;d\0e&quot; 
</span><del>-FAIL Element with children set to &quot;d\0e&quot; NotSupportedError: DOM Exception 9
-FAIL Element with descendants set to &quot;d\0e&quot; NotSupportedError: DOM Exception 9
</del><ins>+PASS Element with children set to &quot;d\0e&quot; 
+PASS Element with descendants set to &quot;d\0e&quot; 
</ins><span class="cx"> PASS DocumentFragment without children set to &quot;d\0e&quot; 
</span><span class="cx"> PASS DocumentFragment with empty text node as child set to &quot;d\0e&quot; 
</span><del>-FAIL DocumentFragment with children set to &quot;d\0e&quot; NotSupportedError: DOM Exception 9
-FAIL DocumentFragment with descendants set to &quot;d\0e&quot; NotSupportedError: DOM Exception 9
</del><ins>+PASS DocumentFragment with children set to &quot;d\0e&quot; 
+PASS DocumentFragment with descendants set to &quot;d\0e&quot; 
</ins><span class="cx"> PASS For a Text, textContent should set the data 
</span><del>-FAIL For a ProcessingInstruction, textContent should set the data NotSupportedError: DOM Exception 9
</del><ins>+PASS For a ProcessingInstruction, textContent should set the data 
</ins><span class="cx"> PASS For a Comment, textContent should set the data 
</span><span class="cx"> PASS For Documents created by parser, setting textContent should do nothing 
</span><span class="cx"> PASS For Documents created by createDocument, setting textContent should do nothing 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (189252 => 189253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-09-02 17:07:57 UTC (rev 189252)
+++ trunk/Source/WebCore/ChangeLog        2015-09-02 17:09:00 UTC (rev 189253)
</span><span class="lines">@@ -1,5 +1,27 @@
</span><span class="cx"> 2015-09-02  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        document.createProcessingInstruction() does not behave according to specification
+        https://bugs.webkit.org/show_bug.cgi?id=148710
+
+        Reviewed by Ryosuke Niwa.
+
+        document.createProcessingInstruction() does not behave according to
+        specification:
+        https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
+
+        The following changes were made in this patch to match the specification
+        and the behavior of Firefox / Chrome:
+        1. document.createProcessingInstruction() now works for HTML documents.
+        2. Throw an InvalidCharacterError if the data contains &quot;?&gt;&quot; (step 2 of spec)
+
+        No new tests, already covered by existing tests that are rebaselined in
+        this patch.
+
+        * dom/Document.cpp:
+        (WebCore::Document::createProcessingInstruction):
+
+2015-09-02  Chris Dumez  &lt;cdumez@apple.com&gt;
+
</ins><span class="cx">         http/tests/w3c/dom/nodes/Element-matches.html is flaky
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=148615
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (189252 => 189253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2015-09-02 17:07:57 UTC (rev 189252)
+++ trunk/Source/WebCore/dom/Document.cpp        2015-09-02 17:09:00 UTC (rev 189253)
</span><span class="lines">@@ -900,10 +900,12 @@
</span><span class="cx">         ec = INVALID_CHARACTER_ERR;
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><del>-    if (isHTMLDocument()) {
-        ec = NOT_SUPPORTED_ERR;
</del><ins>+
+    if (data.contains(&quot;?&gt;&quot;)) {
+        ec = INVALID_CHARACTER_ERR;
</ins><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     return ProcessingInstruction::create(*this, target, data);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>