<!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>[190974] releases/WebKitGTK/webkit-2.10</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/190974">190974</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-10-13 04:56:20 -0700 (Tue, 13 Oct 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/190760">r190760</a> - Gracefully handle XMLDocumentParser being detached by mutation events.
https://bugs.webkit.org/show_bug.cgi?id=149485
<rdar://problem/22811489>
Source/WebCore:
This is a merge of Blink change 200026,
https://codereview.chromium.org/1267283002
Patch by Jiewen Tan <jiewen_tan@apple.com> on 2015-10-08
Reviewed by Darin Adler.
Test: fast/parser/xhtml-dom-character-data-modified-crash.html
* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::createLeafTextNode):
Renamed from enterText() to make it more descriptive.
(WebCore::XMLDocumentParser::updateLeafTextNode):
Renamed from exitText to firm up this stage.
(WebCore::XMLDocumentParser::end):
Gracefully handle stopped states.
(WebCore::XMLDocumentParser::enterText): Deleted.
(WebCore::XMLDocumentParser::exitText): Deleted.
* xml/parser/XMLDocumentParser.h:
Rename enterText to createLeafTextNode.
Rename exitText to updateLeafTextNode.
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::startElementNs):
(WebCore::XMLDocumentParser::endElementNs):
(WebCore::XMLDocumentParser::characters):
(WebCore::XMLDocumentParser::processingInstruction):
(WebCore::XMLDocumentParser::cdataBlock):
(WebCore::XMLDocumentParser::comment):
(WebCore::XMLDocumentParser::endDocument):
Rename function calls and firm up updateLeafTextNode stage accordingly.
LayoutTests:
Patch by Jiewen Tan <jiewen_tan@apple.com> on 2015-10-08
Reviewed by Darin Adler.
* fast/parser/resources/xhtml-overwrite-frame.xhtml: Added.
* fast/parser/xhtml-dom-character-data-modified-crash-expected.txt: Added.
* fast/parser/xhtml-dom-character-data-modified-crash.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestsChangeLog">releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCorexmlparserXMLDocumentParsercpp">releases/WebKitGTK/webkit-2.10/Source/WebCore/xml/parser/XMLDocumentParser.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCorexmlparserXMLDocumentParserh">releases/WebKitGTK/webkit-2.10/Source/WebCore/xml/parser/XMLDocumentParser.h</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCorexmlparserXMLDocumentParserLibxml2cpp">releases/WebKitGTK/webkit-2.10/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestsfastparserresourcesxhtmloverwriteframexhtml">releases/WebKitGTK/webkit-2.10/LayoutTests/fast/parser/resources/xhtml-overwrite-frame.xhtml</a></li>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestsfastparserxhtmldomcharacterdatamodifiedcrashexpectedtxt">releases/WebKitGTK/webkit-2.10/LayoutTests/fast/parser/xhtml-dom-character-data-modified-crash-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestsfastparserxhtmldomcharacterdatamodifiedcrashhtml">releases/WebKitGTK/webkit-2.10/LayoutTests/fast/parser/xhtml-dom-character-data-modified-crash.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit210LayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog (190973 => 190974)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog        2015-10-13 11:50:10 UTC (rev 190973)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog        2015-10-13 11:56:20 UTC (rev 190974)
</span><span class="lines">@@ -1,5 +1,17 @@
</span><span class="cx"> 2015-10-08 Jiewen Tan <jiewen_tan@apple.com>
</span><span class="cx">
</span><ins>+ Gracefully handle XMLDocumentParser being detached by mutation events.
+ https://bugs.webkit.org/show_bug.cgi?id=149485
+ <rdar://problem/22811489>
+
+ Reviewed by Darin Adler.
+
+ * fast/parser/resources/xhtml-overwrite-frame.xhtml: Added.
+ * fast/parser/xhtml-dom-character-data-modified-crash-expected.txt: Added.
+ * fast/parser/xhtml-dom-character-data-modified-crash.html: Added.
+
+2015-10-08 Jiewen Tan <jiewen_tan@apple.com>
+
</ins><span class="cx"> Add NULL check for renderBox::layer() on applying zoom level change
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=149302
</span><span class="cx"> <rdar://problem/22747292>
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210LayoutTestsfastparserresourcesxhtmloverwriteframexhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/parser/resources/xhtml-overwrite-frame.xhtml (0 => 190974)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/parser/resources/xhtml-overwrite-frame.xhtml         (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/parser/resources/xhtml-overwrite-frame.xhtml        2015-10-13 11:56:20 UTC (rev 190974)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<html xmlns="http://www.w3.org/1999/xhtml">
+<script>
+function overwrite() {
+ var testRunner = window.parent.testRunner;
+ window.frameElement.outerHTML = "PASS (no crash)";
+ if (testRunner)
+ testRunner.notifyDone();
+}
+
+document.addEventListener("DOMCharacterDataModified", overwrite);
+</script>
+</html>
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit210LayoutTestsfastparserxhtmldomcharacterdatamodifiedcrashexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/parser/xhtml-dom-character-data-modified-crash-expected.txt (0 => 190974)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/parser/xhtml-dom-character-data-modified-crash-expected.txt         (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/parser/xhtml-dom-character-data-modified-crash-expected.txt        2015-10-13 11:56:20 UTC (rev 190974)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS (no crash)
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit210LayoutTestsfastparserxhtmldomcharacterdatamodifiedcrashhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/parser/xhtml-dom-character-data-modified-crash.html (0 => 190974)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/parser/xhtml-dom-character-data-modified-crash.html         (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/parser/xhtml-dom-character-data-modified-crash.html        2015-10-13 11:56:20 UTC (rev 190974)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+<!DOCTYPE html>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+</script>
+<iframe src="resources/xhtml-overwrite-frame.xhtml"></iframe>
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog (190973 => 190974)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog        2015-10-13 11:50:10 UTC (rev 190973)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog        2015-10-13 11:56:20 UTC (rev 190974)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2015-10-08 Jiewen Tan <jiewen_tan@apple.com>
+
+ Gracefully handle XMLDocumentParser being detached by mutation events.
+ https://bugs.webkit.org/show_bug.cgi?id=149485
+ <rdar://problem/22811489>
+
+ This is a merge of Blink change 200026,
+ https://codereview.chromium.org/1267283002
+
+ Reviewed by Darin Adler.
+
+ Test: fast/parser/xhtml-dom-character-data-modified-crash.html
+
+ * xml/parser/XMLDocumentParser.cpp:
+ (WebCore::XMLDocumentParser::createLeafTextNode):
+ Renamed from enterText() to make it more descriptive.
+
+ (WebCore::XMLDocumentParser::updateLeafTextNode):
+ Renamed from exitText to firm up this stage.
+
+ (WebCore::XMLDocumentParser::end):
+ Gracefully handle stopped states.
+
+ (WebCore::XMLDocumentParser::enterText): Deleted.
+ (WebCore::XMLDocumentParser::exitText): Deleted.
+
+ * xml/parser/XMLDocumentParser.h:
+ Rename enterText to createLeafTextNode.
+ Rename exitText to updateLeafTextNode.
+
+ * xml/parser/XMLDocumentParserLibxml2.cpp:
+ (WebCore::XMLDocumentParser::startElementNs):
+ (WebCore::XMLDocumentParser::endElementNs):
+ (WebCore::XMLDocumentParser::characters):
+ (WebCore::XMLDocumentParser::processingInstruction):
+ (WebCore::XMLDocumentParser::cdataBlock):
+ (WebCore::XMLDocumentParser::comment):
+ (WebCore::XMLDocumentParser::endDocument):
+ Rename function calls and firm up updateLeafTextNode stage accordingly.
+
</ins><span class="cx"> 2015-10-08 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> data: URLs should not be preloaded
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCorexmlparserXMLDocumentParsercpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/xml/parser/XMLDocumentParser.cpp (190973 => 190974)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/xml/parser/XMLDocumentParser.cpp        2015-10-13 11:50:10 UTC (rev 190973)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/xml/parser/XMLDocumentParser.cpp        2015-10-13 11:56:20 UTC (rev 190974)
</span><span class="lines">@@ -136,8 +136,11 @@
</span><span class="cx"> stopParsing();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void XMLDocumentParser::enterText()
</del><ins>+void XMLDocumentParser::createLeafTextNode()
</ins><span class="cx"> {
</span><ins>+ if (m_leafTextNode)
+ return;
+
</ins><span class="cx"> ASSERT(m_bufferedText.size() == 0);
</span><span class="cx"> ASSERT(!m_leafTextNode);
</span><span class="cx"> m_leafTextNode = Text::create(m_currentNode->document(), "");
</span><span class="lines">@@ -150,19 +153,23 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><del>-void XMLDocumentParser::exitText()
</del><ins>+bool XMLDocumentParser::updateLeafTextNode()
</ins><span class="cx"> {
</span><span class="cx"> if (isStopped())
</span><del>- return;
</del><ins>+ return false;
</ins><span class="cx">
</span><span class="cx"> if (!m_leafTextNode)
</span><del>- return;
</del><ins>+ return true;
</ins><span class="cx">
</span><ins>+ // This operation might fire mutation event, see below.
</ins><span class="cx"> m_leafTextNode->appendData(toString(m_bufferedText.data(), m_bufferedText.size()), IGNORE_EXCEPTION);
</span><del>- Vector<xmlChar> empty;
- m_bufferedText.swap(empty);
</del><ins>+ m_bufferedText = { };
</ins><span class="cx">
</span><span class="cx"> m_leafTextNode = nullptr;
</span><ins>+
+ // Hence, we need to check again whether the parser is stopped, since mutation
+ // event handlers executed by appendData might have detached this parser.
+ return !isStopped();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void XMLDocumentParser::detach()
</span><span class="lines">@@ -191,7 +198,7 @@
</span><span class="cx"> if (m_sawError)
</span><span class="cx"> insertErrorMessageBlock();
</span><span class="cx"> else {
</span><del>- exitText();
</del><ins>+ updateLeafTextNode();
</ins><span class="cx"> document()->styleResolverChanged(RecalcStyleImmediately);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCorexmlparserXMLDocumentParserh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/xml/parser/XMLDocumentParser.h (190973 => 190974)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/xml/parser/XMLDocumentParser.h        2015-10-13 11:50:10 UTC (rev 190973)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/xml/parser/XMLDocumentParser.h        2015-10-13 11:56:20 UTC (rev 190974)
</span><span class="lines">@@ -146,8 +146,8 @@
</span><span class="cx">
</span><span class="cx"> void insertErrorMessageBlock();
</span><span class="cx">
</span><del>- void enterText();
- void exitText();
</del><ins>+ void createLeafTextNode();
+ bool updateLeafTextNode();
</ins><span class="cx">
</span><span class="cx"> void doWrite(const String&);
</span><span class="cx"> void doEnd();
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCorexmlparserXMLDocumentParserLibxml2cpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp (190973 => 190974)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp        2015-10-13 11:50:10 UTC (rev 190973)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp        2015-10-13 11:56:20 UTC (rev 190974)
</span><span class="lines">@@ -797,7 +797,8 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- exitText();
</del><ins>+ if (!updateLeafTextNode())
+ return;
</ins><span class="cx">
</span><span class="cx"> AtomicString localName = toAtomicString(xmlLocalName);
</span><span class="cx"> AtomicString uri = toAtomicString(xmlURI);
</span><span class="lines">@@ -881,7 +882,8 @@
</span><span class="cx"> // before the end of this method.
</span><span class="cx"> Ref<XMLDocumentParser> protect(*this);
</span><span class="cx">
</span><del>- exitText();
</del><ins>+ if (!updateLeafTextNode())
+ return;
</ins><span class="cx">
</span><span class="cx"> RefPtr<ContainerNode> node = m_currentNode;
</span><span class="cx"> node->finishParsingChildren();
</span><span class="lines">@@ -956,7 +958,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!m_leafTextNode)
</span><del>- enterText();
</del><ins>+ createLeafTextNode();
</ins><span class="cx"> m_bufferedText.append(s, len);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -995,7 +997,8 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- exitText();
</del><ins>+ if (!updateLeafTextNode())
+ return;
</ins><span class="cx">
</span><span class="cx"> // ### handle exceptions
</span><span class="cx"> ExceptionCode ec = 0;
</span><span class="lines">@@ -1029,7 +1032,8 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- exitText();
</del><ins>+ if (!updateLeafTextNode())
+ return;
</ins><span class="cx">
</span><span class="cx"> RefPtr<CDATASection> newNode = CDATASection::create(m_currentNode->document(), toString(s, len));
</span><span class="cx"> m_currentNode->parserAppendChild(newNode.release());
</span><span class="lines">@@ -1045,7 +1049,8 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- exitText();
</del><ins>+ if (!updateLeafTextNode())
+ return;
</ins><span class="cx">
</span><span class="cx"> RefPtr<Comment> newNode = Comment::create(m_currentNode->document(), toString(s));
</span><span class="cx"> m_currentNode->parserAppendChild(newNode.release());
</span><span class="lines">@@ -1077,7 +1082,7 @@
</span><span class="cx">
</span><span class="cx"> void XMLDocumentParser::endDocument()
</span><span class="cx"> {
</span><del>- exitText();
</del><ins>+ updateLeafTextNode();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void XMLDocumentParser::internalSubset(const xmlChar* name, const xmlChar* externalID, const xmlChar* systemID)
</span></span></pre>
</div>
</div>
</body>
</html>