<!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>[195107] releases/WebKitGTK/webkit-2.10/Source/WebKit2</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/195107">195107</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2016-01-15 02:30:27 -0800 (Fri, 15 Jan 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/192287">r192287</a> - Implement authentication challenge handling when using NETWORK_SESSION
https://bugs.webkit.org/show_bug.cgi?id=150968
Reviewed by Antti Koivisto.
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::didReceiveChallenge):
Copy functionality from NetworkLoad::canAuthenticateAgainstProtectionSpaceAsync (which is used when we don't use NETWORK_SESSION)
because there is no canAuthenticateAgainstProtectionSpace delegate callback when using NSURLSession, according to
https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/URLLoadingSystem/Articles/AuthenticationChallenges.html
Instead, all authentication challenge callbacks go to URLSession:task:didReceiveChallenge:completionHandler:
because we do not implement URLSession:didReceiveChallenge:completionHandler:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[NetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
(-[NetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
(-[NetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
Make a block copy of the completion handlers so we can copy the std::functions that wrap them into HashMaps and call them later,
in this case we call the completion handler after the UIProcess gives us credentials for an authentication challenge.
* Shared/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::AuthenticationManager):
(WebKit::AuthenticationManager::addChallengeToChallengeMap):
(WebKit::AuthenticationManager::shouldCoalesceChallenge):
(WebKit::AuthenticationManager::coalesceChallengesMatching):
(WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
Fix an existing bug that caused multiple calls to addChallengeToChallengeMap for one challenge. This caused too many calls to
the AuthenticationClient methods, which did not cause a problem because they were not one-time-use block copies of completion handlers before.
(WebKit::AuthenticationManager::useCredentialForSingleChallenge):
(WebKit::AuthenticationManager::continueWithoutCredentialForChallenge):
(WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge):
(WebKit::AuthenticationManager::cancelChallenge):
(WebKit::AuthenticationManager::cancelSingleChallenge):
(WebKit::AuthenticationManager::performDefaultHandling):
(WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge):
(WebKit::AuthenticationManager::rejectProtectionSpaceAndContinue):
(WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge):
Call completion handlers which we stored in a HashMap before doing IPC if we are using NETWORK_SESSION,
which has completion handlers instead of continueSomething client calls.
* Shared/Authentication/AuthenticationManager.h:
(WebKit::AuthenticationManager::outstandingAuthenticationChallengeCount):
* Shared/Downloads/Download.cpp:
(WebKit::Download::didReceiveAuthenticationChallenge):
(WebKit::Download::didReceiveResponse):
* Shared/Downloads/DownloadAuthenticationClient.cpp:
(WebKit::DownloadAuthenticationClient::receivedChallengeRejection):
* Shared/Downloads/DownloadAuthenticationClient.h:
Add ifdefs for code related to downloading I will implement later.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit210SourceWebKit2ChangeLog">releases/WebKitGTK/webkit-2.10/Source/WebKit2/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebKit2SharedAuthenticationAuthenticationManagercpp">releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebKit2SharedAuthenticationAuthenticationManagerh">releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Authentication/AuthenticationManager.h</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebKit2SharedDownloadsDownloadcpp">releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Downloads/Download.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebKit2SharedDownloadsDownloadAuthenticationClientcpp">releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebKit2SharedDownloadsDownloadAuthenticationClienth">releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit210SourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebKit2/ChangeLog (195106 => 195107)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebKit2/ChangeLog        2016-01-15 10:06:27 UTC (rev 195106)
+++ releases/WebKitGTK/webkit-2.10/Source/WebKit2/ChangeLog        2016-01-15 10:30:27 UTC (rev 195107)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2015-11-10 Alex Christensen <achristensen@webkit.org>
+
+ Implement authentication challenge handling when using NETWORK_SESSION
+ https://bugs.webkit.org/show_bug.cgi?id=150968
+
+ Reviewed by Antti Koivisto.
+
+ * NetworkProcess/NetworkLoad.cpp:
+ (WebKit::NetworkLoad::didReceiveChallenge):
+ Copy functionality from NetworkLoad::canAuthenticateAgainstProtectionSpaceAsync (which is used when we don't use NETWORK_SESSION)
+ because there is no canAuthenticateAgainstProtectionSpace delegate callback when using NSURLSession, according to
+ https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/URLLoadingSystem/Articles/AuthenticationChallenges.html
+ Instead, all authentication challenge callbacks go to URLSession:task:didReceiveChallenge:completionHandler:
+ because we do not implement URLSession:didReceiveChallenge:completionHandler:
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (-[NetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
+ (-[NetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
+ (-[NetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
+ Make a block copy of the completion handlers so we can copy the std::functions that wrap them into HashMaps and call them later,
+ in this case we call the completion handler after the UIProcess gives us credentials for an authentication challenge.
+ * Shared/Authentication/AuthenticationManager.cpp:
+ (WebKit::AuthenticationManager::AuthenticationManager):
+ (WebKit::AuthenticationManager::addChallengeToChallengeMap):
+ (WebKit::AuthenticationManager::shouldCoalesceChallenge):
+ (WebKit::AuthenticationManager::coalesceChallengesMatching):
+ (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
+ Fix an existing bug that caused multiple calls to addChallengeToChallengeMap for one challenge. This caused too many calls to
+ the AuthenticationClient methods, which did not cause a problem because they were not one-time-use block copies of completion handlers before.
+ (WebKit::AuthenticationManager::useCredentialForSingleChallenge):
+ (WebKit::AuthenticationManager::continueWithoutCredentialForChallenge):
+ (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge):
+ (WebKit::AuthenticationManager::cancelChallenge):
+ (WebKit::AuthenticationManager::cancelSingleChallenge):
+ (WebKit::AuthenticationManager::performDefaultHandling):
+ (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge):
+ (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinue):
+ (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge):
+ Call completion handlers which we stored in a HashMap before doing IPC if we are using NETWORK_SESSION,
+ which has completion handlers instead of continueSomething client calls.
+ * Shared/Authentication/AuthenticationManager.h:
+ (WebKit::AuthenticationManager::outstandingAuthenticationChallengeCount):
+ * Shared/Downloads/Download.cpp:
+ (WebKit::Download::didReceiveAuthenticationChallenge):
+ (WebKit::Download::didReceiveResponse):
+ * Shared/Downloads/DownloadAuthenticationClient.cpp:
+ (WebKit::DownloadAuthenticationClient::receivedChallengeRejection):
+ * Shared/Downloads/DownloadAuthenticationClient.h:
+ Add ifdefs for code related to downloading I will implement later.
+
</ins><span class="cx"> 2015-11-30 Jiewen Tan <jiewen_tan@apple.com>
</span><span class="cx">
</span><span class="cx"> Null dereference loading Blink layout test http/tests/misc/detach-during-notifyDone.html
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebKit2SharedAuthenticationAuthenticationManagercpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp (195106 => 195107)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp        2016-01-15 10:06:27 UTC (rev 195106)
+++ releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp        2016-01-15 10:30:27 UTC (rev 195107)
</span><span class="lines">@@ -70,12 +70,12 @@
</span><span class="cx"> m_process->addMessageReceiver(Messages::AuthenticationManager::messageReceiverName(), *this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-uint64_t AuthenticationManager::addChallengeToChallengeMap(const WebCore::AuthenticationChallenge& authenticationChallenge)
</del><ins>+uint64_t AuthenticationManager::addChallengeToChallengeMap(const Challenge& challenge)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(RunLoop::isMain());
</span><span class="cx">
</span><span class="cx"> uint64_t challengeID = generateAuthenticationChallengeID();
</span><del>- m_challenges.set(challengeID, authenticationChallenge);
</del><ins>+ m_challenges.set(challengeID, challenge);
</ins><span class="cx"> return challengeID;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -85,7 +85,7 @@
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> for (auto& item : m_challenges) {
</span><del>- if (item.key != challengeID && ProtectionSpace::compare(challenge.protectionSpace(), item.value.protectionSpace()))
</del><ins>+ if (item.key != challengeID && ProtectionSpace::compare(challenge.protectionSpace(), item.value.challenge.protectionSpace()))
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> return false;
</span><span class="lines">@@ -93,17 +93,17 @@
</span><span class="cx">
</span><span class="cx"> Vector<uint64_t> AuthenticationManager::coalesceChallengesMatching(uint64_t challengeID) const
</span><span class="cx"> {
</span><del>- AuthenticationChallenge challenge = m_challenges.get(challengeID);
- ASSERT(!challenge.isNull());
</del><ins>+ auto challenge = m_challenges.get(challengeID);
+ ASSERT(!challenge.challenge.isNull());
</ins><span class="cx">
</span><span class="cx"> Vector<uint64_t> challengesToCoalesce;
</span><span class="cx"> challengesToCoalesce.append(challengeID);
</span><span class="cx">
</span><del>- if (!canCoalesceChallenge(challenge))
</del><ins>+ if (!canCoalesceChallenge(challenge.challenge))
</ins><span class="cx"> return challengesToCoalesce;
</span><span class="cx">
</span><span class="cx"> for (auto& item : m_challenges) {
</span><del>- if (item.key != challengeID && ProtectionSpace::compare(challenge.protectionSpace(), item.value.protectionSpace()))
</del><ins>+ if (item.key != challengeID && ProtectionSpace::compare(challenge.challenge.protectionSpace(), item.value.challenge.protectionSpace()))
</ins><span class="cx"> challengesToCoalesce.append(item.key);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -115,7 +115,11 @@
</span><span class="cx"> ASSERT(frame);
</span><span class="cx"> ASSERT(frame->page());
</span><span class="cx">
</span><del>- uint64_t challengeID = addChallengeToChallengeMap(authenticationChallenge);
</del><ins>+ uint64_t challengeID = addChallengeToChallengeMap({authenticationChallenge
+#if USE(NETWORK_SESSION)
+ , ChallengeCompletionHandler()
+#endif
+ });
</ins><span class="cx">
</span><span class="cx"> // Coalesce challenges in the same protection space.
</span><span class="cx"> if (shouldCoalesceChallenge(challengeID, authenticationChallenge))
</span><span class="lines">@@ -125,27 +129,46 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(NETWORK_PROCESS)
</span><ins>+#if USE(NETWORK_SESSION)
+void AuthenticationManager::didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const AuthenticationChallenge& authenticationChallenge, ChallengeCompletionHandler completionHandler)
+{
+ ASSERT(pageID);
+ ASSERT(frameID);
+
+ uint64_t challengeID = addChallengeToChallengeMap({authenticationChallenge, completionHandler});
+ if (shouldCoalesceChallenge(challengeID, authenticationChallenge))
+ return;
+
+ m_process->send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID));
+}
+#endif
</ins><span class="cx"> void AuthenticationManager::didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const AuthenticationChallenge& authenticationChallenge)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(pageID);
</span><span class="cx"> ASSERT(frameID);
</span><span class="cx">
</span><del>- uint64_t challengeID = addChallengeToChallengeMap(authenticationChallenge);
</del><ins>+ uint64_t challengeID = addChallengeToChallengeMap({authenticationChallenge
+#if USE(NETWORK_SESSION)
+ , ChallengeCompletionHandler()
+#endif
+ });
</ins><span class="cx"> if (shouldCoalesceChallenge(challengeID, authenticationChallenge))
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- m_process->send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, addChallengeToChallengeMap(authenticationChallenge)));
</del><ins>+ m_process->send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID));
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !USE(NETWORK_SESSION)
</ins><span class="cx"> void AuthenticationManager::didReceiveAuthenticationChallenge(Download* download, const AuthenticationChallenge& authenticationChallenge)
</span><span class="cx"> {
</span><del>- uint64_t challengeID = addChallengeToChallengeMap(authenticationChallenge);
</del><ins>+ uint64_t challengeID = addChallengeToChallengeMap({authenticationChallenge});
</ins><span class="cx"> if (shouldCoalesceChallenge(challengeID, authenticationChallenge))
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- download->send(Messages::DownloadProxy::DidReceiveAuthenticationChallenge(authenticationChallenge, addChallengeToChallengeMap(authenticationChallenge)));
</del><ins>+ download->send(Messages::DownloadProxy::DidReceiveAuthenticationChallenge(authenticationChallenge, challengeID));
</ins><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> // Currently, only Mac knows how to respond to authentication challenges with certificate info.
</span><span class="cx"> #if !HAVE(SEC_IDENTITY)
</span><span class="lines">@@ -165,21 +188,30 @@
</span><span class="cx">
</span><span class="cx"> void AuthenticationManager::useCredentialForSingleChallenge(uint64_t challengeID, const Credential& credential, const CertificateInfo& certificateInfo)
</span><span class="cx"> {
</span><del>- AuthenticationChallenge challenge = m_challenges.take(challengeID);
- ASSERT(!challenge.isNull());
-
- if (tryUseCertificateInfoForChallenge(challenge, certificateInfo))
</del><ins>+ auto challenge = m_challenges.take(challengeID);
+ ASSERT(!challenge.challenge.isNull());
+
+ if (tryUseCertificateInfoForChallenge(challenge.challenge, certificateInfo))
</ins><span class="cx"> return;
</span><del>-
- AuthenticationClient* coreClient = challenge.authenticationClient();
</del><ins>+
+#if USE(NETWORK_SESSION)
+ // If there is a completion handler, then there is no AuthenticationClient.
+ // FIXME: Remove the use of AuthenticationClient in WebKit2 once NETWORK_SESSION is used for all loads.
+ if (challenge.completionHandler) {
+ challenge.completionHandler(AuthenticationChallengeDisposition::UseCredential, credential);
+ return;
+ }
+#endif
+
+ AuthenticationClient* coreClient = challenge.challenge.authenticationClient();
</ins><span class="cx"> if (!coreClient) {
</span><span class="cx"> // FIXME: The authentication client is null for downloads, but it can also be null for canceled loads.
</span><span class="cx"> // We should not call Download::receivedCredential in the latter case.
</span><del>- Download::receivedCredential(challenge, credential);
</del><ins>+ Download::receivedCredential(challenge.challenge, credential);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- coreClient->receivedCredential(challenge, credential);
</del><ins>+ coreClient->receivedCredential(challenge.challenge, credential);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AuthenticationManager::continueWithoutCredentialForChallenge(uint64_t challengeID)
</span><span class="lines">@@ -192,17 +224,25 @@
</span><span class="cx">
</span><span class="cx"> void AuthenticationManager::continueWithoutCredentialForSingleChallenge(uint64_t challengeID)
</span><span class="cx"> {
</span><del>- AuthenticationChallenge challenge = m_challenges.take(challengeID);
- ASSERT(!challenge.isNull());
- AuthenticationClient* coreClient = challenge.authenticationClient();
</del><ins>+ auto challenge = m_challenges.take(challengeID);
+ ASSERT(!challenge.challenge.isNull());
+
+#if USE(NETWORK_SESSION)
+ if (challenge.completionHandler) {
+ challenge.completionHandler(AuthenticationChallengeDisposition::UseCredential, Credential());
+ return;
+ }
+#endif
+
+ AuthenticationClient* coreClient = challenge.challenge.authenticationClient();
</ins><span class="cx"> if (!coreClient) {
</span><span class="cx"> // FIXME: The authentication client is null for downloads, but it can also be null for canceled loads.
</span><span class="cx"> // We should not call Download::receivedCredential in the latter case.
</span><del>- Download::receivedRequestToContinueWithoutCredential(challenge);
</del><ins>+ Download::receivedRequestToContinueWithoutCredential(challenge.challenge);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- coreClient->receivedRequestToContinueWithoutCredential(challenge);
</del><ins>+ coreClient->receivedRequestToContinueWithoutCredential(challenge.challenge);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AuthenticationManager::cancelChallenge(uint64_t challengeID)
</span><span class="lines">@@ -215,17 +255,25 @@
</span><span class="cx">
</span><span class="cx"> void AuthenticationManager::cancelSingleChallenge(uint64_t challengeID)
</span><span class="cx"> {
</span><del>- AuthenticationChallenge challenge = m_challenges.take(challengeID);
- ASSERT(!challenge.isNull());
- AuthenticationClient* coreClient = challenge.authenticationClient();
</del><ins>+ auto challenge = m_challenges.take(challengeID);
+ ASSERT(!challenge.challenge.isNull());
+
+#if USE(NETWORK_SESSION)
+ if (challenge.completionHandler) {
+ challenge.completionHandler(AuthenticationChallengeDisposition::Cancel, Credential());
+ return;
+ }
+#endif
+
+ AuthenticationClient* coreClient = challenge.challenge.authenticationClient();
</ins><span class="cx"> if (!coreClient) {
</span><span class="cx"> // FIXME: The authentication client is null for downloads, but it can also be null for canceled loads.
</span><span class="cx"> // We should not call Download::receivedCredential in the latter case.
</span><del>- Download::receivedCancellation(challenge);
</del><ins>+ Download::receivedCancellation(challenge.challenge);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- coreClient->receivedCancellation(challenge);
</del><ins>+ coreClient->receivedCancellation(challenge.challenge);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AuthenticationManager::performDefaultHandling(uint64_t challengeID)
</span><span class="lines">@@ -238,17 +286,25 @@
</span><span class="cx">
</span><span class="cx"> void AuthenticationManager::performDefaultHandlingForSingleChallenge(uint64_t challengeID)
</span><span class="cx"> {
</span><del>- AuthenticationChallenge challenge = m_challenges.take(challengeID);
- ASSERT(!challenge.isNull());
- AuthenticationClient* coreClient = challenge.authenticationClient();
</del><ins>+ auto challenge = m_challenges.take(challengeID);
+ ASSERT(!challenge.challenge.isNull());
+
+#if USE(NETWORK_SESSION)
+ if (challenge.completionHandler) {
+ challenge.completionHandler(AuthenticationChallengeDisposition::PerformDefaultHandling, Credential());
+ return;
+ }
+#endif
+
+ AuthenticationClient* coreClient = challenge.challenge.authenticationClient();
</ins><span class="cx"> if (!coreClient) {
</span><span class="cx"> // FIXME: The authentication client is null for downloads, but it can also be null for canceled loads.
</span><span class="cx"> // We should not call Download::receivedCredential in the latter case.
</span><del>- Download::receivedRequestToPerformDefaultHandling(challenge);
</del><ins>+ Download::receivedRequestToPerformDefaultHandling(challenge.challenge);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- coreClient->receivedRequestToPerformDefaultHandling(challenge);
</del><ins>+ coreClient->receivedRequestToPerformDefaultHandling(challenge.challenge);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AuthenticationManager::rejectProtectionSpaceAndContinue(uint64_t challengeID)
</span><span class="lines">@@ -261,17 +317,25 @@
</span><span class="cx">
</span><span class="cx"> void AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge(uint64_t challengeID)
</span><span class="cx"> {
</span><del>- AuthenticationChallenge challenge = m_challenges.take(challengeID);
- ASSERT(!challenge.isNull());
- AuthenticationClient* coreClient = challenge.authenticationClient();
</del><ins>+ auto challenge = m_challenges.take(challengeID);
+ ASSERT(!challenge.challenge.isNull());
+
+#if USE(NETWORK_SESSION)
+ if (challenge.completionHandler) {
+ challenge.completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpace, Credential());
+ return;
+ }
+#endif
+
+ AuthenticationClient* coreClient = challenge.challenge.authenticationClient();
</ins><span class="cx"> if (!coreClient) {
</span><span class="cx"> // FIXME: The authentication client is null for downloads, but it can also be null for canceled loads.
</span><span class="cx"> // We should not call Download::receivedCredential in the latter case.
</span><del>- Download::receivedChallengeRejection(challenge);
</del><ins>+ Download::receivedChallengeRejection(challenge.challenge);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- coreClient->receivedChallengeRejection(challenge);
</del><ins>+ coreClient->receivedChallengeRejection(challenge.challenge);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebKit2SharedAuthenticationAuthenticationManagerh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Authentication/AuthenticationManager.h (195106 => 195107)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Authentication/AuthenticationManager.h        2016-01-15 10:06:27 UTC (rev 195106)
+++ releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Authentication/AuthenticationManager.h        2016-01-15 10:30:27 UTC (rev 195107)
</span><span class="lines">@@ -52,6 +52,10 @@
</span><span class="cx">
</span><span class="cx"> static const char* supplementName();
</span><span class="cx">
</span><ins>+#if USE(NETWORK_SESSION)
+ typedef std::function<void(AuthenticationChallengeDisposition, const WebCore::Credential&)> ChallengeCompletionHandler;
+ void didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler);
+#endif
</ins><span class="cx"> // Called for resources in the WebProcess (NetworkProcess disabled)
</span><span class="cx"> void didReceiveAuthenticationChallenge(WebFrame*, const WebCore::AuthenticationChallenge&);
</span><span class="cx"> // Called for resources in the NetworkProcess (NetworkProcess enabled)
</span><span class="lines">@@ -68,12 +72,19 @@
</span><span class="cx"> uint64_t outstandingAuthenticationChallengeCount() const { return m_challenges.size(); }
</span><span class="cx">
</span><span class="cx"> private:
</span><ins>+ struct Challenge {
+ WebCore::AuthenticationChallenge challenge;
+#if USE(NETWORK_SESSION)
+ ChallengeCompletionHandler completionHandler;
+#endif
+ };
+
</ins><span class="cx"> // IPC::MessageReceiver
</span><span class="cx"> virtual void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
</span><span class="cx">
</span><span class="cx"> bool tryUseCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const WebCore::CertificateInfo&);
</span><span class="cx">
</span><del>- uint64_t addChallengeToChallengeMap(const WebCore::AuthenticationChallenge&);
</del><ins>+ uint64_t addChallengeToChallengeMap(const Challenge&);
</ins><span class="cx"> bool shouldCoalesceChallenge(uint64_t challengeID, const WebCore::AuthenticationChallenge&) const;
</span><span class="cx">
</span><span class="cx"> void useCredentialForSingleChallenge(uint64_t challengeID, const WebCore::Credential&, const WebCore::CertificateInfo&);
</span><span class="lines">@@ -86,8 +97,7 @@
</span><span class="cx">
</span><span class="cx"> ChildProcess* m_process;
</span><span class="cx">
</span><del>- typedef HashMap<uint64_t, WebCore::AuthenticationChallenge> AuthenticationChallengeMap;
- AuthenticationChallengeMap m_challenges;
</del><ins>+ HashMap<uint64_t, Challenge> m_challenges;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebKit2SharedDownloadsDownloadcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Downloads/Download.cpp (195106 => 195107)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Downloads/Download.cpp        2016-01-15 10:06:27 UTC (rev 195106)
+++ releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Downloads/Download.cpp        2016-01-15 10:30:27 UTC (rev 195107)
</span><span class="lines">@@ -29,12 +29,16 @@
</span><span class="cx"> #include "AuthenticationManager.h"
</span><span class="cx"> #include "Connection.h"
</span><span class="cx"> #include "DataReference.h"
</span><del>-#include "DownloadAuthenticationClient.h"
</del><span class="cx"> #include "DownloadProxyMessages.h"
</span><span class="cx"> #include "DownloadManager.h"
</span><span class="cx"> #include "SandboxExtension.h"
</span><span class="cx"> #include "WebCoreArgumentCoders.h"
</span><ins>+#include <WebCore/NotImplemented.h>
</ins><span class="cx">
</span><ins>+#if !USE(NETWORK_SESSION)
+#include "DownloadAuthenticationClient.h"
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -63,7 +67,11 @@
</span><span class="cx">
</span><span class="cx"> void Download::didReceiveAuthenticationChallenge(const AuthenticationChallenge& authenticationChallenge)
</span><span class="cx"> {
</span><ins>+#if USE(NETWORK_SESSION)
+ notImplemented();
+#else
</ins><span class="cx"> m_downloadManager.downloadsAuthenticationManager().didReceiveAuthenticationChallenge(this, authenticationChallenge);
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Download::didReceiveResponse(const ResourceResponse& response)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebKit2SharedDownloadsDownloadAuthenticationClientcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.cpp (195106 => 195107)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.cpp        2016-01-15 10:06:27 UTC (rev 195106)
+++ releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.cpp        2016-01-15 10:30:27 UTC (rev 195107)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "DownloadAuthenticationClient.h"
</span><span class="cx">
</span><ins>+#if !USE(NETWORK_SESSION)
+
</ins><span class="cx"> #include "Download.h"
</span><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="lines">@@ -64,3 +66,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebKit2SharedDownloadsDownloadAuthenticationClienth"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.h (195106 => 195107)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.h        2016-01-15 10:06:27 UTC (rev 195106)
+++ releases/WebKitGTK/webkit-2.10/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.h        2016-01-15 10:30:27 UTC (rev 195107)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> #ifndef DownloadAuthenticationClient_h
</span><span class="cx"> #define DownloadAuthenticationClient_h
</span><span class="cx">
</span><ins>+#if !USE(NETWORK_SESSION)
+
</ins><span class="cx"> #include <WebCore/AuthenticationClient.h>
</span><span class="cx"> #include <wtf/PassRefPtr.h>
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="lines">@@ -65,4 +67,6 @@
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span><span class="cx">
</span><ins>+#endif // !USE(NETWORK_SESSION)
+
</ins><span class="cx"> #endif // DownloadAuthenticationClient_h
</span></span></pre>
</div>
</div>
</body>
</html>