WebKit Bugzilla
Attachment 350068 Details for
Bug 189719
: Simply authentication code even more!
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189719-20180918153923.patch (text/plain), 31.71 KB, created by
Alex Christensen
on 2018-09-18 15:39:24 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2018-09-18 15:39:24 PDT
Size:
31.71 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 236157) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,58 @@ >+2018-09-18 Alex Christensen <achristensen@webkit.org> >+ >+ Simply authentication code even more! >+ https://bugs.webkit.org/show_bug.cgi?id=189719 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Just when you thought it couldn't get simpler and more elegant, it can! >+ >+ * NetworkProcess/Downloads/Download.cpp: >+ * NetworkProcess/NetworkCORSPreflightChecker.cpp: >+ * NetworkProcess/NetworkLoad.cpp: >+ * NetworkProcess/PingLoad.cpp: >+ * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: >+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm: >+ * Shared/Authentication/AuthenticationChallengeDisposition.h: Added. >+ * Shared/Authentication/AuthenticationManager.cpp: >+ (WebKit::AuthenticationManager::completeAuthenticationChallenge): >+ (WebKit::AuthenticationManager::useCredentialForChallenge): Deleted. >+ (WebKit::AuthenticationManager::useCredentialForSingleChallenge): Deleted. >+ (WebKit::AuthenticationManager::continueWithoutCredentialForChallenge): Deleted. >+ (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge): Deleted. >+ (WebKit::AuthenticationManager::cancelChallenge): Deleted. >+ (WebKit::AuthenticationManager::cancelSingleChallenge): Deleted. >+ (WebKit::AuthenticationManager::performDefaultHandling): Deleted. >+ (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge): Deleted. >+ (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinue): Deleted. >+ (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge): Deleted. >+ * Shared/Authentication/AuthenticationManager.h: >+ * Shared/Authentication/AuthenticationManager.messages.in: >+ * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm: >+ (WebKit::AuthenticationManager::initializeConnection): >+ * UIProcess/API/C/WKAuthenticationDecisionListener.cpp: >+ (WKAuthenticationDecisionListenerUseCredential): >+ * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm: >+ (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]): >+ * UIProcess/API/glib/WebKitAuthenticationRequest.cpp: >+ (webkit_authentication_request_authenticate): >+ * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: >+ (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy): >+ * UIProcess/Authentication/AuthenticationDecisionListener.cpp: >+ (WebKit::AuthenticationDecisionListener::AuthenticationDecisionListener): >+ (WebKit::AuthenticationDecisionListener::~AuthenticationDecisionListener): >+ (WebKit::AuthenticationDecisionListener::useCredential): >+ (WebKit::AuthenticationDecisionListener::cancel): >+ (WebKit::AuthenticationDecisionListener::performDefaultHandling): >+ (WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue): >+ * UIProcess/Authentication/AuthenticationDecisionListener.h: >+ (WebKit::AuthenticationDecisionListener::create): >+ * UIProcess/Cocoa/DownloadClient.mm: >+ (WebKit::DownloadClient::didReceiveAuthenticationChallenge): >+ * UIProcess/Cocoa/NavigationState.mm: >+ (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): >+ * WebKit.xcodeproj/project.pbxproj: >+ > 2018-09-18 Chris Dumez <cdumez@apple.com> > > [iOS] Crash under WebPageProxy::navigationGestureSnapshotWasRemoved() >Index: Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp (revision 236150) >+++ Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp (working copy) >@@ -26,6 +26,7 @@ > #include "config.h" > #include "NetworkCORSPreflightChecker.h" > >+#include "AuthenticationChallengeDisposition.h" > #include "AuthenticationManager.h" > #include "Logging.h" > #include "NetworkLoadParameters.h" >Index: Source/WebKit/NetworkProcess/NetworkLoad.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkLoad.cpp (revision 236150) >+++ Source/WebKit/NetworkProcess/NetworkLoad.cpp (working copy) >@@ -26,6 +26,7 @@ > #include "config.h" > #include "NetworkLoad.h" > >+#include "AuthenticationChallengeDisposition.h" > #include "AuthenticationManager.h" > #include "DownloadProxyMessages.h" > #include "NetworkProcess.h" >Index: Source/WebKit/NetworkProcess/PingLoad.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/PingLoad.cpp (revision 236150) >+++ Source/WebKit/NetworkProcess/PingLoad.cpp (working copy) >@@ -26,6 +26,7 @@ > #include "config.h" > #include "PingLoad.h" > >+#include "AuthenticationChallengeDisposition.h" > #include "AuthenticationManager.h" > #include "Logging.h" > #include "NetworkLoadChecker.h" >Index: Source/WebKit/NetworkProcess/Downloads/Download.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/Downloads/Download.cpp (revision 236150) >+++ Source/WebKit/NetworkProcess/Downloads/Download.cpp (working copy) >@@ -26,6 +26,7 @@ > #include "config.h" > #include "Download.h" > >+#include "AuthenticationChallengeDisposition.h" > #include "AuthenticationManager.h" > #include "Connection.h" > #include "DataReference.h" >Index: Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm >=================================================================== >--- Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (revision 236150) >+++ Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (working copy) >@@ -26,6 +26,7 @@ > #import "config.h" > #import "NetworkDataTaskCocoa.h" > >+#import "AuthenticationChallengeDisposition.h" > #import "AuthenticationManager.h" > #import "Download.h" > #import "DownloadProxyMessages.h" >Index: Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm >=================================================================== >--- Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (revision 236153) >+++ Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (working copy) >@@ -26,6 +26,7 @@ > #import "config.h" > #import "NetworkSessionCocoa.h" > >+#import "AuthenticationChallengeDisposition.h" > #import "AuthenticationManager.h" > #import "DataReference.h" > #import "Download.h" >Index: Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp (revision 236150) >+++ Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp (working copy) >@@ -26,6 +26,7 @@ > #include "config.h" > #include "NetworkDataTaskSoup.h" > >+#include "AuthenticationChallengeDisposition.h" > #include "AuthenticationManager.h" > #include "DataReference.h" > #include "Download.h" >Index: Source/WebKit/Shared/Authentication/AuthenticationChallengeDisposition.h >=================================================================== >--- Source/WebKit/Shared/Authentication/AuthenticationChallengeDisposition.h (nonexistent) >+++ Source/WebKit/Shared/Authentication/AuthenticationChallengeDisposition.h (working copy) >@@ -0,0 +1,53 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <wtf/EnumTraits.h> >+ >+namespace WebKit { >+ >+enum class AuthenticationChallengeDisposition { >+ UseCredential, >+ PerformDefaultHandling, >+ Cancel, >+ RejectProtectionSpaceAndContinue >+}; >+ >+} // namespace WebKit >+ >+namespace WTF { >+ >+template<> struct EnumTraits<WebKit::AuthenticationChallengeDisposition> { >+ using values = EnumValues< >+ WebKit::AuthenticationChallengeDisposition, >+ WebKit::AuthenticationChallengeDisposition::UseCredential, >+ WebKit::AuthenticationChallengeDisposition::PerformDefaultHandling, >+ WebKit::AuthenticationChallengeDisposition::Cancel, >+ WebKit::AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue >+ >; >+}; >+ >+} // namespace WTF >Index: Source/WebKit/Shared/Authentication/AuthenticationManager.cpp >=================================================================== >--- Source/WebKit/Shared/Authentication/AuthenticationManager.cpp (revision 236153) >+++ Source/WebKit/Shared/Authentication/AuthenticationManager.cpp (working copy) >@@ -134,101 +134,15 @@ void AuthenticationManager::didReceiveAu > download.send(Messages::DownloadProxy::DidReceiveAuthenticationChallenge(authenticationChallenge, challengeID)); > } > >-void AuthenticationManager::useCredentialForChallenge(uint64_t challengeID, const Credential& credential) >+void AuthenticationManager::completeAuthenticationChallenge(uint64_t challengeID, AuthenticationChallengeDisposition disposition, WebCore::Credential&& credential) > { > ASSERT(RunLoop::isMain()); > >- for (auto& coalescedChallengeID : coalesceChallengesMatching(challengeID)) >- useCredentialForSingleChallenge(coalescedChallengeID, credential); >-} >- >-void AuthenticationManager::useCredentialForSingleChallenge(uint64_t challengeID, const Credential& credential) >-{ >- auto challenge = m_challenges.take(challengeID); >- ASSERT(!challenge.challenge.isNull()); >- >- auto completionHandler = WTFMove(challenge.completionHandler); >- >- if (completionHandler) >- completionHandler(AuthenticationChallengeDisposition::UseCredential, credential); >- else >- ASSERT_NOT_REACHED(); >-} >- >-void AuthenticationManager::continueWithoutCredentialForChallenge(uint64_t challengeID) >-{ >- ASSERT(RunLoop::isMain()); >- >- for (auto& coalescedChallengeID : coalesceChallengesMatching(challengeID)) >- continueWithoutCredentialForSingleChallenge(coalescedChallengeID); >-} >- >-void AuthenticationManager::continueWithoutCredentialForSingleChallenge(uint64_t challengeID) >-{ >- auto challenge = m_challenges.take(challengeID); >- ASSERT(!challenge.challenge.isNull()); >- >- if (challenge.completionHandler) >- challenge.completionHandler(AuthenticationChallengeDisposition::UseCredential, Credential()); >- else >- ASSERT_NOT_REACHED(); >-} >- >-void AuthenticationManager::cancelChallenge(uint64_t challengeID) >-{ >- ASSERT(RunLoop::isMain()); >- >- for (auto& coalescedChallengeID : coalesceChallengesMatching(challengeID)) >- cancelSingleChallenge(coalescedChallengeID); >-} >- >-void AuthenticationManager::cancelSingleChallenge(uint64_t challengeID) >-{ >- auto challenge = m_challenges.take(challengeID); >- ASSERT(!challenge.challenge.isNull()); >- >- if (challenge.completionHandler) >- challenge.completionHandler(AuthenticationChallengeDisposition::Cancel, Credential()); >- else >- ASSERT_NOT_REACHED(); >-} >- >-void AuthenticationManager::performDefaultHandling(uint64_t challengeID) >-{ >- ASSERT(RunLoop::isMain()); >- >- for (auto& coalescedChallengeID : coalesceChallengesMatching(challengeID)) >- performDefaultHandlingForSingleChallenge(coalescedChallengeID); >-} >- >-void AuthenticationManager::performDefaultHandlingForSingleChallenge(uint64_t challengeID) >-{ >- auto challenge = m_challenges.take(challengeID); >- ASSERT(!challenge.challenge.isNull()); >- >- if (challenge.completionHandler) >- challenge.completionHandler(AuthenticationChallengeDisposition::PerformDefaultHandling, Credential()); >- else >- ASSERT_NOT_REACHED(); >-} >- >-void AuthenticationManager::rejectProtectionSpaceAndContinue(uint64_t challengeID) >-{ >- ASSERT(RunLoop::isMain()); >- >- for (auto& coalescedChallengeID : coalesceChallengesMatching(challengeID)) >- rejectProtectionSpaceAndContinueForSingleChallenge(coalescedChallengeID); >-} >- >-void AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge(uint64_t challengeID) >-{ >- auto challenge = m_challenges.take(challengeID); >- ASSERT(!challenge.challenge.isNull()); >- >- if (challenge.completionHandler) >- challenge.completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue, { }); >- else >- ASSERT_NOT_REACHED(); >+ for (auto& coalescedChallengeID : coalesceChallengesMatching(challengeID)) { >+ auto challenge = m_challenges.take(coalescedChallengeID); >+ ASSERT(!challenge.challenge.isNull()); >+ challenge.completionHandler(disposition, credential); >+ } > } > > } // namespace WebKit >Index: Source/WebKit/Shared/Authentication/AuthenticationManager.h >=================================================================== >--- Source/WebKit/Shared/Authentication/AuthenticationManager.h (revision 236153) >+++ Source/WebKit/Shared/Authentication/AuthenticationManager.h (working copy) >@@ -51,12 +51,7 @@ class Download; > class DownloadID; > class WebFrame; > >-enum class AuthenticationChallengeDisposition { >- UseCredential, >- PerformDefaultHandling, >- Cancel, >- RejectProtectionSpaceAndContinue >-}; >+enum class AuthenticationChallengeDisposition; > using ChallengeCompletionHandler = CompletionHandler<void(AuthenticationChallengeDisposition, const WebCore::Credential&)>; > > class AuthenticationManager : public NetworkProcessSupplement, public IPC::MessageReceiver, public CanMakeWeakPtr<AuthenticationManager> { >@@ -69,11 +64,7 @@ public: > void didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&); > void didReceiveAuthenticationChallenge(IPC::MessageSender& download, const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&); > >- void useCredentialForChallenge(uint64_t challengeID, const WebCore::Credential&); >- void continueWithoutCredentialForChallenge(uint64_t challengeID); >- void cancelChallenge(uint64_t challengeID); >- void performDefaultHandling(uint64_t challengeID); >- void rejectProtectionSpaceAndContinue(uint64_t challengeID); >+ void completeAuthenticationChallenge(uint64_t challengeID, AuthenticationChallengeDisposition, WebCore::Credential&&); > > uint64_t outstandingAuthenticationChallengeCount() const { return m_challenges.size(); } > >@@ -95,12 +86,6 @@ private: > uint64_t addChallengeToChallengeMap(Challenge&&); > bool shouldCoalesceChallenge(uint64_t pageID, uint64_t challengeID, const WebCore::AuthenticationChallenge&) const; > >- void useCredentialForSingleChallenge(uint64_t challengeID, const WebCore::Credential&); >- void continueWithoutCredentialForSingleChallenge(uint64_t challengeID); >- void cancelSingleChallenge(uint64_t challengeID); >- void performDefaultHandlingForSingleChallenge(uint64_t challengeID); >- void rejectProtectionSpaceAndContinueForSingleChallenge(uint64_t challengeID); >- > Vector<uint64_t> coalesceChallengesMatching(uint64_t challengeID) const; > > ChildProcess& m_process; >Index: Source/WebKit/Shared/Authentication/AuthenticationManager.messages.in >=================================================================== >--- Source/WebKit/Shared/Authentication/AuthenticationManager.messages.in (revision 236150) >+++ Source/WebKit/Shared/Authentication/AuthenticationManager.messages.in (working copy) >@@ -21,9 +21,5 @@ > # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > messages -> AuthenticationManager { >- void UseCredentialForChallenge(uint64_t challengeID, WebCore::Credential credential); >- void ContinueWithoutCredentialForChallenge(uint64_t challengeID); >- void CancelChallenge(uint64_t challengeID); >- void PerformDefaultHandling(uint64_t challengeID); >- void RejectProtectionSpaceAndContinue(uint64_t challengeID); >+ void CompleteAuthenticationChallenge(uint64_t challengeID, enum WebKit::AuthenticationChallengeDisposition disposition, WebCore::Credential credential); > } >Index: Source/WebKit/Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm >=================================================================== >--- Source/WebKit/Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm (revision 236150) >+++ Source/WebKit/Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm (working copy) >@@ -28,6 +28,7 @@ > > #if HAVE(SEC_KEY_PROXY) > >+#import "AuthenticationChallengeDisposition.h" > #import "ClientCertificateAuthenticationXPCConstants.h" > #import "Connection.h" > #import <pal/spi/cocoa/NSXPCConnectionSPI.h> >@@ -96,7 +97,7 @@ void AuthenticationManager::initializeCo > if (persistence > static_cast<uint64_t>(NSURLCredentialPersistenceSynchronizable)) > return; > >- weakThis->useCredentialForChallenge(challengeID, WebCore::Credential(adoptNS([[NSURLCredential alloc] initWithIdentity:identity.get() certificates:certificates persistence:(NSURLCredentialPersistence)persistence]).get())); >+ weakThis->completeAuthenticationChallenge(challengeID, AuthenticationChallengeDisposition::UseCredential, WebCore::Credential(adoptNS([[NSURLCredential alloc] initWithIdentity:identity.get() certificates:certificates persistence:(NSURLCredentialPersistence)persistence]).get())); > }); > } > >Index: Source/WebKit/UIProcess/API/C/WKAuthenticationDecisionListener.cpp >=================================================================== >--- Source/WebKit/UIProcess/API/C/WKAuthenticationDecisionListener.cpp (revision 236153) >+++ Source/WebKit/UIProcess/API/C/WKAuthenticationDecisionListener.cpp (working copy) >@@ -39,10 +39,7 @@ WKTypeID WKAuthenticationDecisionListene > > void WKAuthenticationDecisionListenerUseCredential(WKAuthenticationDecisionListenerRef authenticationListener, WKCredentialRef credential) > { >- if (credential) >- toImpl(authenticationListener)->useCredential(toImpl(credential)->credential()); >- else >- toImpl(authenticationListener)->useCredential(std::nullopt); >+ toImpl(authenticationListener)->useCredential(credential ? toImpl(credential)->credential() : WebCore::Credential()); > } > > void WKAuthenticationDecisionListenerCancel(WKAuthenticationDecisionListenerRef authenticationListener) >Index: Source/WebKit/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm >=================================================================== >--- Source/WebKit/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm (revision 236153) >+++ Source/WebKit/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm (working copy) >@@ -77,7 +77,7 @@ - (void)continueWithoutCredentialForAuth > { > checkChallenge(challenge); > WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy; >- webChallenge.listener().useCredential(std::nullopt); >+ webChallenge.listener().useCredential({ }); > } > > - (void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge >Index: Source/WebKit/UIProcess/API/glib/WebKitAuthenticationRequest.cpp >=================================================================== >--- Source/WebKit/UIProcess/API/glib/WebKitAuthenticationRequest.cpp (revision 236153) >+++ Source/WebKit/UIProcess/API/glib/WebKitAuthenticationRequest.cpp (working copy) >@@ -315,10 +315,7 @@ void webkit_authentication_request_authe > { > g_return_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request)); > >- if (credential) >- request->priv->authenticationChallenge->listener().useCredential(webkitCredentialGetCredential(credential)); >- else >- request->priv->authenticationChallenge->listener().useCredential(std::nullopt); >+ request->priv->authenticationChallenge->listener().useCredential(credential ? webkitCredentialGetCredential(credential) : WebCore::Credential()); > > request->priv->handledRequest = true; > } >Index: Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp (revision 236153) >+++ Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp (working copy) >@@ -44,33 +44,15 @@ namespace WebKit { > > AuthenticationChallengeProxy::AuthenticationChallengeProxy(WebCore::AuthenticationChallenge&& authenticationChallenge, uint64_t challengeID, Ref<IPC::Connection>&& connection, WeakPtr<SecKeyProxyStore>&& secKeyProxyStore) > : m_coreAuthenticationChallenge(WTFMove(authenticationChallenge)) >- , m_listener(AuthenticationDecisionListener::create([challengeID, connection = WTFMove(connection), secKeyProxyStore = WTFMove(secKeyProxyStore)](AuthenticationChallengeDisposition disposition, std::optional<WebCore::Credential>&& credential) { >- switch (disposition) { >- case AuthenticationChallengeDisposition::Cancel: >- connection->send(Messages::AuthenticationManager::CancelChallenge(challengeID), 0); >- break; >- case AuthenticationChallengeDisposition::PerformDefaultHandling: >- connection->send(Messages::AuthenticationManager::PerformDefaultHandling(challengeID), 0); >- break; >- case AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue: >- connection->send(Messages::AuthenticationManager::RejectProtectionSpaceAndContinue(challengeID), 0); >- break; >- case AuthenticationChallengeDisposition::UseCredential: >- if (!credential) { >- connection->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(challengeID), 0); >- break; >- } >- >+ , m_listener(AuthenticationDecisionListener::create([challengeID, connection = WTFMove(connection), secKeyProxyStore = WTFMove(secKeyProxyStore)](AuthenticationChallengeDisposition disposition, const WebCore::Credential& credential) { > #if HAVE(SEC_KEY_PROXY) >- if (secKeyProxyStore) { >- secKeyProxyStore->initialize(*credential); >- sendClientCertificateCredentialOverXpc(connection, *secKeyProxyStore, challengeID, *credential); >- break; >- } >-#endif >- >- connection->send(Messages::AuthenticationManager::UseCredentialForChallenge(challengeID, *credential), 0); >+ if (secKeyProxyStore) { >+ secKeyProxyStore->initialize(credential); >+ sendClientCertificateCredentialOverXpc(connection, *secKeyProxyStore, challengeID, credential); >+ return; > } >+#endif >+ connection->send(Messages::AuthenticationManager::CompleteAuthenticationChallenge(challengeID, disposition, credential), 0); > })) > { > } >Index: Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.cpp >=================================================================== >--- Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.cpp (revision 236153) >+++ Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.cpp (working copy) >@@ -26,6 +26,7 @@ > #include "config.h" > #include "AuthenticationDecisionListener.h" > >+#include "AuthenticationChallengeDisposition.h" > #include "AuthenticationChallengeProxy.h" > #include "AuthenticationManager.h" > #include "AuthenticationManagerMessages.h" >@@ -36,7 +37,7 @@ > > namespace WebKit { > >-AuthenticationDecisionListener::AuthenticationDecisionListener(CompletionHandler<void(AuthenticationChallengeDisposition, std::optional<WebCore::Credential>&&)>&& completionHandler) >+AuthenticationDecisionListener::AuthenticationDecisionListener(CompletionHandler<void(AuthenticationChallengeDisposition, const WebCore::Credential&)>&& completionHandler) > : m_completionHandler(WTFMove(completionHandler)) > { > } >@@ -44,31 +45,31 @@ AuthenticationDecisionListener::Authenti > AuthenticationDecisionListener::~AuthenticationDecisionListener() > { > if (m_completionHandler) >- m_completionHandler(AuthenticationChallengeDisposition::Cancel, std::nullopt); >+ m_completionHandler(AuthenticationChallengeDisposition::Cancel, { }); > } > >-void AuthenticationDecisionListener::useCredential(std::optional<WebCore::Credential>&& credential) >+void AuthenticationDecisionListener::useCredential(const WebCore::Credential& credential) > { > if (m_completionHandler) >- m_completionHandler(AuthenticationChallengeDisposition::UseCredential, WTFMove(credential)); >+ m_completionHandler(AuthenticationChallengeDisposition::UseCredential, credential); > } > > void AuthenticationDecisionListener::cancel() > { > if (m_completionHandler) >- m_completionHandler(AuthenticationChallengeDisposition::Cancel, std::nullopt); >+ m_completionHandler(AuthenticationChallengeDisposition::Cancel, { }); > } > > void AuthenticationDecisionListener::performDefaultHandling() > { > if (m_completionHandler) >- m_completionHandler(AuthenticationChallengeDisposition::PerformDefaultHandling, std::nullopt); >+ m_completionHandler(AuthenticationChallengeDisposition::PerformDefaultHandling, { }); > } > > void AuthenticationDecisionListener::rejectProtectionSpaceAndContinue() > { > if (m_completionHandler) >- m_completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue, std::nullopt); >+ m_completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue, { }); > } > > } // namespace WebKit >Index: Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.h >=================================================================== >--- Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.h (revision 236153) >+++ Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.h (working copy) >@@ -37,21 +37,21 @@ class AuthenticationChallengeProxy; > > class AuthenticationDecisionListener : public API::ObjectImpl<API::Object::Type::AuthenticationDecisionListener> { > public: >- static Ref<AuthenticationDecisionListener> create(CompletionHandler<void(AuthenticationChallengeDisposition, std::optional<WebCore::Credential>&&)>&& completionHandler) >+ static Ref<AuthenticationDecisionListener> create(CompletionHandler<void(AuthenticationChallengeDisposition, const WebCore::Credential&)>&& completionHandler) > { > return adoptRef(*new AuthenticationDecisionListener(WTFMove(completionHandler))); > } > ~AuthenticationDecisionListener(); > >- void useCredential(std::optional<WebCore::Credential>&&); >+ void useCredential(const WebCore::Credential&); > void cancel(); > void performDefaultHandling(); > void rejectProtectionSpaceAndContinue(); > > private: >- explicit AuthenticationDecisionListener(CompletionHandler<void(AuthenticationChallengeDisposition, std::optional<WebCore::Credential>&&)>&&); >+ explicit AuthenticationDecisionListener(CompletionHandler<void(AuthenticationChallengeDisposition, const WebCore::Credential&)>&&); > >- CompletionHandler<void(AuthenticationChallengeDisposition, std::optional<WebCore::Credential>&&)> m_completionHandler; >+ CompletionHandler<void(AuthenticationChallengeDisposition, const WebCore::Credential&)> m_completionHandler; > }; > > } // namespace WebKit >Index: Source/WebKit/UIProcess/Cocoa/DownloadClient.mm >=================================================================== >--- Source/WebKit/UIProcess/Cocoa/DownloadClient.mm (revision 236153) >+++ Source/WebKit/UIProcess/Cocoa/DownloadClient.mm (working copy) >@@ -132,10 +132,7 @@ void DownloadClient::didReceiveAuthentic > checker->didCallCompletionHandler(); > switch (disposition) { > case NSURLSessionAuthChallengeUseCredential: >- if (credential) >- authenticationChallenge->listener().useCredential(WebCore::Credential(credential)); >- else >- authenticationChallenge->listener().useCredential(std::nullopt); >+ authenticationChallenge->listener().useCredential(credential ? WebCore::Credential(credential) : WebCore::Credential()); > break; > case NSURLSessionAuthChallengePerformDefaultHandling: > authenticationChallenge->listener().performDefaultHandling(); >Index: Source/WebKit/UIProcess/Cocoa/NavigationState.mm >=================================================================== >--- Source/WebKit/UIProcess/Cocoa/NavigationState.mm (revision 236154) >+++ Source/WebKit/UIProcess/Cocoa/NavigationState.mm (working copy) >@@ -866,10 +866,7 @@ void NavigationState::NavigationClient:: > > switch (disposition) { > case NSURLSessionAuthChallengeUseCredential: >- if (credential) >- challenge->listener().useCredential(Credential(credential)); >- else >- challenge->listener().useCredential(std::nullopt); >+ challenge->listener().useCredential(credential ? Credential(credential) : Credential()); > break; > case NSURLSessionAuthChallengePerformDefaultHandling: > challenge->listener().performDefaultHandling(); >Index: Source/WebKit/WebKit.xcodeproj/project.pbxproj >=================================================================== >--- Source/WebKit/WebKit.xcodeproj/project.pbxproj (revision 236152) >+++ Source/WebKit/WebKit.xcodeproj/project.pbxproj (working copy) >@@ -3443,6 +3443,7 @@ > 5C9E56811DF7F05500C9EE33 /* WKWebsitePolicies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebsitePolicies.h; sourceTree = "<group>"; }; > 5CA98549210BEB5A0057EB6B /* SafeBrowsingResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SafeBrowsingResult.h; sourceTree = "<group>"; }; > 5CA9854B210BEB730057EB6B /* SafeBrowsingResultCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SafeBrowsingResultCocoa.mm; sourceTree = "<group>"; }; >+ 5CADDE0D2151AA010067D309 /* AuthenticationChallengeDisposition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AuthenticationChallengeDisposition.h; path = Authentication/AuthenticationChallengeDisposition.h; sourceTree = "<group>"; }; > 5CAFDE422130843500B1F7E1 /* _WKInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKInspector.h; sourceTree = "<group>"; }; > 5CAFDE432130843600B1F7E1 /* _WKInspector.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKInspector.mm; sourceTree = "<group>"; }; > 5CAFDE442130843600B1F7E1 /* _WKInspectorInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKInspectorInternal.h; sourceTree = "<group>"; }; >@@ -6595,6 +6596,7 @@ > isa = PBXGroup; > children = ( > 57B4B45C20B5048B00D4AD79 /* cocoa */, >+ 5CADDE0D2151AA010067D309 /* AuthenticationChallengeDisposition.h */, > 518E8EF316B2091C00E91429 /* AuthenticationManager.cpp */, > 518E8EF416B2091C00E91429 /* AuthenticationManager.h */, > 518E8EF516B2091C00E91429 /* AuthenticationManager.messages.in */,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189719
:
350066
|
350068
|
350148
|
350398