<!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>[172166] branches/safari-600.1.4-branch</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/172166">172166</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2014-08-06 13:09:49 -0700 (Wed, 06 Aug 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/172112">r172112</a>. &lt;rdar://problem/17802174&gt;</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari60014branchLayoutTestsChangeLog">branches/safari-600.1.4-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari60014branchSourceWebCoreChangeLog">branches/safari-600.1.4-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari60014branchSourceWebCorepagescrollingScrollingStateTreecpp">branches/safari-600.1.4-branch/Source/WebCore/page/scrolling/ScrollingStateTree.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari60014branchLayoutTestsplatformmacwk2tileddrawingscrollingframesorphanedsubtreeexpectedtxt">branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/orphaned-subtree-expected.txt</a></li>
<li><a href="#branchessafari60014branchLayoutTestsplatformmacwk2tileddrawingscrollingframesorphanedsubtreehtml">branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/orphaned-subtree.html</a></li>
<li><a href="#branchessafari60014branchLayoutTestsplatformmacwk2tileddrawingscrollingframesresourcesleafframehtml">branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/leaf-frame.html</a></li>
<li><a href="#branchessafari60014branchLayoutTestsplatformmacwk2tileddrawingscrollingframesresourcessubframeinsidefixedhtml">branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/subframe-inside-fixed.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari60014branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/LayoutTests/ChangeLog (172165 => 172166)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/LayoutTests/ChangeLog        2014-08-06 19:21:15 UTC (rev 172165)
+++ branches/safari-600.1.4-branch/LayoutTests/ChangeLog        2014-08-06 20:09:49 UTC (rev 172166)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-08-06  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r172112. &lt;rdar://problem/17802174&gt;
+
+    2014-08-05  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+    
+            [iOS WK2] Crash going back on a specific tumblr blog (under ScrollingStateTree::removeNodeAndAllDescendants)
+            https://bugs.webkit.org/show_bug.cgi?id=135629
+            &lt;rdar://problem/17802174&gt;
+    
+            Reviewed by Tim Horton.
+            
+            Testcase with nesting of frames inside fixed inside frames, where a subframe disconnects
+            part of the scrolling tree.
+    
+            * platform/mac-wk2/tiled-drawing/scrolling/frames/orphaned-subtree-expected.txt: Added.
+            * platform/mac-wk2/tiled-drawing/scrolling/frames/orphaned-subtree.html: Added.
+            * platform/mac-wk2/tiled-drawing/scrolling/frames/resources/leaf-frame.html: Added.
+            * platform/mac-wk2/tiled-drawing/scrolling/frames/resources/subframe-inside-fixed.html: Added.
+    
</ins><span class="cx"> 2014-08-04  Lucas Forschler  &lt;lforschler@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r171882
</span></span></pre></div>
<a id="branchessafari60014branchLayoutTestsplatformmacwk2tileddrawingscrollingframesorphanedsubtreeexpectedtxtfromrev172112trunkLayoutTestsplatformmacwk2tileddrawingscrollingframesorphanedsubtreeexpectedtxt"></a>
<div class="copfile"><h4>Copied: branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/orphaned-subtree-expected.txt (from rev 172112, trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/orphaned-subtree-expected.txt) (0 => 172166)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/orphaned-subtree-expected.txt                                (rev 0)
+++ branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/orphaned-subtree-expected.txt        2014-08-06 20:09:49 UTC (rev 172166)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+This test passes if it does not crash on the reload.
+
+
</ins></span></pre></div>
<a id="branchessafari60014branchLayoutTestsplatformmacwk2tileddrawingscrollingframesorphanedsubtreehtmlfromrev172112trunkLayoutTestsplatformmacwk2tileddrawingscrollingframesorphanedsubtreehtml"></a>
<div class="copfile"><h4>Copied: branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/orphaned-subtree.html (from rev 172112, trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/orphaned-subtree.html) (0 => 172166)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/orphaned-subtree.html                                (rev 0)
+++ branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/orphaned-subtree.html        2014-08-06 20:09:49 UTC (rev 172166)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;script&gt;
+        if (window.testRunner) {
+            testRunner.waitUntilDone();
+            testRunner.dumpAsText();
+            window.internals.settings.setScrollingTreeIncludesFrames(true);
+        }
+
+        function childFrameTestDone()
+        {
+            // Avoid infinite reload in the non-DRT case.
+            if (window.location.search)
+                return;
+
+            window.location += '?done=true';
+        }
+        
+        function checkForDoneTest()
+        {
+            if (window.location.search) {
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }
+        }
+        
+        window.addEventListener('load', checkForDoneTest, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;p&gt;This test passes if it does not crash on the reload.&lt;/p&gt;
+    &lt;iframe id=&quot;iframe&quot; src=&quot;resources/subframe-inside-fixed.html&quot; scrolling=&quot;no&quot; width=&quot;500&quot; height=&quot;300&quot;&gt;&lt;/iframe&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="branchessafari60014branchLayoutTestsplatformmacwk2tileddrawingscrollingframesresourcesleafframehtmlfromrev172112trunkLayoutTestsplatformmacwk2tileddrawingscrollingframesresourcesleafframehtml"></a>
<div class="copfile"><h4>Copied: branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/leaf-frame.html (from rev 172112, trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/leaf-frame.html) (0 => 172166)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/leaf-frame.html                                (rev 0)
+++ branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/leaf-frame.html        2014-08-06 20:09:49 UTC (rev 172166)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        .box {
+            height: 100px;
+            width: 100px;
+            background-color: blue;
+            position: fixed;
+        }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div class=&quot;box&quot;&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="branchessafari60014branchLayoutTestsplatformmacwk2tileddrawingscrollingframesresourcessubframeinsidefixedhtmlfromrev172112trunkLayoutTestsplatformmacwk2tileddrawingscrollingframesresourcessubframeinsidefixedhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/subframe-inside-fixed.html (from rev 172112, trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/subframe-inside-fixed.html) (0 => 172166)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/subframe-inside-fixed.html                                (rev 0)
+++ branches/safari-600.1.4-branch/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/subframe-inside-fixed.html        2014-08-06 20:09:49 UTC (rev 172166)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        .fixed {
+            position: fixed;
+            border: 1px solid red;
+        }
+        
+        .removed {
+            display: none;
+        }
+        
+    &lt;/style&gt;
+    &lt;script&gt;
+        function subframeLoaded()
+        {
+            window.setTimeout(function() {
+                document.getElementById('container').classList.add('removed');
+                window.parent.childFrameTestDone();
+            }, 0);
+        }
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div class=&quot;fixed&quot; id=&quot;container&quot;&gt;
+        &lt;iframe onload=&quot;subframeLoaded()&quot; src=&quot;leaf-frame.html&quot;&gt;&lt;/iframe&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="branchessafari60014branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebCore/ChangeLog (172165 => 172166)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebCore/ChangeLog        2014-08-06 19:21:15 UTC (rev 172165)
+++ branches/safari-600.1.4-branch/Source/WebCore/ChangeLog        2014-08-06 20:09:49 UTC (rev 172166)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2014-08-06  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r172112. &lt;rdar://problem/17802174&gt;
+
+    2014-08-05  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+    
+            [iOS WK2] Crash going back on a specific tumblr blog (under ScrollingStateTree::removeNodeAndAllDescendants)
+            https://bugs.webkit.org/show_bug.cgi?id=135629
+            &lt;rdar://problem/17802174&gt;
+    
+            Reviewed by Tim Horton.
+            
+            In r170198 I added an &quot;orphan scrolling nodes&quot; code path that sets aside subtrees
+            of scrolling nodes into an m_orphanedSubframeNodes map, which keeps them alive until
+            they get reparented or destroyed. The nodes in that subtree remain in m_stateNodeMap,
+            which holds raw pointers to them.
+            
+            However, ScrollingStateTree::commit() can clear m_orphanedSubframeNodes, which is
+            sometimes non-empty at this point. When that happened, we would destroy nodes which
+            were still referenced by m_stateNodeMap, with the result that a later query for the
+            same nodeID would hand back a pointer to a deleted object.
+            
+            Fix by calling recursiveNodeWillBeRemoved() on nodes in the m_orphanedSubframeNodes
+            before clearing it, which removes them and all their descendants from the state node map.
+    
+            Test: platform/mac-wk2/tiled-drawing/scrolling/frames/orphaned-subtree.html
+    
+            * page/scrolling/ScrollingStateTree.cpp:
+            (WebCore::ScrollingStateTree::clear):
+            (WebCore::ScrollingStateTree::commit):
+    
</ins><span class="cx"> 2014-08-05  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r172083. &lt;rdar://problem/17849206&gt;
</span></span></pre></div>
<a id="branchessafari60014branchSourceWebCorepagescrollingScrollingStateTreecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebCore/page/scrolling/ScrollingStateTree.cpp (172165 => 172166)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebCore/page/scrolling/ScrollingStateTree.cpp        2014-08-06 19:21:15 UTC (rev 172165)
+++ branches/safari-600.1.4-branch/Source/WebCore/page/scrolling/ScrollingStateTree.cpp        2014-08-06 20:09:49 UTC (rev 172166)
</span><span class="lines">@@ -151,14 +151,19 @@
</span><span class="cx">     if (rootStateNode())
</span><span class="cx">         removeNodeAndAllDescendants(rootStateNode());
</span><span class="cx"> 
</span><del>-    ASSERT(m_stateNodeMap.isEmpty());
</del><span class="cx">     m_stateNodeMap.clear();
</span><span class="cx">     m_orphanedSubframeNodes.clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PassOwnPtr&lt;ScrollingStateTree&gt; ScrollingStateTree::commit(LayerRepresentation::Type preferredLayerRepresentation)
</span><span class="cx"> {
</span><del>-    m_orphanedSubframeNodes.clear();
</del><ins>+    if (!m_orphanedSubframeNodes.isEmpty()) {
+        // If we still have orphaned subtrees, remove them from m_stateNodeMap since they will be deleted 
+        // when clearing m_orphanedSubframeNodes.
+        for (auto&amp; orphanNode : m_orphanedSubframeNodes.values())
+            recursiveNodeWillBeRemoved(orphanNode.get(), SubframeNodeRemoval::Delete);
+        m_orphanedSubframeNodes.clear();
+    }
</ins><span class="cx"> 
</span><span class="cx">     // This function clones and resets the current state tree, but leaves the tree structure intact.
</span><span class="cx">     OwnPtr&lt;ScrollingStateTree&gt; treeStateClone = ScrollingStateTree::create();
</span></span></pre>
</div>
</div>

</body>
</html>