<!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>[203576] branches/safari-602-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/203576">203576</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2016-07-22 02:26:02 -0700 (Fri, 22 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/203541">r203541</a>. rdar://problem/27450825</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari602branchSourceWebKit2ChangeLog">branches/safari-602-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari602branchSourceWebKit2UIProcessiosWKScrollViewmm">branches/safari-602-branch/Source/WebKit2/UIProcess/ios/WKScrollView.mm</a></li>
<li><a href="#branchessafari602branchToolsChangeLog">branches/safari-602-branch/Tools/ChangeLog</a></li>
<li><a href="#branchessafari602branchToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">branches/safari-602-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari602branchToolsTestWebKitAPITestsiosWKScrollViewDelegateCrashmm">branches/safari-602-branch/Tools/TestWebKitAPI/Tests/ios/WKScrollViewDelegateCrash.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari602branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/ChangeLog (203575 => 203576)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/ChangeLog        2016-07-22 09:25:59 UTC (rev 203575)
+++ branches/safari-602-branch/Source/WebKit2/ChangeLog        2016-07-22 09:26:02 UTC (rev 203576)
</span><span class="lines">@@ -1,5 +1,37 @@
</span><span class="cx"> 2016-07-22  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r203541. rdar://problem/27450825
+
+    2016-07-21  Chelsea Pugh  &lt;cpugh@apple.com&gt;
+
+            [iOS] Apps using WKWebView will crash if they set the scroll view's delegate and don't nil it out later
+            https://bugs.webkit.org/show_bug.cgi?id=159980
+            rdar://problem/27450825
+
+            Reviewed by Dan Bernstein.
+
+            The root cause of this crash is that we are not abiding the UIScrollView API that the scroll view
+            delegate property should be weak. If setters of this delegate do not know that, since the WKWebView
+            exposes the scroll view as a UIScrollView, they may forget to nil out the delegate they set and will
+            then crash.
+
+            * UIProcess/ios/WKScrollView.mm:
+            (-[WKScrollViewDelegateForwarder methodSignatureForSelector:]): Get a RetainPtr holding the
+            external delegate and use where needed.
+            (-[WKScrollViewDelegateForwarder respondsToSelector:]): Ditto.
+            (-[WKScrollViewDelegateForwarder forwardInvocation:]): Ditto.
+            (-[WKScrollViewDelegateForwarder forwardingTargetForSelector:]): Ditto. When returning a reference
+            to the external delegate, get a retained and autoreleased reference so the caller needn't release
+            the object when done.
+            (-[WKScrollView delegate]): Ditto.
+            (-[WKScrollView _updateDelegate]): Get a RetainPtr holding the external delegate that can be
+            used throughout this method. Use the RetainPtr to get the external delegate for setting super's
+            delegate as well as creating the delegate forwarder.
+            (-[WKScrollView setDelegate:]): Get a RetainPtr holding the external delegate and use its value for
+            comparison to the object we are setting the external delegate to.
+
+2016-07-22  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
</ins><span class="cx">         Merge r203442. rdar://problem/27376446
</span><span class="cx"> 
</span><span class="cx">     2016-07-19  Brian Burg  &lt;bburg@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKit2UIProcessiosWKScrollViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/UIProcess/ios/WKScrollView.mm (203575 => 203576)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/UIProcess/ios/WKScrollView.mm        2016-07-22 09:25:59 UTC (rev 203575)
+++ branches/safari-602-branch/Source/WebKit2/UIProcess/ios/WKScrollView.mm        2016-07-22 09:26:02 UTC (rev 203576)
</span><span class="lines">@@ -29,8 +29,11 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="cx"> #import &quot;WKWebViewInternal.h&quot;
</span><ins>+#import &quot;WeakObjCPtr.h&quot;
</ins><span class="cx"> #import &lt;WebCore/CoreGraphicsSPI.h&gt;
</span><span class="cx"> 
</span><ins>+using namespace WebKit;
+
</ins><span class="cx"> @interface UIScrollView (UIScrollViewInternalHack)
</span><span class="cx"> - (CGFloat)_rubberBandOffsetForOffset:(CGFloat)newOffset maxOffset:(CGFloat)maxOffset minOffset:(CGFloat)minOffset range:(CGFloat)range outside:(BOOL *)outside;
</span><span class="cx"> @end
</span><span class="lines">@@ -43,7 +46,7 @@
</span><span class="cx"> 
</span><span class="cx"> @implementation WKScrollViewDelegateForwarder {
</span><span class="cx">     WKWebView *_internalDelegate;
</span><del>-    id &lt;UIScrollViewDelegate&gt; _externalDelegate;
</del><ins>+    WeakObjCPtr&lt;id &lt;UIScrollViewDelegate&gt;&gt; _externalDelegate;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (instancetype)initWithInternalDelegate:(WKWebView &lt;UIScrollViewDelegate&gt; *)internalDelegate externalDelegate:(id &lt;UIScrollViewDelegate&gt;)externalDelegate
</span><span class="lines">@@ -58,24 +61,26 @@
</span><span class="cx"> 
</span><span class="cx"> - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
</span><span class="cx"> {
</span><ins>+    auto externalDelegate = _externalDelegate.get();
</ins><span class="cx">     NSMethodSignature *signature = [super methodSignatureForSelector:aSelector];
</span><span class="cx">     if (!signature)
</span><span class="cx">         signature = [(NSObject *)_internalDelegate methodSignatureForSelector:aSelector];
</span><span class="cx">     if (!signature)
</span><del>-        signature = [(NSObject *)_externalDelegate methodSignatureForSelector:aSelector];
</del><ins>+        signature = [(NSObject *)externalDelegate methodSignatureForSelector:aSelector];
</ins><span class="cx">     return signature;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)respondsToSelector:(SEL)aSelector
</span><span class="cx"> {
</span><del>-    return [super respondsToSelector:aSelector] || [_internalDelegate respondsToSelector:aSelector] || [_externalDelegate respondsToSelector:aSelector];
</del><ins>+    return [super respondsToSelector:aSelector] || [_internalDelegate respondsToSelector:aSelector] || [_externalDelegate.get() respondsToSelector:aSelector];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)forwardInvocation:(NSInvocation *)anInvocation
</span><span class="cx"> {
</span><ins>+    auto externalDelegate = _externalDelegate.get();
</ins><span class="cx">     SEL aSelector = [anInvocation selector];
</span><span class="cx">     BOOL internalDelegateWillRespond = [_internalDelegate respondsToSelector:aSelector];
</span><del>-    BOOL externalDelegateWillRespond = [_externalDelegate respondsToSelector:aSelector];
</del><ins>+    BOOL externalDelegateWillRespond = [externalDelegate respondsToSelector:aSelector];
</ins><span class="cx"> 
</span><span class="cx">     if (internalDelegateWillRespond &amp;&amp; externalDelegateWillRespond)
</span><span class="cx">         [_internalDelegate _willInvokeUIScrollViewDelegateCallback];
</span><span class="lines">@@ -83,7 +88,7 @@
</span><span class="cx">     if (internalDelegateWillRespond)
</span><span class="cx">         [anInvocation invokeWithTarget:_internalDelegate];
</span><span class="cx">     if (externalDelegateWillRespond)
</span><del>-        [anInvocation invokeWithTarget:_externalDelegate];
</del><ins>+        [anInvocation invokeWithTarget:externalDelegate.get()];
</ins><span class="cx"> 
</span><span class="cx">     if (internalDelegateWillRespond &amp;&amp; externalDelegateWillRespond)
</span><span class="cx">         [_internalDelegate _didInvokeUIScrollViewDelegateCallback];
</span><span class="lines">@@ -95,12 +100,12 @@
</span><span class="cx"> - (id)forwardingTargetForSelector:(SEL)aSelector
</span><span class="cx"> {
</span><span class="cx">     BOOL internalDelegateWillRespond = [_internalDelegate respondsToSelector:aSelector];
</span><del>-    BOOL externalDelegateWillRespond = [_externalDelegate respondsToSelector:aSelector];
</del><ins>+    BOOL externalDelegateWillRespond = [_externalDelegate.get() respondsToSelector:aSelector];
</ins><span class="cx"> 
</span><span class="cx">     if (internalDelegateWillRespond &amp;&amp; !externalDelegateWillRespond)
</span><span class="cx">         return _internalDelegate;
</span><span class="cx">     if (externalDelegateWillRespond &amp;&amp; !internalDelegateWillRespond)
</span><del>-        return _externalDelegate;
</del><ins>+        return _externalDelegate.getAutoreleased();
</ins><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -107,7 +112,7 @@
</span><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @implementation WKScrollView {
</span><del>-    id &lt;UIScrollViewDelegate&gt; _externalDelegate;
</del><ins>+    WeakObjCPtr&lt;id &lt;UIScrollViewDelegate&gt;&gt; _externalDelegate;
</ins><span class="cx">     WKScrollViewDelegateForwarder *_delegateForwarder;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -132,7 +137,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)setDelegate:(id &lt;UIScrollViewDelegate&gt;)delegate
</span><span class="cx"> {
</span><del>-    if (_externalDelegate == delegate)
</del><ins>+    if (_externalDelegate.get().get() == delegate)
</ins><span class="cx">         return;
</span><span class="cx">     _externalDelegate = delegate;
</span><span class="cx">     [self _updateDelegate];
</span><span class="lines">@@ -140,7 +145,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (id &lt;UIScrollViewDelegate&gt;)delegate
</span><span class="cx"> {
</span><del>-    return _externalDelegate;
</del><ins>+    return _externalDelegate.getAutoreleased();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_updateDelegate
</span><span class="lines">@@ -147,12 +152,13 @@
</span><span class="cx"> {
</span><span class="cx">     WKScrollViewDelegateForwarder *oldForwarder = _delegateForwarder;
</span><span class="cx">     _delegateForwarder = nil;
</span><del>-    if (!_externalDelegate)
</del><ins>+    auto externalDelegate = _externalDelegate.get();
+    if (!externalDelegate)
</ins><span class="cx">         [super setDelegate:_internalDelegate];
</span><span class="cx">     else if (!_internalDelegate)
</span><del>-        [super setDelegate:_externalDelegate];
</del><ins>+        [super setDelegate:externalDelegate.get()];
</ins><span class="cx">     else {
</span><del>-        _delegateForwarder = [[WKScrollViewDelegateForwarder alloc] initWithInternalDelegate:_internalDelegate externalDelegate:_externalDelegate];
</del><ins>+        _delegateForwarder = [[WKScrollViewDelegateForwarder alloc] initWithInternalDelegate:_internalDelegate externalDelegate:externalDelegate.get()];
</ins><span class="cx">         [super setDelegate:_delegateForwarder];
</span><span class="cx">     }
</span><span class="cx">     [oldForwarder release];
</span></span></pre></div>
<a id="branchessafari602branchToolsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Tools/ChangeLog (203575 => 203576)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Tools/ChangeLog        2016-07-22 09:25:59 UTC (rev 203575)
+++ branches/safari-602-branch/Tools/ChangeLog        2016-07-22 09:26:02 UTC (rev 203576)
</span><span class="lines">@@ -1,5 +1,25 @@
</span><span class="cx"> 2016-07-22  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r203541. rdar://problem/27450825
+
+    2016-07-21  Chelsea Pugh  &lt;cpugh@apple.com&gt;
+
+            [iOS] Apps using WKWebView will crash if they set the scroll view's delegate and don't nil it out later
+            https://bugs.webkit.org/show_bug.cgi?id=159980
+            rdar://problem/27450825
+
+            Reviewed by Dan Bernstein.
+
+            * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+            * TestWebKitAPI/Tests/ios/WKScrollViewDelegateCrash.mm: Added.
+            (-[TestDelegateForScrollView dealloc]): Update delegateIsDeallocated to true so that we can tell
+            when our delegate has hit -dealloc.
+            (TestWebKitAPI::TEST): Ensure that after an object has been set as the scroll view's delegate,
+            and has then been deallocated, that the scroll view's delegate is nil and the deallocated delegate
+            will not be messaged.
+
+2016-07-22  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
</ins><span class="cx">         Merge r203478. rdar://problem/27411085
</span><span class="cx"> 
</span><span class="cx">     2016-07-20  Jeremy Jones  &lt;jeremyj@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari602branchToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (203575 => 203576)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-07-22 09:25:59 UTC (rev 203575)
+++ branches/safari-602-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-07-22 09:26:02 UTC (rev 203576)
</span><span class="lines">@@ -109,6 +109,7 @@
</span><span class="cx">                 5714ECBD1CA8C22A00051AC8 /* DownloadRequestOriginalURL2.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5714ECBC1CA8C21800051AC8 /* DownloadRequestOriginalURL2.html */; };
</span><span class="cx">                 57901FB11CAF142D00ED64F9 /* LoadInvalidURLRequest.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 57901FB01CAF141C00ED64F9 /* LoadInvalidURLRequest.html */; };
</span><span class="cx">                 57F56A5C1C7F8CC100F31D7E /* IsNavigationActionTrusted.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 57F56A5B1C7F8A4000F31D7E /* IsNavigationActionTrusted.html */; };
</span><ins>+                5E4B1D2E1D404C6100053621 /* WKScrollViewDelegateCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E4B1D2C1D404C6100053621 /* WKScrollViewDelegateCrash.mm */; };
</ins><span class="cx">                 764322D71B61CCC30024F801 /* WordBoundaryTypingAttributes.mm in Sources */ = {isa = PBXBuildFile; fileRef = 764322D51B61CCA40024F801 /* WordBoundaryTypingAttributes.mm */; };
</span><span class="cx">                 7673499D1930C5BB00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7673499A1930182E00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp */; };
</span><span class="cx">                 76E182DD1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */; };
</span><span class="lines">@@ -789,6 +790,7 @@
</span><span class="cx">                 57F10D921C7E7B3800ECDF30 /* IsNavigationActionTrusted.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IsNavigationActionTrusted.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 57F56A5B1C7F8A4000F31D7E /* IsNavigationActionTrusted.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = IsNavigationActionTrusted.html; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5C5E633D1D0B67940085A025 /* UniqueRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UniqueRef.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                5E4B1D2C1D404C6100053621 /* WKScrollViewDelegateCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKScrollViewDelegateCrash.mm; path = ../ios/WKScrollViewDelegateCrash.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7560917719259C59009EF06E /* MemoryCacheAddImageToCacheIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCacheAddImageToCacheIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 75F3133F18C171B70041CAEC /* EphemeralSessionPushStateNoHistoryCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EphemeralSessionPushStateNoHistoryCallback.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 764322D51B61CCA40024F801 /* WordBoundaryTypingAttributes.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WordBoundaryTypingAttributes.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -1233,6 +1235,7 @@
</span><span class="cx">                                 7CCB99201D3B41F6003922F6 /* UserInitiatedActionInNavigationAction.mm */,
</span><span class="cx">                                 93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */,
</span><span class="cx">                                 2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */,
</span><ins>+                                5E4B1D2C1D404C6100053621 /* WKScrollViewDelegateCrash.mm */,
</ins><span class="cx">                                 7C417F311D19E14800B8EF53 /* WKWebViewDefaultNavigationDelegate.mm */,
</span><span class="cx">                                 0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */,
</span><span class="cx">                                 9984FACA1CFFAEEE008D198C /* WKWebViewTextInput.mm */,
</span><span class="lines">@@ -2116,6 +2119,7 @@
</span><span class="cx">                                 7CEFA9661AC0B9E200B910FD /* _WKUserContentExtensionStore.mm in Sources */,
</span><span class="cx">                                 7CCE7EE01A411A9A00447C4C /* EditorCommands.mm in Sources */,
</span><span class="cx">                                 7CCE7EBF1A411A7E00447C4C /* ElementAtPointInWebFrame.mm in Sources */,
</span><ins>+                                5E4B1D2E1D404C6100053621 /* WKScrollViewDelegateCrash.mm in Sources */,
</ins><span class="cx">                                 7CCE7EEF1A411AE600447C4C /* EphemeralSessionPushStateNoHistoryCallback.cpp in Sources */,
</span><span class="cx">                                 7CCE7EF01A411AE600447C4C /* EvaluateJavaScript.cpp in Sources */,
</span><span class="cx">                                 7CCE7EF11A411AE600447C4C /* FailedLoad.cpp in Sources */,
</span></span></pre></div>
<a id="branchessafari602branchToolsTestWebKitAPITestsiosWKScrollViewDelegateCrashmm"></a>
<div class="addfile"><h4>Added: branches/safari-602-branch/Tools/TestWebKitAPI/Tests/ios/WKScrollViewDelegateCrash.mm (0 => 203576)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Tools/TestWebKitAPI/Tests/ios/WKScrollViewDelegateCrash.mm                                (rev 0)
+++ branches/safari-602-branch/Tools/TestWebKitAPI/Tests/ios/WKScrollViewDelegateCrash.mm        2016-07-22 09:26:02 UTC (rev 203576)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+/*
+ * Copyright (C) 2016 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.
+ */
+
+#import &quot;config.h&quot;
+
+#if PLATFORM(IOS)
+
+#import &quot;PlatformUtilities.h&quot;
+#import &quot;Test.h&quot;
+#import &lt;WebKit/WKWebView.h&gt;
+
+static bool delegateIsDeallocated;
+
+@interface TestDelegateForScrollView : NSObject &lt;UIScrollViewDelegate&gt;
+
+@end
+
+@implementation TestDelegateForScrollView
+
+- (void)dealloc
+{
+    delegateIsDeallocated = true;
+    [super dealloc];
+}
+
+@end
+
+namespace TestWebKitAPI {
+
+TEST(WKWebView, WKScrollViewDelegateCrash)
+{
+    WKWebView *webView = [[WKWebView alloc] init];
+    TestDelegateForScrollView *delegateForScrollView = [[TestDelegateForScrollView alloc] init];
+    @autoreleasepool {
+        webView.scrollView.delegate = delegateForScrollView;
+    }
+    delegateIsDeallocated = false;
+    [delegateForScrollView release];
+    TestWebKitAPI::Util::run(&amp;delegateIsDeallocated);
+
+    EXPECT_NULL(webView.scrollView.delegate);
+}
+
+}
+
+#endif
</ins></span></pre>
</div>
</div>

</body>
</html>