<!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>[168241] trunk/Source</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/168241">168241</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-05-03 23:26:39 -0700 (Sat, 03 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/168232">r168232</a>.
https://bugs.webkit.org/show_bug.cgi?id=132543

broke ~15 tests on WK2 debug (Requested by kling on #webkit).

Reverted changeset:

&quot;Shortcircuit shouldUseCredentialStorage callback&quot;
https://bugs.webkit.org/show_bug.cgi?id=132308
http://trac.webkit.org/changeset/168232</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandlecpp">trunk/Source/WebCore/platform/network/ResourceHandle.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandleh">trunk/Source/WebCore/platform/network/ResourceHandle.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandleClientcpp">trunk/Source/WebCore/platform/network/ResourceHandleClient.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandleClienth">trunk/Source/WebCore/platform/network/ResourceHandleClient.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFNetcpp">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateh">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateWithOperationQueuecpp">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateWithOperationQueueh">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfSynchronousResourceHandleCFURLConnectionDelegatecpp">trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfSynchronousResourceHandleCFURLConnectionDelegateh">trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkmacResourceHandleMacmm">trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkmacWebCoreResourceHandleAsOperationQueueDelegateh">trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkmacWebCoreResourceHandleAsOperationQueueDelegatemm">trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupResourceHandleSoupcpp">trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkResourceLoadercpp">trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkResourceLoaderh">trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/ChangeLog        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-05-03  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        Unreviewed, rolling out r168232.
+        https://bugs.webkit.org/show_bug.cgi?id=132543
+
+        broke ~15 tests on WK2 debug (Requested by kling on #webkit).
+
+        Reverted changeset:
+
+        &quot;Shortcircuit shouldUseCredentialStorage callback&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=132308
+        http://trac.webkit.org/changeset/168232
+
</ins><span class="cx"> 2014-05-03  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         RenderSVGResourcePattern should deal in RenderElement&amp;.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -373,6 +373,7 @@
</span><span class="cx"> __ZN7WebCore14ResourceHandle25loadResourceSynchronouslyEPNS_17NetworkingContextERKNS_15ResourceRequestENS_17StoredCredentialsERNS_13ResourceErrorERNS_16ResourceResponseERN3WTF6VectorIcLm0ENSB_15CrashOnOverflowEEE
</span><span class="cx"> __ZN7WebCore14ResourceHandle26continueDidReceiveResponseEv
</span><span class="cx"> __ZN7WebCore14ResourceHandle26synchronousLoadRunLoopModeEv
</span><ins>+__ZN7WebCore14ResourceHandle34continueShouldUseCredentialStorageEb
</ins><span class="cx"> __ZN7WebCore14ResourceHandle45continueCanAuthenticateAgainstProtectionSpaceEb
</span><span class="cx"> __ZN7WebCore14ResourceHandle6createEPNS_17NetworkingContextERKNS_15ResourceRequestEPNS_20ResourceHandleClientEbb
</span><span class="cx"> __ZN7WebCore14ResourceLoader14cancelledErrorEv
</span><span class="lines">@@ -836,6 +837,7 @@
</span><span class="cx"> __ZN7WebCore20RenderEmbeddedObject44setPluginUnavailabilityReasonWithDescriptionENS0_26PluginUnavailabilityReasonERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore20ResourceHandleClient16didReceiveBufferEPNS_14ResourceHandleEN3WTF10PassRefPtrINS_12SharedBufferEEEi
</span><span class="cx"> __ZN7WebCore20ResourceHandleClient20willSendRequestAsyncEPNS_14ResourceHandleERKNS_15ResourceRequestERKNS_16ResourceResponseE
</span><ins>+__ZN7WebCore20ResourceHandleClient31shouldUseCredentialStorageAsyncEPNS_14ResourceHandleE
</ins><span class="cx"> __ZN7WebCore20ResourceHandleClient42canAuthenticateAgainstProtectionSpaceAsyncEPNS_14ResourceHandleERKNS_15ProtectionSpaceE
</span><span class="cx"> __ZN7WebCore20ResourceHandleClientC2Ev
</span><span class="cx"> __ZN7WebCore20ResourceHandleClientD2Ev
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandle.cpp (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceHandle.cpp        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.cpp        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -164,6 +164,11 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceHandle::continueShouldUseCredentialStorage(bool)
+{
+    notImplemented();
+}
+
</ins><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx"> void ResourceHandle::continueCanAuthenticateAgainstProtectionSpace(bool)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandle.h (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceHandle.h        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.h        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -130,7 +130,6 @@
</span><span class="cx"> #if PLATFORM(COCOA) &amp;&amp; !USE(CFNETWORK)
</span><span class="cx">     void didCancelAuthenticationChallenge(const AuthenticationChallenge&amp;);
</span><span class="cx">     NSURLConnection *connection() const;
</span><del>-    id makeDelegate(bool);
</del><span class="cx">     id delegate();
</span><span class="cx">     void releaseDelegate();
</span><span class="cx"> #endif
</span><span class="lines">@@ -209,6 +208,9 @@
</span><span class="cx">     // Called in response to ResourceHandleClient::didReceiveResponseAsync().
</span><span class="cx">     void continueDidReceiveResponse();
</span><span class="cx"> 
</span><ins>+    // Called in response to ResourceHandleClient::shouldUseCredentialStorageAsync().
+    void continueShouldUseCredentialStorage(bool);
+
</ins><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx">     // Called in response to ResourceHandleClient::canAuthenticateAgainstProtectionSpaceAsync().
</span><span class="cx">     void continueCanAuthenticateAgainstProtectionSpace(bool);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandleClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandleClient.cpp (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceHandleClient.cpp        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/platform/network/ResourceHandleClient.cpp        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -49,6 +49,11 @@
</span><span class="cx">     handle-&gt;continueDidReceiveResponse();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceHandleClient::shouldUseCredentialStorageAsync(ResourceHandle* handle)
+{
+    handle-&gt;continueShouldUseCredentialStorage(false);
+}
+
</ins><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx"> void ResourceHandleClient::canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle* handle, const ProtectionSpace&amp;)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandleClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandleClient.h (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceHandleClient.h        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/platform/network/ResourceHandleClient.h        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -87,6 +87,8 @@
</span><span class="cx">         // Client will call ResourceHandle::continueDidReceiveResponse() when ready.
</span><span class="cx">         virtual void didReceiveResponseAsync(ResourceHandle*, const ResourceResponse&amp;);
</span><span class="cx"> 
</span><ins>+        // Client will pass an updated request using ResourceHandle::continueShouldUseCredentialStorage() when ready.
+        virtual void shouldUseCredentialStorageAsync(ResourceHandle*);
</ins><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx">         // Client will pass an updated request using ResourceHandle::continueCanAuthenticateAgainstProtectionSpace() when ready.
</span><span class="cx">         virtual void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -228,8 +228,6 @@
</span><span class="cx">     d-&gt;m_connectionDelegate-&gt;setupRequest(request.get());
</span><span class="cx"> 
</span><span class="cx">     CFURLConnectionClient_V6 client = d-&gt;m_connectionDelegate-&gt;makeConnectionClient();
</span><del>-    if (shouldUseCredentialStorage)
-        client.shouldUseCredentialStorage = 0;
</del><span class="cx"> 
</span><span class="cx">     d-&gt;m_connection = adoptCF(CFURLConnectionCreateWithProperties(0, request.get(), reinterpret_cast&lt;CFURLConnectionClient*&gt;(&amp;client), propertiesDictionary.get()));
</span><span class="cx"> }
</span><span class="lines">@@ -311,8 +309,10 @@
</span><span class="cx"> {
</span><span class="cx">     LOG(Network, &quot;CFNet - shouldUseCredentialStorage()&quot;);
</span><span class="cx">     if (ResourceHandleClient* client = this-&gt;client()) {
</span><del>-        ASSERT(!client-&gt;usesAsyncCallbacks());
-        return client-&gt;shouldUseCredentialStorage(this);
</del><ins>+        if (client-&gt;usesAsyncCallbacks())
+            client-&gt;shouldUseCredentialStorageAsync(this);
+        else
+            return client-&gt;shouldUseCredentialStorage(this);
</ins><span class="cx">     }
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="lines">@@ -588,6 +588,11 @@
</span><span class="cx">     d-&gt;m_connectionDelegate-&gt;continueDidReceiveResponse();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceHandle::continueShouldUseCredentialStorage(bool useCredentialStorage)
+{
+    d-&gt;m_connectionDelegate-&gt;continueShouldUseCredentialStorage(useCredentialStorage);
+}
+
</ins><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx"> void ResourceHandle::continueCanAuthenticateAgainstProtectionSpace(bool canAuthenticate)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.h (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.h        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.h        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void continueWillSendRequest(CFURLRequestRef) = 0;
</span><span class="cx">     virtual void continueDidReceiveResponse() = 0;
</span><ins>+    virtual void continueShouldUseCredentialStorage(bool) = 0;
</ins><span class="cx">     virtual void continueWillCacheResponse(CFCachedURLResponseRef) = 0;
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx">     virtual void continueCanAuthenticateAgainstProtectionSpace(bool) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateWithOperationQueuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -229,7 +229,20 @@
</span><span class="cx"> 
</span><span class="cx"> Boolean ResourceHandleCFURLConnectionDelegateWithOperationQueue::shouldUseCredentialStorage()
</span><span class="cx"> {
</span><del>-    return NO;
</del><ins>+    RefPtr&lt;ResourceHandleCFURLConnectionDelegateWithOperationQueue&gt; protector(this);
+
+    dispatch_async(dispatch_get_main_queue(), ^{
+        if (!protector-&gt;hasHandle()) {
+            continueShouldUseCredentialStorage(false);
+            return;
+        }
+
+        LOG(Network, &quot;CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::shouldUseCredentialStorage(handle=%p) (%s)&quot;, m_handle, m_handle-&gt;firstRequest().url().string().utf8().data());
+
+        m_handle-&gt;shouldUseCredentialStorage();
+    });
+    dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER);
+    return m_boolResult;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="lines">@@ -287,6 +300,12 @@
</span><span class="cx">     dispatch_semaphore_signal(m_semaphore);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueShouldUseCredentialStorage(bool shouldUseCredentialStorage)
+{
+    m_boolResult = shouldUseCredentialStorage;
+    dispatch_semaphore_signal(m_semaphore);
+}
+
</ins><span class="cx"> void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillCacheResponse(CFCachedURLResponseRef response)
</span><span class="cx"> {
</span><span class="cx">     m_cachedResponseResult = response;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateWithOperationQueueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -64,6 +64,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void continueWillSendRequest(CFURLRequestRef) override;
</span><span class="cx">     virtual void continueDidReceiveResponse() override;
</span><ins>+    virtual void continueShouldUseCredentialStorage(bool) override;
</ins><span class="cx">     virtual void continueWillCacheResponse(CFCachedURLResponseRef) override;
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx">     virtual void continueCanAuthenticateAgainstProtectionSpace(bool) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfSynchronousResourceHandleCFURLConnectionDelegatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -282,6 +282,11 @@
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void SynchronousResourceHandleCFURLConnectionDelegate::continueShouldUseCredentialStorage(bool)
+{
+    ASSERT_NOT_REACHED();
+}
+
</ins><span class="cx"> void SynchronousResourceHandleCFURLConnectionDelegate::continueWillCacheResponse(CFCachedURLResponseRef)
</span><span class="cx"> {
</span><span class="cx">     ASSERT_NOT_REACHED();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfSynchronousResourceHandleCFURLConnectionDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void continueWillSendRequest(CFURLRequestRef) override;
</span><span class="cx">     virtual void continueDidReceiveResponse() override;
</span><ins>+    virtual void continueShouldUseCredentialStorage(bool) override;
</ins><span class="cx">     virtual void continueWillCacheResponse(CFCachedURLResponseRef) override;
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx">     virtual void continueCanAuthenticateAgainstProtectionSpace(bool) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacResourceHandleMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -223,7 +223,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx">     createNSURLConnection(
</span><del>-        ResourceHandle::makeDelegate(shouldUseCredentialStorage),
</del><ins>+        ResourceHandle::delegate(),
</ins><span class="cx">         shouldUseCredentialStorage,
</span><span class="cx">         d-&gt;m_shouldContentSniff || d-&gt;m_context-&gt;localFileContentSniffingEnabled(),
</span><span class="cx">         SchedulingBehavior::Asynchronous);
</span><span class="lines">@@ -319,29 +319,15 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-id ResourceHandle::makeDelegate(bool shouldUseCredentialStorage)
-{
-    ASSERT(!d-&gt;m_delegate);
-
-    id &lt;NSURLConnectionDelegate&gt; delegate;
-    if (client() &amp;&amp; client()-&gt;usesAsyncCallbacks()) {
-        if (shouldUseCredentialStorage)
-            delegate = [[WebCoreResourceHandleAsOperationQueueDelegate alloc] initWithHandle:this];
-        else
-            delegate = [[WebCoreResourceHandleWithCredentialStorageAsOperationQueueDelegate alloc] initWithHandle:this];
-
-    } else
-        delegate = [[WebCoreResourceHandleAsDelegate alloc] initWithHandle:this];
-
-    d-&gt;m_delegate = delegate;
-    [delegate release];
-
-    return d-&gt;m_delegate.get();
-}
-
</del><span class="cx"> id ResourceHandle::delegate()
</span><span class="cx"> {
</span><del>-    ASSERT(d-&gt;m_delegate);
</del><ins>+    if (!d-&gt;m_delegate) {
+        id &lt;NSURLConnectionDelegate&gt; delegate = (client() &amp;&amp; client()-&gt;usesAsyncCallbacks()) ?
+            [[WebCoreResourceHandleAsOperationQueueDelegate alloc] initWithHandle:this]
+          : [[WebCoreResourceHandleAsDelegate alloc] initWithHandle:this];
+        d-&gt;m_delegate = delegate;
+        [delegate release];
+    }
</ins><span class="cx">     return d-&gt;m_delegate.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -387,10 +373,9 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(IOS)
</span><del>-    bool shouldUseCredentialStorage = storedCredentials == AllowStoredCredentials;
</del><span class="cx">     handle-&gt;createNSURLConnection(
</span><del>-        handle-&gt;makeDelegate(shouldUseCredentialStorage),
-        shouldUseCredentialStorage,
</del><ins>+        handle-&gt;delegate(),
+        storedCredentials == AllowStoredCredentials,
</ins><span class="cx">         handle-&gt;shouldContentSniff() || context-&gt;localFileContentSniffingEnabled(),
</span><span class="cx">         SchedulingBehavior::Synchronous);
</span><span class="cx"> #else
</span><span class="lines">@@ -519,10 +504,24 @@
</span><span class="cx"> 
</span><span class="cx"> bool ResourceHandle::shouldUseCredentialStorage()
</span><span class="cx"> {
</span><del>-    ASSERT(!client()-&gt;usesAsyncCallbacks());
-    return client() &amp;&amp; client()-&gt;shouldUseCredentialStorage(this);
</del><ins>+    if (client()-&gt;usesAsyncCallbacks()) {
+        if (client())
+            client()-&gt;shouldUseCredentialStorageAsync(this);
+        else
+            continueShouldUseCredentialStorage(false);
+        return false; // Ignored by caller.
+    } else
+        return client() &amp;&amp; client()-&gt;shouldUseCredentialStorage(this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceHandle::continueShouldUseCredentialStorage(bool useCredentialStorage)
+{
+    ASSERT(client());
+    ASSERT(client()-&gt;usesAsyncCallbacks());
+
+    [(id)delegate() continueShouldUseCredentialStorage:useCredentialStorage];
+}
+
</ins><span class="cx"> void ResourceHandle::didReceiveAuthenticationChallenge(const AuthenticationChallenge&amp; challenge)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!d-&gt;m_currentMacChallenge);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacWebCoreResourceHandleAsOperationQueueDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -49,15 +49,12 @@
</span><span class="cx"> - (void)detachHandle;
</span><span class="cx"> - (void)continueWillSendRequest:(NSURLRequest *)newRequest;
</span><span class="cx"> - (void)continueDidReceiveResponse;
</span><ins>+- (void)continueShouldUseCredentialStorage:(BOOL)useCredentialStorage;
</ins><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx"> - (void)continueCanAuthenticateAgainstProtectionSpace:(BOOL)canAuthenticate;
</span><span class="cx"> #endif
</span><span class="cx"> - (void)continueWillCacheResponse:(NSCachedURLResponse *)response;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><del>-@interface WebCoreResourceHandleWithCredentialStorageAsOperationQueueDelegate : WebCoreResourceHandleAsOperationQueueDelegate
-
-@end
-
</del><span class="cx"> #endif // !USE(CFNETWORK)
</span><span class="cx"> #endif // WebCoreResourceHandleAsOperationQueueDelegate_h
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacWebCoreResourceHandleAsOperationQueueDelegatemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -86,6 +86,12 @@
</span><span class="cx">     dispatch_semaphore_signal(m_semaphore);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)continueShouldUseCredentialStorage:(BOOL)useCredentialStorage
+{
+    m_boolResult = useCredentialStorage;
+    dispatch_semaphore_signal(m_semaphore);
+}
+
</ins><span class="cx"> - (void)continueCanAuthenticateAgainstProtectionSpace:(BOOL)canAuthenticate
</span><span class="cx"> {
</span><span class="cx">     m_boolResult = canAuthenticate;
</span><span class="lines">@@ -134,6 +140,28 @@
</span><span class="cx">     return [m_requestResult.leakRef() autorelease];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection
+{
+    ASSERT(!isMainThread());
+    UNUSED_PARAM(connection);
+
+    LOG(Network, &quot;Handle %p delegate connectionShouldUseCredentialStorage:%p&quot;, m_handle, connection);
+
+    RetainPtr&lt;id&gt; protector(self);
+
+    dispatch_async(dispatch_get_main_queue(), ^{
+        if (!m_handle) {
+            m_boolResult = NO;
+            dispatch_semaphore_signal(m_semaphore);
+            return;
+        }
+        m_handle-&gt;shouldUseCredentialStorage();
+    });
+
+    dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER);
+    return m_boolResult;
+}
+
</ins><span class="cx"> - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!isMainThread());
</span><span class="lines">@@ -333,16 +361,5 @@
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span><del>-@implementation WebCoreResourceHandleWithCredentialStorageAsOperationQueueDelegate
-
-- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection
-{
-    ASSERT(!isMainThread());
-    UNUSED_PARAM(connection);
-    return NO;
-}
-
-@end
-
</del><span class="cx"> #endif // !USE(CFNETWORK)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupResourceHandleSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -1379,6 +1379,13 @@
</span><span class="cx">     continueAfterDidReceiveResponse(this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceHandle::continueShouldUseCredentialStorage(bool)
+{
+    ASSERT(client());
+    ASSERT(client()-&gt;usesAsyncCallbacks());
+    // FIXME: Implement this method if needed: https://bugs.webkit.org/show_bug.cgi?id=126114.
+}
+
</ins><span class="cx"> static gboolean requestTimeoutCallback(gpointer data)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;ResourceHandle&gt; handle = static_cast&lt;ResourceHandle*&gt;(data);
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebKit2/ChangeLog        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-05-03  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        Unreviewed, rolling out r168232.
+        https://bugs.webkit.org/show_bug.cgi?id=132543
+
+        broke ~15 tests on WK2 debug (Requested by kling on #webkit).
+
+        Reverted changeset:
+
+        &quot;Shortcircuit shouldUseCredentialStorage callback&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=132308
+        http://trac.webkit.org/changeset/168232
+
</ins><span class="cx"> 2014-05-03  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] REGRESSION (WebKit2): Page isn't clipped properly during back/forward swipe
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -317,6 +317,13 @@
</span><span class="cx">     return m_allowStoredCredentials == AllowStoredCredentials;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void NetworkResourceLoader::shouldUseCredentialStorageAsync(ResourceHandle* handle)
+{
+    ASSERT_UNUSED(handle, handle == m_handle);
+
+    handle-&gt;continueShouldUseCredentialStorage(shouldUseCredentialStorage(handle));
+}
+
</ins><span class="cx"> void NetworkResourceLoader::didReceiveAuthenticationChallenge(ResourceHandle* handle, const AuthenticationChallenge&amp; challenge)
</span><span class="cx"> {
</span><span class="cx">     ASSERT_UNUSED(handle, handle == m_handle);
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h (168240 => 168241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h        2014-05-04 04:22:42 UTC (rev 168240)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h        2014-05-04 06:26:39 UTC (rev 168241)
</span><span class="lines">@@ -94,6 +94,7 @@
</span><span class="cx">     virtual void wasBlocked(WebCore::ResourceHandle*) override;
</span><span class="cx">     virtual void cannotShowURL(WebCore::ResourceHandle*) override;
</span><span class="cx">     virtual bool shouldUseCredentialStorage(WebCore::ResourceHandle*) override;
</span><ins>+    virtual void shouldUseCredentialStorageAsync(WebCore::ResourceHandle*) override;
</ins><span class="cx">     virtual void didReceiveAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&amp;) override;
</span><span class="cx">     virtual void didCancelAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&amp;) override;
</span><span class="cx">     virtual void receivedCancellation(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&amp;) override;
</span></span></pre>
</div>
</div>

</body>
</html>