<!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>[169782] 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/169782">169782</a></dd>
<dt>Author</dt> <dd>mitz@apple.com</dd>
<dt>Date</dt> <dd>2014-06-10 17:01:18 -0700 (Tue, 10 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>
Source/WebCore: WebCore part of [Cocoa] Handling authentication challenges should not require multiple delegate methods
https://bugs.webkit.org/show_bug.cgi?id=133697

Reviewed by Anders Carlsson.

* platform/network/AuthenticationClient.h: Declared new virtual member functions for
requesting default handling of a challenge and rejecting a challenge.
* platform/network/ResourceHandle.h: Override new AuthenticationClient functions.
* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandle::receivedRequestToPerformDefaultHandling): Added. Calls
CFURLConnectionPerformDefaultHandlingForChallenge.
(WebCore::ResourceHandle::receivedChallengeRejection): Added. Calls
CFURLConnectionRejectChallenge.
* platform/network/cf/SocketStreamHandle.h: Override new AuthenticationClient functions.
* platform/network/cf/SocketStreamHandleCFNet.cpp:
(WebCore::SocketStreamHandle::receivedRequestToPerformDefaultHandling): Added empty
override.
(WebCore::SocketStreamHandle::receivedChallengeRejection): Ditto.

Source/WebKit2: WebKit2 part of [Cocoa] Handling authentication challenges should not require multiple delegate methods
https://bugs.webkit.org/show_bug.cgi?id=133697

Reviewed by Anders Carlsson.

* Shared/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::performDefaultHandling): Added. Calls the new
AuthenticationClient function receivedRequestToPerformDefaultHandling.
(WebKit::AuthenticationManager::rejectProtectionSpaceAndContinue): Added. Calls the new
AuthenticationClient function receivedChallengeRejection.
* Shared/Authentication/AuthenticationManager.h:
* Shared/Authentication/AuthenticationManager.messages.in: Added new messages
PerformDefaultHandling and RejectProtectionSpaceAndContinue.

* Shared/Downloads/DownloadAuthenticationClient.h: Override new AuthenticationClient member
functions.

* Shared/Downloads/ios/DownloadIOS.mm:
(WebKit::Download::receivedRequestToPerformDefaultHandling): Added empty implementation.
(WebKit::Download::receivedChallengeRejection): Ditto.

* Shared/Downloads/mac/DownloadMac.mm:
(WebKit::Download::receivedRequestToPerformDefaultHandling): Added. Forwards to the sender.
(WebKit::Download::receivedChallengeRejection): Ditto.

* UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:
(checkChallenge): Factored out a bit of code into this helper function.
(-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]): Use new helper.
(-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
Ditto.
(-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]): Ditto.
(-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]):
Implemented this optional NSURLAuthenticationChallengeSender protocol method by forwarding
to the decision listener.
(-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]):
Ditto.

* UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Declared new delegate method.

* UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
(WebKit::AuthenticationChallengeProxy::performDefaultHandling): Added. Sends a message to
the authentication manager.
(WebKit::AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue): Ditto.
* UIProcess/Authentication/AuthenticationChallengeProxy.h:

* UIProcess/Authentication/AuthenticationDecisionListener.cpp:
(WebKit::AuthenticationDecisionListener::performDefaultHandling): Added. Forwards to the
authentication challenge proxy.
(WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue): Ditto.
* UIProcess/Authentication/AuthenticationDecisionListener.h:

* UIProcess/Cocoa/NavigationState.h: Added flag in m_navigationDelegateMethods struct.
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::setNavigationDelegate): Initialize
webViewWillSendRequestForAuthenticationChallenge flag in the delegate methods struct.
(WebKit::NavigationState::LoaderClient::canAuthenticateAgainstProtectionSpaceInFrame): If
the delegate implements -_webView:willSendRequestForAuthenticationChallenge:, return true
here; the delegate will respond with -rejectProtectionSpaceAndContinueWithChallenge: if
it cannot authenticate.
(WebKit::NavigationState::LoaderClient::didReceiveAuthenticationChallengeInFrame): If the
delegate implements -_webView:willSendRequestForAuthenticationChallenge:, send that message.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkAuthenticationClienth">trunk/Source/WebCore/platform/network/AuthenticationClient.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandleh">trunk/Source/WebCore/platform/network/ResourceHandle.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFNetcpp">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfSocketStreamHandleh">trunk/Source/WebCore/platform/network/cf/SocketStreamHandle.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfSocketStreamHandleCFNetcpp">trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcurlResourceHandleCurlcpp">trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcurlSocketStreamHandleh">trunk/Source/WebCore/platform/network/curl/SocketStreamHandle.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcurlSocketStreamHandleCurlcpp">trunk/Source/WebCore/platform/network/curl/SocketStreamHandleCurl.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkmacResourceHandleMacmm">trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupResourceHandleSoupcpp">trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupSocketStreamHandleh">trunk/Source/WebCore/platform/network/soup/SocketStreamHandle.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupSocketStreamHandleSoupcpp">trunk/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkwinSocketStreamHandleh">trunk/Source/WebCore/platform/network/win/SocketStreamHandle.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkwinSocketStreamHandleWincpp">trunk/Source/WebCore/platform/network/win/SocketStreamHandleWin.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedAuthenticationAuthenticationManagercpp">trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedAuthenticationAuthenticationManagerh">trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.h</a></li>
<li><a href="#trunkSourceWebKit2SharedAuthenticationAuthenticationManagermessagesin">trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.messages.in</a></li>
<li><a href="#trunkSourceWebKit2SharedDownloadsDownloadh">trunk/Source/WebKit2/Shared/Downloads/Download.h</a></li>
<li><a href="#trunkSourceWebKit2SharedDownloadsDownloadAuthenticationClientcpp">trunk/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedDownloadsDownloadAuthenticationClienth">trunk/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.h</a></li>
<li><a href="#trunkSourceWebKit2SharedDownloadsiosDownloadIOSmm">trunk/Source/WebKit2/Shared/Downloads/ios/DownloadIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedDownloadsmacDownloadMacmm">trunk/Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedDownloadssoupDownloadSoupcpp">trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKNSURLAuthenticationChallengemm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKNavigationDelegatePrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAuthenticationAuthenticationChallengeProxycpp">trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAuthenticationAuthenticationChallengeProxyh">trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAuthenticationAuthenticationDecisionListenercpp">trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAuthenticationAuthenticationDecisionListenerh">trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaNavigationStateh">trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaNavigationStatemm">trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebCore/ChangeLog        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-06-10  Dan Bernstein  &lt;mitz@apple.com&gt;
+
+        WebCore part of [Cocoa] Handling authentication challenges should not require multiple delegate methods
+        https://bugs.webkit.org/show_bug.cgi?id=133697
+
+        Reviewed by Anders Carlsson.
+
+        * platform/network/AuthenticationClient.h: Declared new virtual member functions for
+        requesting default handling of a challenge and rejecting a challenge.
+        * platform/network/ResourceHandle.h: Override new AuthenticationClient functions.
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::ResourceHandle::receivedRequestToPerformDefaultHandling): Added. Calls
+        CFURLConnectionPerformDefaultHandlingForChallenge.
+        (WebCore::ResourceHandle::receivedChallengeRejection): Added. Calls
+        CFURLConnectionRejectChallenge.
+        * platform/network/cf/SocketStreamHandle.h: Override new AuthenticationClient functions.
+        * platform/network/cf/SocketStreamHandleCFNet.cpp:
+        (WebCore::SocketStreamHandle::receivedRequestToPerformDefaultHandling): Added empty
+        override.
+        (WebCore::SocketStreamHandle::receivedChallengeRejection): Ditto.
+
</ins><span class="cx"> 2014-06-09  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION (r167962): Out of bounds read in JSC::StructureIDTable::get()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkAuthenticationClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/AuthenticationClient.h (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/AuthenticationClient.h        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebCore/platform/network/AuthenticationClient.h        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -36,6 +36,8 @@
</span><span class="cx">     virtual void receivedCredential(const AuthenticationChallenge&amp;, const Credential&amp;) = 0;
</span><span class="cx">     virtual void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&amp;) = 0;
</span><span class="cx">     virtual void receivedCancellation(const AuthenticationChallenge&amp;) = 0;
</span><ins>+    virtual void receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp;) = 0;
+    virtual void receivedChallengeRejection(const AuthenticationChallenge&amp;) = 0;
</ins><span class="cx"> 
</span><span class="cx">     void ref() { refAuthenticationClient(); }
</span><span class="cx">     void deref() { derefAuthenticationClient(); }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandle.h (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceHandle.h        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.h        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -123,6 +123,8 @@
</span><span class="cx">     virtual void receivedCredential(const AuthenticationChallenge&amp;, const Credential&amp;) override;
</span><span class="cx">     virtual void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&amp;) override;
</span><span class="cx">     virtual void receivedCancellation(const AuthenticationChallenge&amp;) override;
</span><ins>+    virtual void receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp;) override;
+    virtual void receivedChallengeRejection(const AuthenticationChallenge&amp;) override;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA) &amp;&amp; USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -454,6 +454,32 @@
</span><span class="cx">         client()-&gt;receivedCancellation(this, challenge);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp; challenge)
+{
+    LOG(Network, &quot;CFNet - receivedRequestToPerformDefaultHandling()&quot;);
+    ASSERT(!challenge.isNull());
+    ASSERT(challenge.cfURLAuthChallengeRef());
+    if (challenge != d-&gt;m_currentWebChallenge)
+        return;
+
+    CFURLConnectionPerformDefaultHandlingForChallenge(d-&gt;m_connection.get(), challenge.cfURLAuthChallengeRef());
+
+    clearAuthentication();
+}
+
+void ResourceHandle::receivedChallengeRejection(const AuthenticationChallenge&amp; challenge)
+{
+    LOG(Network, &quot;CFNet - receivedChallengeRejection()&quot;);
+    ASSERT(!challenge.isNull());
+    ASSERT(challenge.cfURLAuthChallengeRef());
+    if (challenge != d-&gt;m_currentWebChallenge)
+        return;
+
+    CFURLConnectionRejectChallenge(d-&gt;m_connection.get(), challenge.cfURLAuthChallengeRef());
+
+    clearAuthentication();
+}
+
</ins><span class="cx"> CFURLStorageSessionRef ResourceHandle::storageSession() const
</span><span class="cx"> {
</span><span class="cx">     return d-&gt;m_storageSession.get();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfSocketStreamHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/SocketStreamHandle.h (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/SocketStreamHandle.h        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebCore/platform/network/cf/SocketStreamHandle.h        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -88,6 +88,8 @@
</span><span class="cx">     virtual void receivedCredential(const AuthenticationChallenge&amp;, const Credential&amp;);
</span><span class="cx">     virtual void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&amp;);
</span><span class="cx">     virtual void receivedCancellation(const AuthenticationChallenge&amp;);
</span><ins>+    virtual void receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp;);
+    virtual void receivedChallengeRejection(const AuthenticationChallenge&amp;);
</ins><span class="cx"> 
</span><span class="cx">     virtual void refAuthenticationClient() { ref(); }
</span><span class="cx">     virtual void derefAuthenticationClient() { deref(); }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfSocketStreamHandleCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -663,6 +663,14 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void SocketStreamHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp;)
+{
+}
+
+void SocketStreamHandle::receivedChallengeRejection(const AuthenticationChallenge&amp;)
+{
+}
+
</ins><span class="cx"> unsigned short SocketStreamHandle::port() const
</span><span class="cx"> {
</span><span class="cx">     if (unsigned short urlPort = m_url.port())
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcurlResourceHandleCurlcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -282,6 +282,16 @@
</span><span class="cx">         client()-&gt;receivedCancellation(this, challenge);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp;)
+{
+    ASSERT_NOT_REACHED();
+}
+
+void ResourceHandle::receivedChallengeRejection(const AuthenticationChallenge&amp;)
+{
+    ASSERT_NOT_REACHED();
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcurlSocketStreamHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/curl/SocketStreamHandle.h (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/curl/SocketStreamHandle.h        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebCore/platform/network/curl/SocketStreamHandle.h        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -61,6 +61,8 @@
</span><span class="cx">         void receivedCredential(const AuthenticationChallenge&amp;, const Credential&amp;);
</span><span class="cx">         void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&amp;);
</span><span class="cx">         void receivedCancellation(const AuthenticationChallenge&amp;);
</span><ins>+        void receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp;);
+        void receivedChallengeRejection(const AuthenticationChallenge&amp;);
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> }  // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcurlSocketStreamHandleCurlcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/curl/SocketStreamHandleCurl.cpp (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/curl/SocketStreamHandleCurl.cpp        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebCore/platform/network/curl/SocketStreamHandleCurl.cpp        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -88,6 +88,16 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void SocketStreamHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp;)
+{
+    notImplemented();
+}
+
+void SocketStreamHandle::receivedChallengeRejection(const AuthenticationChallenge&amp;)
+{
+    notImplemented();
+}
+
</ins><span class="cx"> }  // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacResourceHandleMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -689,6 +689,32 @@
</span><span class="cx">         client()-&gt;receivedCancellation(this, challenge);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp; challenge)
+{
+    LOG(Network, &quot;Handle %p receivedRequestToPerformDefaultHandling&quot;, this);
+
+    ASSERT(!challenge.isNull());
+    if (challenge != d-&gt;m_currentWebChallenge)
+        return;
+
+    [[d-&gt;m_currentMacChallenge sender] performDefaultHandlingForAuthenticationChallenge:d-&gt;m_currentMacChallenge];
+
+    clearAuthentication();
+}
+
+void ResourceHandle::receivedChallengeRejection(const AuthenticationChallenge&amp; challenge)
+{
+    LOG(Network, &quot;Handle %p receivedChallengeRejection&quot;, this);
+
+    ASSERT(!challenge.isNull());
+    if (challenge != d-&gt;m_currentWebChallenge)
+        return;
+
+    [[d-&gt;m_currentMacChallenge sender] rejectProtectionSpaceAndContinueWithChallenge:d-&gt;m_currentMacChallenge];
+
+    clearAuthentication();
+}
+
</ins><span class="cx"> void ResourceHandle::continueWillCacheResponse(NSCachedURLResponse *response)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(client());
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupResourceHandleSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -1194,6 +1194,16 @@
</span><span class="cx">     clearAuthentication();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp;)
+{
+    ASSERT_NOT_REACHED();
+}
+
+void ResourceHandle::receivedChallengeRejection(const AuthenticationChallenge&amp;)
+{
+    ASSERT_NOT_REACHED();
+}
+
</ins><span class="cx"> static bool waitingToSendRequest(ResourceHandle* handle)
</span><span class="cx"> {
</span><span class="cx">     // We need to check for d-&gt;m_soupRequest because the request may have raised a failure
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupSocketStreamHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/SocketStreamHandle.h (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/SocketStreamHandle.h        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebCore/platform/network/soup/SocketStreamHandle.h        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -78,6 +78,9 @@
</span><span class="cx">         void receivedCredential(const AuthenticationChallenge&amp;, const Credential&amp;);
</span><span class="cx">         void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&amp;);
</span><span class="cx">         void receivedCancellation(const AuthenticationChallenge&amp;);
</span><ins>+        void receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp;);
+        void receivedChallengeRejection(const AuthenticationChallenge&amp;);
+
</ins><span class="cx">         void beginWaitingForSocketWritability();
</span><span class="cx">         void stopWaitingForSocketWritability();
</span><span class="cx">     };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupSocketStreamHandleSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -228,6 +228,16 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void SocketStreamHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp;)
+{
+    notImplemented();
+}
+
+void SocketStreamHandle::receivedChallengeRejection(const AuthenticationChallenge&amp;)
+{
+    notImplemented();
+}
+
</ins><span class="cx"> void SocketStreamHandle::beginWaitingForSocketWritability()
</span><span class="cx"> {
</span><span class="cx">     if (m_writeReadySource) // Already waiting.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkwinSocketStreamHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/win/SocketStreamHandle.h (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/win/SocketStreamHandle.h        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebCore/platform/network/win/SocketStreamHandle.h        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -61,6 +61,8 @@
</span><span class="cx">     void receivedCredential(const AuthenticationChallenge&amp;, const Credential&amp;);
</span><span class="cx">     void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&amp;);
</span><span class="cx">     void receivedCancellation(const AuthenticationChallenge&amp;);
</span><ins>+    void receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp;);
+    void receivedChallengeRejection(const AuthenticationChallenge&amp;);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkwinSocketStreamHandleWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/win/SocketStreamHandleWin.cpp (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/win/SocketStreamHandleWin.cpp        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebCore/platform/network/win/SocketStreamHandleWin.cpp        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -86,4 +86,14 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void SocketStreamHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp;)
+{
+    notImplemented();
+}
+
+void SocketStreamHandle::receivedChallengeRejection(const AuthenticationChallenge&amp;)
+{
+    notImplemented();
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/ChangeLog        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -1,3 +1,67 @@
</span><ins>+2014-06-10  Dan Bernstein  &lt;mitz@apple.com&gt;
+
+        WebKit2 part of [Cocoa] Handling authentication challenges should not require multiple delegate methods
+        https://bugs.webkit.org/show_bug.cgi?id=133697
+
+        Reviewed by Anders Carlsson.
+
+        * Shared/Authentication/AuthenticationManager.cpp:
+        (WebKit::AuthenticationManager::performDefaultHandling): Added. Calls the new
+        AuthenticationClient function receivedRequestToPerformDefaultHandling.
+        (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinue): Added. Calls the new
+        AuthenticationClient function receivedChallengeRejection.
+        * Shared/Authentication/AuthenticationManager.h:
+        * Shared/Authentication/AuthenticationManager.messages.in: Added new messages
+        PerformDefaultHandling and RejectProtectionSpaceAndContinue.
+
+        * Shared/Downloads/DownloadAuthenticationClient.h: Override new AuthenticationClient member
+        functions.
+
+        * Shared/Downloads/ios/DownloadIOS.mm:
+        (WebKit::Download::receivedRequestToPerformDefaultHandling): Added empty implementation.
+        (WebKit::Download::receivedChallengeRejection): Ditto.
+
+        * Shared/Downloads/mac/DownloadMac.mm:
+        (WebKit::Download::receivedRequestToPerformDefaultHandling): Added. Forwards to the sender.
+        (WebKit::Download::receivedChallengeRejection): Ditto.
+
+        * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:
+        (checkChallenge): Factored out a bit of code into this helper function.
+        (-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]): Use new helper.
+        (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
+        Ditto.
+        (-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]): Ditto.
+        (-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]):
+        Implemented this optional NSURLAuthenticationChallengeSender protocol method by forwarding
+        to the decision listener.
+        (-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]):
+        Ditto.
+
+        * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Declared new delegate method.
+
+        * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
+        (WebKit::AuthenticationChallengeProxy::performDefaultHandling): Added. Sends a message to
+        the authentication manager.
+        (WebKit::AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue): Ditto.
+        * UIProcess/Authentication/AuthenticationChallengeProxy.h:
+
+        * UIProcess/Authentication/AuthenticationDecisionListener.cpp:
+        (WebKit::AuthenticationDecisionListener::performDefaultHandling): Added. Forwards to the
+        authentication challenge proxy.
+        (WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue): Ditto.
+        * UIProcess/Authentication/AuthenticationDecisionListener.h:
+
+        * UIProcess/Cocoa/NavigationState.h: Added flag in m_navigationDelegateMethods struct.
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::NavigationState::setNavigationDelegate): Initialize
+        webViewWillSendRequestForAuthenticationChallenge flag in the delegate methods struct.
+        (WebKit::NavigationState::LoaderClient::canAuthenticateAgainstProtectionSpaceInFrame): If
+        the delegate implements -_webView:willSendRequestForAuthenticationChallenge:, return true
+        here; the delegate will respond with -rejectProtectionSpaceAndContinueWithChallenge: if
+        it cannot authenticate.
+        (WebKit::NavigationState::LoaderClient::didReceiveAuthenticationChallengeInFrame): If the
+        delegate implements -_webView:willSendRequestForAuthenticationChallenge:, send that message.
+
</ins><span class="cx"> 2014-06-10  Timothy Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Factor repeated CFRunLoopObserver code out
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAuthenticationAuthenticationManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -156,4 +156,36 @@
</span><span class="cx">     coreClient-&gt;receivedCancellation(challenge);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void AuthenticationManager::performDefaultHandling(uint64_t challengeID)
+{
+    ASSERT(RunLoop::isMain());
+
+    AuthenticationChallenge challenge = m_challenges.take(challengeID);
+    ASSERT(!challenge.isNull());
+    AuthenticationClient* coreClient = challenge.authenticationClient();
+    if (!coreClient) {
+        // This authentication challenge comes from a download.
+        Download::receivedRequestToPerformDefaultHandling(challenge);
+        return;
+    }
+
+    coreClient-&gt;receivedRequestToPerformDefaultHandling(challenge);
+}
+
+void AuthenticationManager::rejectProtectionSpaceAndContinue(uint64_t challengeID)
+{
+    ASSERT(RunLoop::isMain());
+
+    AuthenticationChallenge challenge = m_challenges.take(challengeID);
+    ASSERT(!challenge.isNull());
+    AuthenticationClient* coreClient = challenge.authenticationClient();
+    if (!coreClient) {
+        // This authentication challenge comes from a download.
+        Download::receivedChallengeRejection(challenge);
+        return;
+    }
+
+    coreClient-&gt;receivedChallengeRejection(challenge);
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAuthenticationAuthenticationManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.h (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.h        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.h        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -62,7 +62,9 @@
</span><span class="cx">     void useCredentialForChallenge(uint64_t challengeID, const WebCore::Credential&amp;, const WebCore::CertificateInfo&amp;);
</span><span class="cx">     void continueWithoutCredentialForChallenge(uint64_t challengeID);
</span><span class="cx">     void cancelChallenge(uint64_t challengeID);
</span><del>-    
</del><ins>+    void performDefaultHandling(uint64_t challengeID);
+    void rejectProtectionSpaceAndContinue(uint64_t challengeID);
+
</ins><span class="cx">     uint64_t outstandingAuthenticationChallengeCount() const { return m_challenges.size(); }
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAuthenticationAuthenticationManagermessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.messages.in (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.messages.in        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.messages.in        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -24,4 +24,6 @@
</span><span class="cx">     void UseCredentialForChallenge(uint64_t challengeID, WebCore::Credential credential, WebCore::CertificateInfo certificate);
</span><span class="cx">     void ContinueWithoutCredentialForChallenge(uint64_t challengeID);
</span><span class="cx">     void CancelChallenge(uint64_t challengeID);
</span><ins>+    void PerformDefaultHandling(uint64_t challengeID);
+    void RejectProtectionSpaceAndContinue(uint64_t challengeID);
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedDownloadsDownloadh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Downloads/Download.h (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Downloads/Download.h        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/Shared/Downloads/Download.h        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -100,6 +100,8 @@
</span><span class="cx">     static void receivedCredential(const WebCore::AuthenticationChallenge&amp;, const WebCore::Credential&amp;);
</span><span class="cx">     static void receivedRequestToContinueWithoutCredential(const WebCore::AuthenticationChallenge&amp;);
</span><span class="cx">     static void receivedCancellation(const WebCore::AuthenticationChallenge&amp;);
</span><ins>+    static void receivedRequestToPerformDefaultHandling(const WebCore::AuthenticationChallenge&amp;);
+    static void receivedChallengeRejection(const WebCore::AuthenticationChallenge&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void useCredential(const WebCore::AuthenticationChallenge&amp;, const WebCore::Credential&amp;);
</span><span class="cx">     void continueWithoutCredential(const WebCore::AuthenticationChallenge&amp;);
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedDownloadsDownloadAuthenticationClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.cpp (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.cpp        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.cpp        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -53,4 +53,14 @@
</span><span class="cx">     // FIXME (119667): This can probably be just removed.
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void DownloadAuthenticationClient::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp;)
+{
+    // FIXME (119667): This can probably be just removed.
+}
+
+void DownloadAuthenticationClient::receivedChallengeRejection(const AuthenticationChallenge&amp;)
+{
+    // FIXME (119667): This can probably be just removed.
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedDownloadsDownloadAuthenticationClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.h (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.h        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.h        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -54,6 +54,8 @@
</span><span class="cx">     virtual void receivedCredential(const WebCore::AuthenticationChallenge&amp;, const WebCore::Credential&amp;);
</span><span class="cx">     virtual void receivedRequestToContinueWithoutCredential(const WebCore::AuthenticationChallenge&amp;);
</span><span class="cx">     virtual void receivedCancellation(const WebCore::AuthenticationChallenge&amp;);
</span><ins>+    virtual void receivedRequestToPerformDefaultHandling(const WebCore::AuthenticationChallenge&amp;) override;
+    virtual void receivedChallengeRejection(const WebCore::AuthenticationChallenge&amp;) override;
</ins><span class="cx"> 
</span><span class="cx">     virtual void refAuthenticationClient() { ref(); }
</span><span class="cx">     virtual void derefAuthenticationClient() { deref(); }
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedDownloadsiosDownloadIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Downloads/ios/DownloadIOS.mm (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Downloads/ios/DownloadIOS.mm        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/Shared/Downloads/ios/DownloadIOS.mm        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -169,6 +169,16 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Download::receivedRequestToPerformDefaultHandling(const WebCore::AuthenticationChallenge&amp;)
+{
+    notImplemented();
+}
+
+void Download::receivedChallengeRejection(const WebCore::AuthenticationChallenge&amp;)
+{
+    notImplemented();
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedDownloadsmacDownloadMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -125,6 +125,16 @@
</span><span class="cx">     [authenticationChallenge.sender() cancelAuthenticationChallenge:authenticationChallenge.nsURLAuthenticationChallenge()];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Download::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp; authenticationChallenge)
+{
+    [authenticationChallenge.sender() performDefaultHandlingForAuthenticationChallenge:authenticationChallenge.nsURLAuthenticationChallenge()];
+}
+
+void Download::receivedChallengeRejection(const AuthenticationChallenge&amp; authenticationChallenge)
+{
+    [authenticationChallenge.sender() rejectProtectionSpaceAndContinueWithChallenge:authenticationChallenge.nsURLAuthenticationChallenge()];
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> @implementation WKDownloadAsDelegate
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedDownloadssoupDownloadSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -282,4 +282,14 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Download::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&amp;)
+{
+    notImplemented();
+}
+
+void Download::receivedChallengeRejection(const AuthenticationChallenge&amp;)
+{
+    notImplemented();
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKNSURLAuthenticationChallengemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -63,32 +63,45 @@
</span><span class="cx"> 
</span><span class="cx"> @implementation WKNSURLAuthenticationChallengeSender
</span><span class="cx"> 
</span><del>-- (void)cancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
</del><ins>+static void checkChallenge(NSURLAuthenticationChallenge *challenge)
</ins><span class="cx"> {
</span><span class="cx">     if ([challenge class] != [WKNSURLAuthenticationChallenge class])
</span><span class="cx">         [NSException raise:NSInvalidArgumentException format:@&quot;The challenge was not sent by the receiver.&quot;];
</span><ins>+}
</ins><span class="cx"> 
</span><ins>+- (void)cancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
+{
+    checkChallenge(challenge);
</ins><span class="cx">     AuthenticationChallengeProxy&amp; webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
</span><span class="cx">     webChallenge.listener()-&gt;cancel();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)continueWithoutCredentialForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
</span><span class="cx"> {
</span><del>-    if ([challenge class] != [WKNSURLAuthenticationChallenge class])
-        [NSException raise:NSInvalidArgumentException format:@&quot;The challenge was not sent by the receiver.&quot;];
-
</del><ins>+    checkChallenge(challenge);
</ins><span class="cx">     AuthenticationChallengeProxy&amp; webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
</span><span class="cx">     webChallenge.listener()-&gt;useCredential(nullptr);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
</span><span class="cx"> {
</span><del>-    if ([challenge class] != [WKNSURLAuthenticationChallenge class])
-        [NSException raise:NSInvalidArgumentException format:@&quot;The challenge was not sent by the receiver.&quot;];
</del><ins>+    checkChallenge(challenge);
+    AuthenticationChallengeProxy&amp; webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
+    webChallenge.listener()-&gt;useCredential(WebCredential::create(core(credential)).get());
+}
</ins><span class="cx"> 
</span><ins>+- (void)performDefaultHandlingForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
+{
+    checkChallenge(challenge);
</ins><span class="cx">     AuthenticationChallengeProxy&amp; webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
</span><ins>+    webChallenge.listener()-&gt;performDefaultHandling();
+}
</ins><span class="cx"> 
</span><del>-    webChallenge.listener()-&gt;useCredential(WebCredential::create(core(credential)).get());
</del><ins>+- (void)rejectProtectionSpaceAndContinueWithChallenge:(NSURLAuthenticationChallenge *)challenge
+{
+    checkChallenge(challenge);
+    AuthenticationChallengeProxy&amp; webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
+    webChallenge.listener()-&gt;rejectProtectionSpaceAndContinue();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKNavigationDelegatePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_webView:(WKWebView *)webView renderingProgressDidChange:(_WKRenderingProgressEvents)progressEvents;
</span><span class="cx"> 
</span><ins>+- (void)_webView:(WKWebView *)webView willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
</ins><span class="cx"> - (BOOL)_webView:(WKWebView *)webView canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace;
</span><span class="cx"> - (void)_webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAuthenticationAuthenticationChallengeProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -83,6 +83,26 @@
</span><span class="cx">     m_challengeID = 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void AuthenticationChallengeProxy::performDefaultHandling()
+{
+    if (!m_challengeID)
+        return;
+
+    m_connection-&gt;send(Messages::AuthenticationManager::PerformDefaultHandling(m_challengeID), 0);
+
+    m_challengeID = 0;
+}
+
+void AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue()
+{
+    if (!m_challengeID)
+        return;
+
+    m_connection-&gt;send(Messages::AuthenticationManager::RejectProtectionSpaceAndContinue(m_challengeID), 0);
+
+    m_challengeID = 0;
+}
+
</ins><span class="cx"> WebCredential* AuthenticationChallengeProxy::proposedCredential() const
</span><span class="cx"> {
</span><span class="cx">     if (!m_webCredential)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAuthenticationAuthenticationChallengeProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -52,6 +52,8 @@
</span><span class="cx">     
</span><span class="cx">     void useCredential(WebCredential*);
</span><span class="cx">     void cancel();
</span><ins>+    void performDefaultHandling();
+    void rejectProtectionSpaceAndContinue();
</ins><span class="cx"> 
</span><span class="cx">     AuthenticationDecisionListener* listener() const { return m_listener.get(); }
</span><span class="cx">     WebCredential* proposedCredential() const;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAuthenticationAuthenticationDecisionListenercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -52,6 +52,18 @@
</span><span class="cx">         m_challengeProxy-&gt;cancel();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void AuthenticationDecisionListener::performDefaultHandling()
+{
+    if (m_challengeProxy)
+        m_challengeProxy-&gt;performDefaultHandling();
+}
+
+void AuthenticationDecisionListener::rejectProtectionSpaceAndContinue()
+{
+    if (m_challengeProxy)
+        m_challengeProxy-&gt;rejectProtectionSpaceAndContinue();
+}
+
</ins><span class="cx"> void AuthenticationDecisionListener::detachChallenge()
</span><span class="cx"> {
</span><span class="cx">     m_challengeProxy = 0;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAuthenticationAuthenticationDecisionListenerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -44,7 +44,9 @@
</span><span class="cx">     
</span><span class="cx">     void useCredential(WebCredential*);
</span><span class="cx">     void cancel();
</span><del>-    
</del><ins>+    void performDefaultHandling();
+    void rejectProtectionSpaceAndContinue();
+
</ins><span class="cx">     void detachChallenge();
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaNavigationStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -145,6 +145,7 @@
</span><span class="cx">         bool webViewDidFailNavigationWithError : 1;
</span><span class="cx"> 
</span><span class="cx">         bool webViewRenderingProgressDidChange : 1;
</span><ins>+        bool webViewWillSendRequestForAuthenticationChallenge : 1;
</ins><span class="cx">         bool webViewCanAuthenticateAgainstProtectionSpace : 1;
</span><span class="cx">         bool webViewDidReceiveAuthenticationChallenge : 1;
</span><span class="cx">         bool webViewWebProcessDidCrash : 1;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaNavigationStatemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (169781 => 169782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm        2014-06-10 23:30:43 UTC (rev 169781)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm        2014-06-11 00:01:18 UTC (rev 169782)
</span><span class="lines">@@ -126,6 +126,7 @@
</span><span class="cx">     m_navigationDelegateMethods.webViewNavigationDidFailProvisionalLoadInSubframeWithError = [delegate respondsToSelector:@selector(_webView:navigation:didFailProvisionalLoadInSubframe:withError:)];
</span><span class="cx">     m_navigationDelegateMethods.webViewNavigationDidFinishDocumentLoad = [delegate respondsToSelector:@selector(_webView:navigationDidFinishDocumentLoad:)];
</span><span class="cx">     m_navigationDelegateMethods.webViewRenderingProgressDidChange = [delegate respondsToSelector:@selector(_webView:renderingProgressDidChange:)];
</span><ins>+    m_navigationDelegateMethods.webViewWillSendRequestForAuthenticationChallenge = [delegate respondsToSelector:@selector(_webView:willSendRequestForAuthenticationChallenge:)];
</ins><span class="cx">     m_navigationDelegateMethods.webViewCanAuthenticateAgainstProtectionSpace = [delegate respondsToSelector:@selector(_webView:canAuthenticateAgainstProtectionSpace:)];
</span><span class="cx">     m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallenge = [delegate respondsToSelector:@selector(_webView:didReceiveAuthenticationChallenge:)];
</span><span class="cx">     m_navigationDelegateMethods.webViewWebProcessDidCrash = [delegate respondsToSelector:@selector(_webViewWebProcessDidCrash:)];
</span><span class="lines">@@ -581,6 +582,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool NavigationState::LoaderClient::canAuthenticateAgainstProtectionSpaceInFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebKit::WebProtectionSpace* protectionSpace)
</span><span class="cx"> {
</span><ins>+    if (m_navigationState.m_navigationDelegateMethods.webViewWillSendRequestForAuthenticationChallenge)
+        return true;
+
</ins><span class="cx">     if (!m_navigationState.m_navigationDelegateMethods.webViewCanAuthenticateAgainstProtectionSpace)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="lines">@@ -593,6 +597,15 @@
</span><span class="cx"> 
</span><span class="cx"> void NavigationState::LoaderClient::didReceiveAuthenticationChallengeInFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebKit::AuthenticationChallengeProxy* authenticationChallenge)
</span><span class="cx"> {
</span><ins>+    if (m_navigationState.m_navigationDelegateMethods.webViewWillSendRequestForAuthenticationChallenge) {
+        auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
+        if (!navigationDelegate)
+            return;
+
+        [static_cast&lt;id &lt;WKNavigationDelegatePrivate&gt;&gt;(navigationDelegate.get()) _webView:m_navigationState.m_webView willSendRequestForAuthenticationChallenge:wrapper(*authenticationChallenge)];
+        return;
+    }
+
</ins><span class="cx">     if (!m_navigationState.m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallenge)
</span><span class="cx">         return;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>