<!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>[198249] branches/safari-601.1.46-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/198249">198249</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2016-03-15 17:22:12 -0700 (Tue, 15 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/194060">r194060</a>. rdar://problem/24560757</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari601146branchSourceWebKit2ChangeLog">branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessiosWKPDFViewmm">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKPDFView.mm</a></li>
<li><a href="#branchessafari601146branchToolsChangeLog">branches/safari-601.1.46-branch/Tools/ChangeLog</a></li>
<li><a href="#branchessafari601146branchToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">branches/safari-601.1.46-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari601146branchToolsTestWebKitAPITestsWebKit2CocoaWKPDFViewResizeCrashmm">branches/safari-601.1.46-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKPDFViewResizeCrash.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601146branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog (198248 => 198249)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog        2016-03-16 00:22:08 UTC (rev 198248)
+++ branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog        2016-03-16 00:22:12 UTC (rev 198249)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-03-15  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r194060. rdar://problem/24560757
+
+    2015-12-14  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+            Frequent crash under -[WKPDFView web_setMinimumSize:]_block_invoke
+            https://bugs.webkit.org/show_bug.cgi?id=152266
+            &lt;rdar://problem/22092676&gt;
+
+            Reviewed by Simon Fraser.
+
+            * UIProcess/ios/WKPDFView.mm:
+            (-[WKPDFView web_setMinimumSize:]):
+            We weren't retaining the UIScrollView, but depending on it surviving
+            into this block's invocation.
+
+            We don't need to do this asynchronously anymore because the referenced
+            bug is fixed, so make it happen synchronously. This also fixes the crash
+            because there's no opportunity for the scroll view to be released.
+
</ins><span class="cx"> 2016-02-16  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge patch for r192036 and r196679.
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessiosWKPDFViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKPDFView.mm (198248 => 198249)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKPDFView.mm        2016-03-16 00:22:08 UTC (rev 198248)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKPDFView.mm        2016-03-16 00:22:12 UTC (rev 198249)
</span><span class="lines">@@ -216,16 +216,11 @@
</span><span class="cx"> 
</span><span class="cx">     [self _computePageAndDocumentFrames];
</span><span class="cx"> 
</span><del>-    // FIXME: This dispatch_async is unnecessary except to work around rdar://problem/15035620.
-    // Once that is resolved, we should do the setContentOffset without the dispatch_async.
-    RetainPtr&lt;WKPDFView&gt; retainedSelf = self;
-    dispatch_async(dispatch_get_main_queue(), [retainedSelf, oldDocumentLeftFraction, oldDocumentTopFraction] {
-        CGSize contentSize = retainedSelf-&gt;_scrollView.contentSize;
-        UIEdgeInsets contentInset = retainedSelf-&gt;_scrollView.contentInset;
-        [retainedSelf-&gt;_scrollView setContentOffset:CGPointMake((oldDocumentLeftFraction * contentSize.width) - contentInset.left, (oldDocumentTopFraction * contentSize.height) - contentInset.top) animated:NO];
</del><ins>+    CGSize newContentSize = _scrollView.contentSize;
+    UIEdgeInsets contentInset = _scrollView.contentInset;
+    [_scrollView setContentOffset:CGPointMake((oldDocumentLeftFraction * newContentSize.width) - contentInset.left, (oldDocumentTopFraction * newContentSize.height) - contentInset.top) animated:NO];
</ins><span class="cx"> 
</span><del>-        [retainedSelf _revalidateViews];
-    });
</del><ins>+    [self _revalidateViews];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)scrollViewDidScroll:(UIScrollView *)scrollView
</span></span></pre></div>
<a id="branchessafari601146branchToolsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Tools/ChangeLog (198248 => 198249)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Tools/ChangeLog        2016-03-16 00:22:08 UTC (rev 198248)
+++ branches/safari-601.1.46-branch/Tools/ChangeLog        2016-03-16 00:22:12 UTC (rev 198249)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-03-15  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r194060. rdar://problem/24560757
+
+    2015-12-14  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+            Frequent crash under -[WKPDFView web_setMinimumSize:]_block_invoke
+            https://bugs.webkit.org/show_bug.cgi?id=152266
+            &lt;rdar://problem/22092676&gt;
+
+            Reviewed by Simon Fraser.
+
+            * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+            * TestWebKitAPI/Tests/WebKit2Cocoa/WKPDFViewResizeCrash.mm: Added.
+            Add a test that crashed before this change, and doesn't crash after.
+
</ins><span class="cx"> 2016-01-13  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r194950. rdar://problem/23270886
</span></span></pre></div>
<a id="branchessafari601146branchToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (198248 => 198249)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-03-16 00:22:08 UTC (rev 198248)
+++ branches/safari-601.1.46-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-03-16 00:22:12 UTC (rev 198249)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx">                 290A9BB91735F63800D71BBC /* OpenNewWindow.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 290A9BB81735F42300D71BBC /* OpenNewWindow.html */; };
</span><span class="cx">                 290F4275172A221C00939FF0 /* custom-protocol-sync-xhr.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */; };
</span><span class="cx">                 297234B7173AFAC700983601 /* CustomProtocolsInvalidScheme_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 297234B5173AFAC700983601 /* CustomProtocolsInvalidScheme_Bundle.cpp */; };
</span><ins>+                2D00065F1C1F589A0088E6A7 /* WKPDFViewResizeCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */; };
</ins><span class="cx">                 2D1FE0B01AD465C1006CD9E6 /* FixedLayoutSize.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */; };
</span><span class="cx">                 2D9A53AF1B31FA8D0074D5AA /* ShrinkToFit.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D9A53AE1B31FA8D0074D5AA /* ShrinkToFit.mm */; };
</span><span class="cx">                 2DD7D3AF178227B30026E1E3 /* lots-of-text-vertical-lr.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2DD7D3AE178227AC0026E1E3 /* lots-of-text-vertical-lr.html */; };
</span><span class="lines">@@ -494,6 +495,7 @@
</span><span class="cx">                 29AB8A9F164C735800D49BEC /* CustomProtocolsTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CustomProtocolsTest.mm; path = WebKit2ObjC/CustomProtocolsTest.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 29AB8AA2164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestBrowsingContextLoadDelegate.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 29AB8AA3164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestBrowsingContextLoadDelegate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPDFViewResizeCrash.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FixedLayoutSize.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D640B5417875DFF00BFAF99 /* ScrollPinningBehaviors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollPinningBehaviors.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D9A53AE1B31FA8D0074D5AA /* ShrinkToFit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ShrinkToFit.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -912,6 +914,7 @@
</span><span class="cx">                                 37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */,
</span><span class="cx">                                 2D9A53AE1B31FA8D0074D5AA /* ShrinkToFit.mm */,
</span><span class="cx">                                 7CC3E1FA197E234100BE6252 /* UserContentController.mm */,
</span><ins>+                                2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */,
</ins><span class="cx">                                 0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */,
</span><span class="cx">                         );
</span><span class="cx">                         name = &quot;WebKit2 Cocoa&quot;;
</span><span class="lines">@@ -1662,6 +1665,7 @@
</span><span class="cx">                                 7CCE7F0F1A411AE600447C4C /* ResizeWindowAfterCrash.cpp in Sources */,
</span><span class="cx">                                 7CCE7F101A411AE600447C4C /* ResponsivenessTimerDoesntFireEarly.cpp in Sources */,
</span><span class="cx">                                 7CCE7F111A411AE600447C4C /* RestoreSessionStateContainingFormData.cpp in Sources */,
</span><ins>+                                2D00065F1C1F589A0088E6A7 /* WKPDFViewResizeCrash.mm in Sources */,
</ins><span class="cx">                                 7CCE7F4E1A411BA400447C4C /* RetainPtr.cpp in Sources */,
</span><span class="cx">                                 7CCE7F4D1A411B9F00447C4C /* RetainPtr.mm in Sources */,
</span><span class="cx">                                 7CCE7F4F1A411BA400447C4C /* RetainPtrHashing.cpp in Sources */,
</span></span></pre></div>
<a id="branchessafari601146branchToolsTestWebKitAPITestsWebKit2CocoaWKPDFViewResizeCrashmm"></a>
<div class="addfile"><h4>Added: branches/safari-601.1.46-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKPDFViewResizeCrash.mm (0 => 198249)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKPDFViewResizeCrash.mm                                (rev 0)
+++ branches/safari-601.1.46-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKPDFViewResizeCrash.mm        2016-03-16 00:22:12 UTC (rev 198249)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+
+#import &lt;WebKit/WKNavigationDelegate.h&gt;
+#import &lt;WebKit/WKWebView.h&gt;
+#import &lt;wtf/RetainPtr.h&gt;
+#import &quot;PlatformUtilities.h&quot;
+#import &quot;Test.h&quot;
+
+#if WK_API_ENABLED
+
+static bool finishedLoading;
+static bool finishedDispatch;
+
+@interface WKPDFViewResizeNavigationDelegate : NSObject &lt;WKNavigationDelegate&gt;
+@end
+
+@implementation WKPDFViewResizeNavigationDelegate
+
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
+{
+    finishedLoading = true;
+}
+
+@end
+
+TEST(WebKit2, WKPDFViewResizeCrash)
+{
+    RetainPtr&lt;WKWebView&gt; webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+
+    RetainPtr&lt;WKPDFViewResizeNavigationDelegate&gt; delegate = adoptNS([[WKPDFViewResizeNavigationDelegate alloc] init]);
+    [webView setNavigationDelegate:delegate.get()];
+
+    NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@&quot;test&quot; withExtension:@&quot;pdf&quot; subdirectory:@&quot;TestWebKitAPI.resources&quot;]];
+    [webView loadRequest:request];
+
+    TestWebKitAPI::Util::run(&amp;finishedLoading);
+
+    [webView setFrame:NSMakeRect(0, 0, 100, 100)];
+    webView = nil;
+
+    dispatch_async(dispatch_get_main_queue(), ^{
+        finishedDispatch = true;
+    });
+
+    TestWebKitAPI::Util::run(&amp;finishedDispatch);
+}
+
+#endif
</ins></span></pre>
</div>
</div>

</body>
</html>