<!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>[190067] 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/190067">190067</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-09-21 12:15:03 -0700 (Mon, 21 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Range.cloneContents() / extractContents should throw a HierarchyRequestError when encountering a doctype
https://bugs.webkit.org/show_bug.cgi?id=148770
&lt;rdar://problem/22570898&gt;

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline W3C DOM test now that more checks are passing.

* web-platform-tests/dom/ranges/Range-cloneContents-expected.txt:

Source/WebCore:

Range.cloneContents() and Range.extractContents() should throw a
HierarchyRequestError when encountering a doctype:
- https://dom.spec.whatwg.org/#concept-range-clone (step 12)
- https://dom.spec.whatwg.org/#concept-range-extract (step 12)

However, Range.deleteContents() should not:
- https://dom.spec.whatwg.org/#dom-range-deletecontents

WebKit was not throwing in the Range.cloneContents() case. This
aligns updates our behavior to match the specification and
Firefox.

Tests: fast/dom/Range/clone-contents-document-type.html
       fast/dom/Range/delete-contents-document-type.html
       fast/dom/Range/extract-contents-document-type.html

* dom/Range.cpp:
(WebCore::Range::processContentsBetweenOffsets):

LayoutTests:

Add new tests to cover the behaviour of Range's cloneContents() / extractContents()
and deleteContents() when encountering a doctype.

* fast/dom/Range/clone-contents-document-type-expected.txt: Added.
* fast/dom/Range/clone-contents-document-type.html: Added.
* fast/dom/Range/delete-contents-document-type-expected.txt: Added.
* fast/dom/Range/delete-contents-document-type.html: Added.
* fast/dom/Range/extract-contents-document-type-expected.txt: Added.
* fast/dom/Range/extract-contents-document-type.html: Added.
* fast/dom/Range/resources/frame-with-doctype.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdomrangesRangecloneContentsexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/ranges/Range-cloneContents-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomRangecpp">trunk/Source/WebCore/dom/Range.cpp</a></li>
<li><a href="#trunkSourceWebCoredomRangeh">trunk/Source/WebCore/dom/Range.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomRangeclonecontentsdocumenttypeexpectedtxt">trunk/LayoutTests/fast/dom/Range/clone-contents-document-type-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomRangeclonecontentsdocumenttypehtml">trunk/LayoutTests/fast/dom/Range/clone-contents-document-type.html</a></li>
<li><a href="#trunkLayoutTestsfastdomRangedeletecontentsdocumenttypeexpectedtxt">trunk/LayoutTests/fast/dom/Range/delete-contents-document-type-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomRangedeletecontentsdocumenttypehtml">trunk/LayoutTests/fast/dom/Range/delete-contents-document-type.html</a></li>
<li><a href="#trunkLayoutTestsfastdomRangeextractcontentsdocumenttypeexpectedtxt">trunk/LayoutTests/fast/dom/Range/extract-contents-document-type-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomRangeextractcontentsdocumenttypehtml">trunk/LayoutTests/fast/dom/Range/extract-contents-document-type.html</a></li>
<li><a href="#trunkLayoutTestsfastdomRangeresourcesframewithdoctypehtml">trunk/LayoutTests/fast/dom/Range/resources/frame-with-doctype.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (190066 => 190067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-21 19:11:42 UTC (rev 190066)
+++ trunk/LayoutTests/ChangeLog        2015-09-21 19:15:03 UTC (rev 190067)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2015-09-21  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Range.cloneContents() / extractContents should throw a HierarchyRequestError when encountering a doctype
+        https://bugs.webkit.org/show_bug.cgi?id=148770
+        &lt;rdar://problem/22570898&gt;
+
+        Reviewed by Ryosuke Niwa.
+
+        Add new tests to cover the behaviour of Range's cloneContents() / extractContents()
+        and deleteContents() when encountering a doctype.
+
+        * fast/dom/Range/clone-contents-document-type-expected.txt: Added.
+        * fast/dom/Range/clone-contents-document-type.html: Added.
+        * fast/dom/Range/delete-contents-document-type-expected.txt: Added.
+        * fast/dom/Range/delete-contents-document-type.html: Added.
+        * fast/dom/Range/extract-contents-document-type-expected.txt: Added.
+        * fast/dom/Range/extract-contents-document-type.html: Added.
+        * fast/dom/Range/resources/frame-with-doctype.html: Added.
+
</ins><span class="cx"> 2015-09-21  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add the ability for tests to run script in the UI process in WebKitTestRunner
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomRangeclonecontentsdocumenttypeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/Range/clone-contents-document-type-expected.txt (0 => 190067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Range/clone-contents-document-type-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Range/clone-contents-document-type-expected.txt        2015-09-21 19:15:03 UTC (rev 190067)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Checks that Range.cloneContents() throws a HierarchyRequestError when encountering a docType
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS range.cloneContents() threw exception Error: HierarchyRequestError: DOM Exception 3.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomRangeclonecontentsdocumenttypehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/Range/clone-contents-document-type.html (0 => 190067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Range/clone-contents-document-type.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Range/clone-contents-document-type.html        2015-09-21 19:15:03 UTC (rev 190067)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+&lt;!DOCTYPE&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+description(&quot;Checks that Range.cloneContents() throws a HierarchyRequestError when encountering a docType&quot;);
+
+var range = document.createRange();
+range.setStart(document, 0);
+range.setEnd(document, 2);
+
+shouldThrow(&quot;range.cloneContents()&quot;, &quot;'Error: HierarchyRequestError: DOM Exception 3'&quot;);
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomRangedeletecontentsdocumenttypeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/Range/delete-contents-document-type-expected.txt (0 => 190067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Range/delete-contents-document-type-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Range/delete-contents-document-type-expected.txt        2015-09-21 19:15:03 UTC (rev 190067)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Checks that Range.deleteContents() is able to delete a docType
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS testDocument.doctype is not null
+PASS range.deleteContents() did not throw exception.
+PASS testDocument.doctype is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomRangedeletecontentsdocumenttypehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/Range/delete-contents-document-type.html (0 => 190067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Range/delete-contents-document-type.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Range/delete-contents-document-type.html        2015-09-21 19:15:03 UTC (rev 190067)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;!DOCTYPE&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+description(&quot;Checks that Range.deleteContents() is able to delete a docType&quot;);
+jsTestIsAsync = true;
+
+function runTest() {
+    testDocument = document.getElementById(&quot;testFrame&quot;).contentDocument;
+    shouldNotBe(&quot;testDocument.doctype&quot;, &quot;null&quot;);
+
+    range = testDocument.createRange();
+    range.setStart(testDocument, 0);
+    range.setEnd(testDocument, 2);
+
+    shouldNotThrow(&quot;range.deleteContents()&quot;);
+    shouldBe(&quot;testDocument.doctype&quot;, &quot;null&quot;);
+    finishJSTest();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;iframe id=&quot;testFrame&quot; src=&quot;resources/frame-with-doctype.html&quot; onload=&quot;runTest()&quot;&gt;&lt;/iframe&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomRangeextractcontentsdocumenttypeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/Range/extract-contents-document-type-expected.txt (0 => 190067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Range/extract-contents-document-type-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Range/extract-contents-document-type-expected.txt        2015-09-21 19:15:03 UTC (rev 190067)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Checks that Range.extractContents() throws a HierarchyRequestError when encountering a docType
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS range.extractContents() threw exception Error: HierarchyRequestError: DOM Exception 3.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomRangeextractcontentsdocumenttypehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/Range/extract-contents-document-type.html (0 => 190067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Range/extract-contents-document-type.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Range/extract-contents-document-type.html        2015-09-21 19:15:03 UTC (rev 190067)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+&lt;!DOCTYPE&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+description(&quot;Checks that Range.extractContents() throws a HierarchyRequestError when encountering a docType&quot;);
+
+var range = document.createRange();
+range.setStart(document, 0);
+range.setEnd(document, 2);
+
+shouldThrow(&quot;range.extractContents()&quot;, &quot;'Error: HierarchyRequestError: DOM Exception 3'&quot;);
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomRangeresourcesframewithdoctypehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/Range/resources/frame-with-doctype.html (0 => 190067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Range/resources/frame-with-doctype.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Range/resources/frame-with-doctype.html        2015-09-21 19:15:03 UTC (rev 190067)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;TEST&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (190066 => 190067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2015-09-21 19:11:42 UTC (rev 190066)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2015-09-21 19:15:03 UTC (rev 190067)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-09-21  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Range.cloneContents() / extractContents should throw a HierarchyRequestError when encountering a doctype
+        https://bugs.webkit.org/show_bug.cgi?id=148770
+        &lt;rdar://problem/22570898&gt;
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline W3C DOM test now that more checks are passing.
+
+        * web-platform-tests/dom/ranges/Range-cloneContents-expected.txt:
+
</ins><span class="cx"> 2015-09-19  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Get rid of custom bindings for HTMLLinkElement.sizes setter
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomrangesRangecloneContentsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/ranges/Range-cloneContents-expected.txt (190066 => 190067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/ranges/Range-cloneContents-expected.txt        2015-09-21 19:11:42 UTC (rev 190066)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/ranges/Range-cloneContents-expected.txt        2015-09-21 19:15:03 UTC (rev 190067)
</span><span class="lines">@@ -74,10 +74,8 @@
</span><span class="cx"> PASS Resulting DOM for range 23 [document, 0, document, 1] 
</span><span class="cx"> PASS Resulting cursor position for range 23 [document, 0, document, 1] 
</span><span class="cx"> PASS Returned fragment for range 23 [document, 0, document, 1] 
</span><del>-FAIL Resulting DOM for range 24 [document, 0, document, 2] assert_throws: function &quot;function () {
-        actualRange.cloneContents();
-      }&quot; did not throw
-FAIL Resulting cursor position for range 24 [document, 0, document, 2] undefined is not an object (evaluating 'actualRoots')
</del><ins>+PASS Resulting DOM for range 24 [document, 0, document, 2] 
+PASS Resulting cursor position for range 24 [document, 0, document, 2] 
</ins><span class="cx"> PASS Returned fragment for range 24 [document, 0, document, 2] 
</span><span class="cx"> PASS Resulting DOM for range 25 [comment, 2, comment, 3] 
</span><span class="cx"> PASS Resulting cursor position for range 25 [comment, 2, comment, 3] 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (190066 => 190067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-09-21 19:11:42 UTC (rev 190066)
+++ trunk/Source/WebCore/ChangeLog        2015-09-21 19:15:03 UTC (rev 190067)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2015-09-21  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Range.cloneContents() / extractContents should throw a HierarchyRequestError when encountering a doctype
+        https://bugs.webkit.org/show_bug.cgi?id=148770
+        &lt;rdar://problem/22570898&gt;
+
+        Reviewed by Ryosuke Niwa.
+
+        Range.cloneContents() and Range.extractContents() should throw a
+        HierarchyRequestError when encountering a doctype:
+        - https://dom.spec.whatwg.org/#concept-range-clone (step 12)
+        - https://dom.spec.whatwg.org/#concept-range-extract (step 12)
+
+        However, Range.deleteContents() should not:
+        - https://dom.spec.whatwg.org/#dom-range-deletecontents
+
+        WebKit was not throwing in the Range.cloneContents() case. This
+        aligns updates our behavior to match the specification and
+        Firefox.
+
+        Tests: fast/dom/Range/clone-contents-document-type.html
+               fast/dom/Range/delete-contents-document-type.html
+               fast/dom/Range/extract-contents-document-type.html
+
+        * dom/Range.cpp:
+        (WebCore::Range::processContentsBetweenOffsets):
+
</ins><span class="cx"> 2015-09-21  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         UserMediaClientMock leaks every test run
</span></span></pre></div>
<a id="trunkSourceWebCoredomRangecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Range.cpp (190066 => 190067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Range.cpp        2015-09-21 19:11:42 UTC (rev 190066)
+++ trunk/Source/WebCore/dom/Range.cpp        2015-09-21 19:15:03 UTC (rev 190067)
</span><span class="lines">@@ -489,7 +489,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Range::deleteContents(ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><del>-    checkDeleteExtract(Delete, ec);
</del><ins>+    checkDeleteExtract(ec);
</ins><span class="cx">     if (ec)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -693,7 +693,7 @@
</span><span class="cx">     ASSERT(startOffset &lt;= endOffset);
</span><span class="cx"> 
</span><span class="cx">     // This switch statement must be consistent with that of lengthOfContentsInNode.
</span><del>-    RefPtr&lt;Node&gt; result;   
</del><ins>+    RefPtr&lt;Node&gt; result;
</ins><span class="cx">     switch (container-&gt;nodeType()) {
</span><span class="cx">     case Node::TEXT_NODE:
</span><span class="cx">     case Node::CDATA_SECTION_NODE:
</span><span class="lines">@@ -750,8 +750,13 @@
</span><span class="cx">         Vector&lt;RefPtr&lt;Node&gt;&gt; nodes;
</span><span class="cx">         for (unsigned i = startOffset; n &amp;&amp; i; i--)
</span><span class="cx">             n = n-&gt;nextSibling();
</span><del>-        for (unsigned i = startOffset; n &amp;&amp; i &lt; endOffset; i++, n = n-&gt;nextSibling())
</del><ins>+        for (unsigned i = startOffset; n &amp;&amp; i &lt; endOffset; i++, n = n-&gt;nextSibling()) {
+            if (action != Delete &amp;&amp; n-&gt;isDocumentTypeNode()) {
+                ec = HIERARCHY_REQUEST_ERR;
+                return nullptr;
+            }
</ins><span class="cx">             nodes.append(n);
</span><ins>+        }
</ins><span class="cx"> 
</span><span class="cx">         processNodes(action, nodes, container, result, ec);
</span><span class="cx">         break;
</span><span class="lines">@@ -834,7 +839,7 @@
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;DocumentFragment&gt; Range::extractContents(ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><del>-    checkDeleteExtract(Extract, ec);
</del><ins>+    checkDeleteExtract(ec);
</ins><span class="cx">     if (ec)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="lines">@@ -1324,7 +1329,7 @@
</span><span class="cx">     setStart(refNode-&gt;parentNode(), refNode-&gt;computeNodeIndex(), ec);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Range::checkDeleteExtract(ActionType action, ExceptionCode&amp; ec)
</del><ins>+void Range::checkDeleteExtract(ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     ec = 0;
</span><span class="cx">     if (!commonAncestorContainer())
</span><span class="lines">@@ -1336,11 +1341,6 @@
</span><span class="cx">             ec = NO_MODIFICATION_ALLOWED_ERR;
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-
-        if (action == Extract &amp;&amp; n-&gt;nodeType() == Node::DOCUMENT_TYPE_NODE) {
-            ec = HIERARCHY_REQUEST_ERR;
-            return;
-        }
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (containedByReadOnly()) {
</span></span></pre></div>
<a id="trunkSourceWebCoredomRangeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Range.h (190066 => 190067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Range.h        2015-09-21 19:11:42 UTC (rev 190066)
+++ trunk/Source/WebCore/dom/Range.h        2015-09-21 19:15:03 UTC (rev 190067)
</span><span class="lines">@@ -164,7 +164,7 @@
</span><span class="cx">     bool containedByReadOnly() const;
</span><span class="cx"> 
</span><span class="cx">     enum ActionType { Delete, Extract, Clone };
</span><del>-    void checkDeleteExtract(ActionType, ExceptionCode&amp;);
</del><ins>+    void checkDeleteExtract(ExceptionCode&amp;);
</ins><span class="cx">     RefPtr&lt;DocumentFragment&gt; processContents(ActionType, ExceptionCode&amp;);
</span><span class="cx">     static RefPtr&lt;Node&gt; processContentsBetweenOffsets(ActionType, PassRefPtr&lt;DocumentFragment&gt;, Node*, unsigned startOffset, unsigned endOffset, ExceptionCode&amp;);
</span><span class="cx">     static void processNodes(ActionType, Vector&lt;RefPtr&lt;Node&gt;&gt;&amp;, PassRefPtr&lt;Node&gt; oldContainer, PassRefPtr&lt;Node&gt; newContainer, ExceptionCode&amp;);
</span></span></pre>
</div>
</div>

</body>
</html>