WebKit Bugzilla
Attachment 349932 Details for
Bug 189668
: Clean up AuthenticationChallengeProxy
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189668-20180917132926.patch (text/plain), 41.33 KB, created by
Alex Christensen
on 2018-09-17 13:29:27 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2018-09-17 13:29:27 PDT
Size:
41.33 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 236078) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,73 @@ >+2018-09-17 Alex Christensen <achristensen@webkit.org> >+ >+ Clean up AuthenticationChallengeProxy >+ https://bugs.webkit.org/show_bug.cgi?id=189668 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ At its core, it's a CompletionHandler with some information. >+ Make it more elegant and simple with no change in behavior and reduce the complexity of this security-sensitive object. >+ >+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm: >+ (toNSURLSessionAuthChallengeDisposition): >+ * Shared/Authentication/AuthenticationManager.cpp: >+ (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge): >+ * Shared/Authentication/AuthenticationManager.h: >+ * UIProcess/API/C/WKAuthenticationChallenge.cpp: >+ (WKAuthenticationChallengeGetDecisionListener): >+ (WKAuthenticationChallengeGetProtectionSpace): >+ (WKAuthenticationChallengeGetProposedCredential): >+ (WKAuthenticationChallengeGetPreviousFailureCount): >+ * UIProcess/API/C/WKPage.cpp: >+ (WKPageSetPageNavigationClient): >+ * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm: >+ (-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]): >+ (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]): >+ (-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]): >+ (-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]): >+ (-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]): >+ * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: >+ (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy): >+ (WebKit::AuthenticationChallengeProxy::~AuthenticationChallengeProxy): Deleted. >+ (WebKit::AuthenticationChallengeProxy::useCredential): Deleted. >+ (WebKit::AuthenticationChallengeProxy::cancel): Deleted. >+ (WebKit::AuthenticationChallengeProxy::performDefaultHandling): Deleted. >+ (WebKit::AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue): Deleted. >+ (WebKit::AuthenticationChallengeProxy::proposedCredential const): Deleted. >+ (WebKit::AuthenticationChallengeProxy::protectionSpace const): Deleted. >+ (WebKit::AuthenticationChallengeProxy::setSecKeyProxyStore): Deleted. >+ * UIProcess/Authentication/AuthenticationChallengeProxy.h: >+ (WebKit::AuthenticationChallengeProxy::create): >+ (WebKit::AuthenticationChallengeProxy::listener const): >+ (WebKit::AuthenticationChallengeProxy::previousFailureCount const): Deleted. >+ * UIProcess/Authentication/AuthenticationDecisionListener.cpp: >+ (WebKit::AuthenticationDecisionListener::AuthenticationDecisionListener): >+ (WebKit::AuthenticationDecisionListener::~AuthenticationDecisionListener): >+ (WebKit::AuthenticationDecisionListener::useCredential): >+ (WebKit::AuthenticationDecisionListener::cancel): >+ (WebKit::AuthenticationDecisionListener::performDefaultHandling): >+ (WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue): >+ (WebKit::AuthenticationDecisionListener::detachChallenge): Deleted. >+ * UIProcess/Authentication/AuthenticationDecisionListener.h: >+ (WebKit::AuthenticationDecisionListener::create): >+ * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm: >+ (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc): >+ (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const): Deleted. >+ * UIProcess/Cocoa/DownloadClient.mm: >+ (WebKit::DownloadClient::didReceiveAuthenticationChallenge): >+ * UIProcess/Cocoa/NavigationState.mm: >+ (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): >+ * UIProcess/Downloads/DownloadProxy.cpp: >+ (WebKit::DownloadProxy::didReceiveAuthenticationChallenge): >+ * UIProcess/Network/NetworkProcessProxy.cpp: >+ (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge): >+ * UIProcess/ServiceWorkerProcessProxy.cpp: >+ (WebKit::ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge): >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::secKeyProxyStore): >+ (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy): >+ * UIProcess/WebPageProxy.h: >+ > 2018-09-17 Alex Christensen <achristensen@webkit.org> > > Expose XPCServiceMain in a WebProcess header rather than WKProcessPool >Index: Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm >=================================================================== >--- Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (revision 236078) >+++ Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (working copy) >@@ -78,7 +78,7 @@ static NSURLSessionAuthChallengeDisposit > return NSURLSessionAuthChallengePerformDefaultHandling; > case WebKit::AuthenticationChallengeDisposition::Cancel: > return NSURLSessionAuthChallengeCancelAuthenticationChallenge; >- case WebKit::AuthenticationChallengeDisposition::RejectProtectionSpace: >+ case WebKit::AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue: > return NSURLSessionAuthChallengeRejectProtectionSpace; > } > } >Index: Source/WebKit/Shared/Authentication/AuthenticationManager.cpp >=================================================================== >--- Source/WebKit/Shared/Authentication/AuthenticationManager.cpp (revision 236078) >+++ Source/WebKit/Shared/Authentication/AuthenticationManager.cpp (working copy) >@@ -226,7 +226,7 @@ void AuthenticationManager::rejectProtec > ASSERT(!challenge.challenge.isNull()); > > if (challenge.completionHandler) >- challenge.completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpace, Credential()); >+ challenge.completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue, { }); > else > ASSERT_NOT_REACHED(); > } >Index: Source/WebKit/Shared/Authentication/AuthenticationManager.h >=================================================================== >--- Source/WebKit/Shared/Authentication/AuthenticationManager.h (revision 236078) >+++ Source/WebKit/Shared/Authentication/AuthenticationManager.h (working copy) >@@ -55,7 +55,7 @@ enum class AuthenticationChallengeDispos > UseCredential, > PerformDefaultHandling, > Cancel, >- RejectProtectionSpace >+ RejectProtectionSpaceAndContinue > }; > using ChallengeCompletionHandler = CompletionHandler<void(AuthenticationChallengeDisposition, const WebCore::Credential&)>; > >Index: Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp (revision 236078) >+++ Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp (working copy) >@@ -29,6 +29,7 @@ > #if ENABLE(SERVICE_WORKER) > > #include "AuthenticationChallengeProxy.h" >+#include "AuthenticationDecisionListener.h" > #include "WebCredential.h" > #include "WebPageGroup.h" > #include "WebPreferencesStore.h" >@@ -97,11 +98,11 @@ void ServiceWorkerProcessProxy::didRecei > auto& protectionSpace = challenge->core().protectionSpace(); > if (protectionSpace.authenticationScheme() == WebCore::ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested && processPool().allowsAnySSLCertificateForServiceWorker()) { > auto credential = WebCore::Credential("accept server trust"_s, emptyString(), WebCore::CredentialPersistenceNone); >- challenge->useCredential(WebCredential::create(credential).ptr()); >+ challenge->listener().useCredential(WebCredential::create(credential).ptr()); > return; > } > notImplemented(); >- challenge->performDefaultHandling(); >+ challenge->listener().performDefaultHandling(); > } > > void ServiceWorkerProcessProxy::didFinishLaunching(ProcessLauncher* launcher, IPC::Connection::Identifier connectionIdentifier) >Index: Source/WebKit/UIProcess/WebPageProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/WebPageProxy.cpp (revision 236078) >+++ Source/WebKit/UIProcess/WebPageProxy.cpp (working copy) >@@ -6334,21 +6334,25 @@ void WebPageProxy::gamepadActivity(const > > #endif > >-void WebPageProxy::didReceiveAuthenticationChallengeProxy(uint64_t, Ref<AuthenticationChallengeProxy>&& authenticationChallenge) >+WeakPtr<SecKeyProxyStore> WebPageProxy::secKeyProxyStore(const WebCore::AuthenticationChallenge& challenge) > { > #if HAVE(SEC_KEY_PROXY) >- ASSERT(authenticationChallenge->protectionSpace()); >- if (authenticationChallenge->protectionSpace()->authenticationScheme() == ProtectionSpaceAuthenticationSchemeClientCertificateRequested) { >+ if (challenge.protectionSpace().authenticationScheme() == ProtectionSpaceAuthenticationSchemeClientCertificateRequested) { > auto secKeyProxyStore = SecKeyProxyStore::create(); >- authenticationChallenge->setSecKeyProxyStore(secKeyProxyStore); >+ auto weakPointer = makeWeakPtr(secKeyProxyStore.get()); > m_websiteDataStore->addSecKeyProxyStore(WTFMove(secKeyProxyStore)); >+ return weakPointer; > } > #endif >- >+ return nullptr; >+} >+ >+void WebPageProxy::didReceiveAuthenticationChallengeProxy(uint64_t, Ref<AuthenticationChallengeProxy>&& authenticationChallenge) >+{ > if (m_navigationClient) > m_navigationClient->didReceiveAuthenticationChallenge(*this, authenticationChallenge.get()); > else >- authenticationChallenge->performDefaultHandling(); >+ authenticationChallenge->listener().performDefaultHandling(); > } > > void WebPageProxy::exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, Messages::WebPageProxy::ExceededDatabaseQuota::DelayedReply&& reply) >Index: Source/WebKit/UIProcess/WebPageProxy.h >=================================================================== >--- Source/WebKit/UIProcess/WebPageProxy.h (revision 236078) >+++ Source/WebKit/UIProcess/WebPageProxy.h (working copy) >@@ -225,6 +225,7 @@ class PageClient; > class RemoteLayerTreeScrollingPerformanceData; > class RemoteLayerTreeTransaction; > class RemoteScrollingCoordinatorProxy; >+class SecKeyProxyStore; > class UserData; > class ViewSnapshot; > class VisitedLinkStore; >@@ -436,6 +437,8 @@ public: > > void initializeWebPage(); > >+ WeakPtr<SecKeyProxyStore> secKeyProxyStore(const WebCore::AuthenticationChallenge&); >+ > void close(); > bool tryClose(); > bool isClosed() const { return m_isClosed; } >Index: Source/WebKit/UIProcess/API/C/WKAuthenticationChallenge.cpp >=================================================================== >--- Source/WebKit/UIProcess/API/C/WKAuthenticationChallenge.cpp (revision 236078) >+++ Source/WebKit/UIProcess/API/C/WKAuthenticationChallenge.cpp (working copy) >@@ -42,7 +42,7 @@ WKTypeID WKAuthenticationChallengeGetTyp > > WKAuthenticationDecisionListenerRef WKAuthenticationChallengeGetDecisionListener(WKAuthenticationChallengeRef challenge) > { >- return toAPI(toImpl(challenge)->listener()); >+ return toAPI(&toImpl(challenge)->listener()); > } > > WKProtectionSpaceRef WKAuthenticationChallengeGetProtectionSpace(WKAuthenticationChallengeRef challenge) >@@ -57,5 +57,5 @@ WKCredentialRef WKAuthenticationChalleng > > int WKAuthenticationChallengeGetPreviousFailureCount(WKAuthenticationChallengeRef challenge) > { >- return toImpl(challenge)->previousFailureCount(); >+ return toImpl(challenge)->core().previousFailureCount(); > } >Index: Source/WebKit/UIProcess/API/C/WKPage.cpp >=================================================================== >--- Source/WebKit/UIProcess/API/C/WKPage.cpp (revision 236078) >+++ Source/WebKit/UIProcess/API/C/WKPage.cpp (working copy) >@@ -50,6 +50,7 @@ > #include "APIWebsitePolicies.h" > #include "APIWindowFeatures.h" > #include "AuthenticationChallengeProxy.h" >+#include "AuthenticationDecisionListener.h" > #include "LegacySessionStateCoding.h" > #include "Logging.h" > #include "NativeWebKeyboardEvent.h" >@@ -2147,10 +2148,10 @@ void WKPageSetPageNavigationClient(WKPag > > void didReceiveAuthenticationChallenge(WebPageProxy& page, AuthenticationChallengeProxy& authenticationChallenge) override > { >- if (m_client.canAuthenticateAgainstProtectionSpace && !m_client.canAuthenticateAgainstProtectionSpace(toAPI(&page), toAPI(authenticationChallenge.protectionSpace()), m_client.base.clientInfo)) >- return authenticationChallenge.rejectProtectionSpaceAndContinue(); >+ if (m_client.canAuthenticateAgainstProtectionSpace && !m_client.canAuthenticateAgainstProtectionSpace(toAPI(&page), toAPI(WebProtectionSpace::create(authenticationChallenge.core().protectionSpace()).ptr()), m_client.base.clientInfo)) >+ return authenticationChallenge.listener().rejectProtectionSpaceAndContinue(); > if (!m_client.didReceiveAuthenticationChallenge) >- return authenticationChallenge.performDefaultHandling(); >+ return authenticationChallenge.listener().performDefaultHandling(); > m_client.didReceiveAuthenticationChallenge(toAPI(&page), toAPI(&authenticationChallenge), m_client.base.clientInfo); > } > >Index: Source/WebKit/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm >=================================================================== >--- Source/WebKit/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm (revision 236078) >+++ Source/WebKit/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm (working copy) >@@ -70,35 +70,35 @@ - (void)cancelAuthenticationChallenge:(N > { > checkChallenge(challenge); > WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy; >- webChallenge.listener()->cancel(); >+ webChallenge.listener().cancel(); > } > > - (void)continueWithoutCredentialForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge > { > checkChallenge(challenge); > WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy; >- webChallenge.listener()->useCredential(nullptr); >+ webChallenge.listener().useCredential(nullptr); > } > > - (void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge > { > checkChallenge(challenge); > WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy; >- webChallenge.listener()->useCredential(WebKit::WebCredential::create(WebCore::Credential(credential)).ptr()); >+ webChallenge.listener().useCredential(WebKit::WebCredential::create(WebCore::Credential(credential)).ptr()); > } > > - (void)performDefaultHandlingForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge > { > checkChallenge(challenge); > WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy; >- webChallenge.listener()->performDefaultHandling(); >+ webChallenge.listener().performDefaultHandling(); > } > > - (void)rejectProtectionSpaceAndContinueWithChallenge:(NSURLAuthenticationChallenge *)challenge > { > checkChallenge(challenge); > WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy; >- webChallenge.listener()->rejectProtectionSpaceAndContinue(); >+ webChallenge.listener().rejectProtectionSpaceAndContinue(); > } > > @end >Index: Source/WebKit/UIProcess/API/glib/WebKitAuthenticationRequest.cpp >=================================================================== >--- Source/WebKit/UIProcess/API/glib/WebKitAuthenticationRequest.cpp (revision 236078) >+++ Source/WebKit/UIProcess/API/glib/WebKitAuthenticationRequest.cpp (working copy) >@@ -25,6 +25,8 @@ > #include "WebKitAuthenticationRequestPrivate.h" > #include "WebKitCredentialPrivate.h" > #include "WebProtectionSpace.h" >+#include <WebCore/AuthenticationChallenge.h> >+#include <WebCore/ProtectionSpace.h> > #include <glib/gi18n-lib.h> > #include <wtf/glib/WTFGType.h> > #include <wtf/text/CString.h> >@@ -186,7 +188,7 @@ WebKitCredential* webkit_authentication_ > { > g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), 0); > >- const WebCore::Credential& credential = request->priv->authenticationChallenge->proposedCredential()->credential(); >+ const auto& credential = request->priv->authenticationChallenge->core().proposedCredential(); > if (credential.isEmpty()) > return 0; > >@@ -208,7 +210,7 @@ const gchar* webkit_authentication_reque > g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), 0); > > if (request->priv->host.isNull()) >- request->priv->host = request->priv->authenticationChallenge->protectionSpace()->host().utf8(); >+ request->priv->host = request->priv->authenticationChallenge->core().protectionSpace().host().utf8(); > return request->priv->host.data(); > } > >@@ -226,7 +228,7 @@ guint webkit_authentication_request_get_ > { > g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), 0); > >- return request->priv->authenticationChallenge->protectionSpace()->port(); >+ return request->priv->authenticationChallenge->core().protectionSpace().port(); > } > > /** >@@ -244,7 +246,7 @@ const gchar* webkit_authentication_reque > g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), 0); > > if (request->priv->realm.isNull()) >- request->priv->realm = request->priv->authenticationChallenge->protectionSpace()->realm().utf8(); >+ request->priv->realm = request->priv->authenticationChallenge->core().protectionSpace().realm().utf8(); > return request->priv->realm.data(); > } > >@@ -262,7 +264,7 @@ WebKitAuthenticationScheme webkit_authen > { > g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), WEBKIT_AUTHENTICATION_SCHEME_UNKNOWN); > >- return toWebKitAuthenticationScheme(request->priv->authenticationChallenge->protectionSpace()->authenticationScheme()); >+ return toWebKitAuthenticationScheme(request->priv->authenticationChallenge->core().protectionSpace().authenticationScheme()); > } > > /** >@@ -279,7 +281,7 @@ gboolean webkit_authentication_request_i > { > g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), FALSE); > >- return request->priv->authenticationChallenge->protectionSpace()->isProxy(); >+ return request->priv->authenticationChallenge->core().protectionSpace().isProxy(); > } > > /** >@@ -296,7 +298,7 @@ gboolean webkit_authentication_request_i > { > g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), 0); > >- return request->priv->authenticationChallenge->previousFailureCount() ? TRUE : FALSE; >+ return request->priv->authenticationChallenge->core().previousFailureCount() ? TRUE : FALSE; > } > > /** >@@ -314,9 +316,9 @@ void webkit_authentication_request_authe > g_return_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request)); > > if (credential) >- request->priv->authenticationChallenge->listener()->useCredential(WebCredential::create(webkitCredentialGetCredential(credential)).ptr()); >+ request->priv->authenticationChallenge->listener().useCredential(WebCredential::create(webkitCredentialGetCredential(credential)).ptr()); > else >- request->priv->authenticationChallenge->listener()->useCredential(nullptr); >+ request->priv->authenticationChallenge->listener().useCredential(nullptr); > > request->priv->handledRequest = true; > } >@@ -334,7 +336,7 @@ void webkit_authentication_request_cance > { > g_return_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request)); > >- request->priv->authenticationChallenge->listener()->cancel(); >+ request->priv->authenticationChallenge->listener().cancel(); > > g_signal_emit(request, signals[CANCELLED], 0); > } >Index: Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp (revision 236078) >+++ Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp (working copy) >@@ -27,6 +27,7 @@ > #include "AuthenticationChallengeProxy.h" > > #include "AuthenticationDecisionListener.h" >+#include "AuthenticationManager.h" > #include "AuthenticationManagerMessages.h" > #include "ChildProcessProxy.h" > #include "WebCertificateInfo.h" >@@ -41,88 +42,44 @@ > > namespace WebKit { > >-AuthenticationChallengeProxy::AuthenticationChallengeProxy(WebCore::AuthenticationChallenge&& authenticationChallenge, uint64_t challengeID, IPC::Connection* connection) >+AuthenticationChallengeProxy::AuthenticationChallengeProxy(WebCore::AuthenticationChallenge&& authenticationChallenge, uint64_t challengeID, IPC::Connection* connection, WeakPtr<SecKeyProxyStore>&& secKeyProxyStore) > : m_coreAuthenticationChallenge(WTFMove(authenticationChallenge)) >- , m_challengeID(challengeID) >- , m_connection(connection) >-{ >- ASSERT(m_challengeID); >- m_listener = AuthenticationDecisionListener::create(this); >-} >- >-AuthenticationChallengeProxy::~AuthenticationChallengeProxy() >-{ >- // If an outstanding AuthenticationChallengeProxy is being destroyed even though it hasn't been responded to yet, >- // we cancel it here so the process isn't waiting for an answer forever. >- if (m_challengeID) >- m_connection->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), 0); >- >- if (m_listener) >- m_listener->detachChallenge(); >-} >- >-void AuthenticationChallengeProxy::useCredential(WebCredential* credential) >-{ >- if (!m_challengeID) >- return; >- >- uint64_t challengeID = m_challengeID; >- m_challengeID = 0; >- >- if (!credential) { >- m_connection->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(challengeID), 0); >- return; >- } >- >+ , m_listener(AuthenticationDecisionListener::create([challengeID, connection = makeRefPtr(connection), secKeyProxyStore = WTFMove(secKeyProxyStore)](AuthenticationChallengeDisposition disposition, WebCredential* 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; >+ } >+ > #if HAVE(SEC_KEY_PROXY) >- if (protectionSpace()->authenticationScheme() == WebCore::ProtectionSpaceAuthenticationSchemeClientCertificateRequested) { >- if (!m_secKeyProxyStore) { >- m_connection->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(challengeID), 0); >- return; >- } >- m_secKeyProxyStore->initialize(credential->credential()); >- sendClientCertificateCredentialOverXpc(challengeID, credential->credential()); >- return; >- } >+ if (secKeyProxyStore) { >+ secKeyProxyStore->initialize(credential->credential()); >+ sendClientCertificateCredentialOverXpc(connection.get(), *secKeyProxyStore, challengeID, credential->credential()); >+ break; >+ } > #endif >- m_connection->send(Messages::AuthenticationManager::UseCredentialForChallenge(challengeID, credential->credential()), 0); >-} > >-void AuthenticationChallengeProxy::cancel() >-{ >- if (!m_challengeID) >- return; >- >- m_connection->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), 0); >- >- m_challengeID = 0; >-} >- >-void AuthenticationChallengeProxy::performDefaultHandling() >-{ >- if (!m_challengeID) >- return; >- >- m_connection->send(Messages::AuthenticationManager::PerformDefaultHandling(m_challengeID), 0); >- >- m_challengeID = 0; >-} >- >-void AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue() >+ connection->send(Messages::AuthenticationManager::UseCredentialForChallenge(challengeID, credential->credential()), 0); >+ } >+ })) > { >- if (!m_challengeID) >- return; >- >- m_connection->send(Messages::AuthenticationManager::RejectProtectionSpaceAndContinue(m_challengeID), 0); >- >- m_challengeID = 0; > } > > WebCredential* AuthenticationChallengeProxy::proposedCredential() const > { > if (!m_webCredential) > m_webCredential = WebCredential::create(m_coreAuthenticationChallenge.proposedCredential()); >- >+ > return m_webCredential.get(); > } > >@@ -130,15 +87,8 @@ WebProtectionSpace* AuthenticationChalle > { > if (!m_webProtectionSpace) > m_webProtectionSpace = WebProtectionSpace::create(m_coreAuthenticationChallenge.protectionSpace()); >- >- return m_webProtectionSpace.get(); >-} > >-#if HAVE(SEC_KEY_PROXY) >-void AuthenticationChallengeProxy::setSecKeyProxyStore(SecKeyProxyStore& store) >-{ >- m_secKeyProxyStore = makeWeakPtr(store); >+ return m_webProtectionSpace.get(); > } >-#endif > > } // namespace WebKit >Index: Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.h >=================================================================== >--- Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.h (revision 236078) >+++ Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.h (working copy) >@@ -43,45 +43,28 @@ class WebProtectionSpace; > > class AuthenticationChallengeProxy : public API::ObjectImpl<API::Object::Type::AuthenticationChallenge> { > public: >- static Ref<AuthenticationChallengeProxy> create(WebCore::AuthenticationChallenge&& authenticationChallenge, uint64_t challengeID, IPC::Connection* connection) >+ static Ref<AuthenticationChallengeProxy> create(WebCore::AuthenticationChallenge&& authenticationChallenge, uint64_t challengeID, IPC::Connection* connection, WeakPtr<SecKeyProxyStore>&& secKeyProxyStore) > { >- return adoptRef(*new AuthenticationChallengeProxy(WTFMove(authenticationChallenge), challengeID, connection)); >+ return adoptRef(*new AuthenticationChallengeProxy(WTFMove(authenticationChallenge), challengeID, connection, WTFMove(secKeyProxyStore))); > } >- >- ~AuthenticationChallengeProxy(); >- >- void useCredential(WebCredential*); >- void cancel(); >- void performDefaultHandling(); >- void rejectProtectionSpaceAndContinue(); > >- AuthenticationDecisionListener* listener() const { return m_listener.get(); } > WebCredential* proposedCredential() const; > WebProtectionSpace* protectionSpace() const; >- int previousFailureCount() const { return m_coreAuthenticationChallenge.previousFailureCount(); } >- const WebCore::AuthenticationChallenge& core() { return m_coreAuthenticationChallenge; } > >-#if HAVE(SEC_KEY_PROXY) >- void setSecKeyProxyStore(SecKeyProxyStore&); >-#endif >+ AuthenticationDecisionListener& listener() const { return m_listener.get(); } >+ const WebCore::AuthenticationChallenge& core() { return m_coreAuthenticationChallenge; } > > private: >- AuthenticationChallengeProxy(WebCore::AuthenticationChallenge&&, uint64_t challengeID, IPC::Connection*); >+ AuthenticationChallengeProxy(WebCore::AuthenticationChallenge&&, uint64_t challengeID, IPC::Connection*, WeakPtr<SecKeyProxyStore>&&); > > #if HAVE(SEC_KEY_PROXY) >- void sendClientCertificateCredentialOverXpc(uint64_t challengeID, const WebCore::Credential&) const; >+ static void sendClientCertificateCredentialOverXpc(IPC::Connection*, SecKeyProxyStore&, uint64_t challengeID, const WebCore::Credential&); > #endif > > WebCore::AuthenticationChallenge m_coreAuthenticationChallenge; >- uint64_t m_challengeID; >- RefPtr<IPC::Connection> m_connection; >- RefPtr<AuthenticationDecisionListener> m_listener; > mutable RefPtr<WebCredential> m_webCredential; > mutable RefPtr<WebProtectionSpace> m_webProtectionSpace; >- >-#if HAVE(SEC_KEY_PROXY) >- WeakPtr<SecKeyProxyStore> m_secKeyProxyStore; >-#endif >+ Ref<AuthenticationDecisionListener> m_listener; > }; > > } // namespace WebKit >Index: Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.cpp >=================================================================== >--- Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.cpp (revision 236078) >+++ Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.cpp (working copy) >@@ -35,38 +35,39 @@ > > namespace WebKit { > >-AuthenticationDecisionListener::AuthenticationDecisionListener(AuthenticationChallengeProxy* authenticationChallenge) >- : m_challengeProxy(authenticationChallenge) >+AuthenticationDecisionListener::AuthenticationDecisionListener(CompletionHandler<void(AuthenticationChallengeDisposition, WebCredential*)>&& completionHandler) >+ : m_completionHandler(WTFMove(completionHandler)) > { > } > >+AuthenticationDecisionListener::~AuthenticationDecisionListener() >+{ >+ if (m_completionHandler) >+ m_completionHandler(AuthenticationChallengeDisposition::Cancel, nullptr); >+} >+ > void AuthenticationDecisionListener::useCredential(WebCredential* credential) > { >- if (m_challengeProxy) >- m_challengeProxy->useCredential(credential); >+ if (m_completionHandler) >+ m_completionHandler(AuthenticationChallengeDisposition::UseCredential, credential); > } > > void AuthenticationDecisionListener::cancel() > { >- if (m_challengeProxy) >- m_challengeProxy->cancel(); >+ if (m_completionHandler) >+ m_completionHandler(AuthenticationChallengeDisposition::Cancel, nullptr); > } > > void AuthenticationDecisionListener::performDefaultHandling() > { >- if (m_challengeProxy) >- m_challengeProxy->performDefaultHandling(); >+ if (m_completionHandler) >+ m_completionHandler(AuthenticationChallengeDisposition::PerformDefaultHandling, nullptr); > } > > void AuthenticationDecisionListener::rejectProtectionSpaceAndContinue() > { >- if (m_challengeProxy) >- m_challengeProxy->rejectProtectionSpaceAndContinue(); >-} >- >-void AuthenticationDecisionListener::detachChallenge() >-{ >- m_challengeProxy = 0; >+ if (m_completionHandler) >+ m_completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue, nullptr); > } > > } // namespace WebKit >Index: Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.h >=================================================================== >--- Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.h (revision 236078) >+++ Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.h (working copy) >@@ -23,38 +23,36 @@ > * THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef AuthenticationDecisionListener_h >-#define AuthenticationDecisionListener_h >+#pragma once > > #include "APIObject.h" > >+#include <wtf/CompletionHandler.h> > #include <wtf/RefPtr.h> > > namespace WebKit { > >+enum class AuthenticationChallengeDisposition; > class AuthenticationChallengeProxy; > class WebCredential; > > class AuthenticationDecisionListener : public API::ObjectImpl<API::Object::Type::AuthenticationDecisionListener> { > public: >- static Ref<AuthenticationDecisionListener> create(AuthenticationChallengeProxy* authenticationChallenge) >+ static Ref<AuthenticationDecisionListener> create(CompletionHandler<void(AuthenticationChallengeDisposition, WebCredential*)>&& completionHandler) > { >- return adoptRef(*new AuthenticationDecisionListener(authenticationChallenge)); >+ return adoptRef(*new AuthenticationDecisionListener(WTFMove(completionHandler))); > } >+ ~AuthenticationDecisionListener(); > > void useCredential(WebCredential*); > void cancel(); > void performDefaultHandling(); > void rejectProtectionSpaceAndContinue(); > >- void detachChallenge(); >- > private: >- explicit AuthenticationDecisionListener(AuthenticationChallengeProxy*); >+ explicit AuthenticationDecisionListener(CompletionHandler<void(AuthenticationChallengeDisposition, WebCredential*)>&&); > >- AuthenticationChallengeProxy* m_challengeProxy; >+ CompletionHandler<void(AuthenticationChallengeDisposition, WebCredential*)> m_completionHandler; > }; > > } // namespace WebKit >- >-#endif // WebAuthenticationDecisionListener_h >Index: Source/WebKit/UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm >=================================================================== >--- Source/WebKit/UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm (revision 236078) >+++ Source/WebKit/UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm (working copy) >@@ -36,15 +36,14 @@ > > namespace WebKit { > >-void AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc(uint64_t challengeID, const WebCore::Credential& credential) const >+void AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc(IPC::Connection* connection, SecKeyProxyStore& secKeyProxyStore, uint64_t challengeID, const WebCore::Credential& credential) > { >- ASSERT(m_secKeyProxyStore); >- ASSERT(m_secKeyProxyStore->isInitialized()); >+ ASSERT(secKeyProxyStore.isInitialized()); > > auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0)); > xpc_dictionary_set_string(message.get(), clientCertificateAuthenticationXPCMessageNameKey, clientCertificateAuthenticationXPCMessageNameValue); > xpc_dictionary_set_uint64(message.get(), clientCertificateAuthenticationXPCChallengeIDKey, challengeID); >- xpc_dictionary_set_value(message.get(), clientCertificateAuthenticationXPCSecKeyProxyEndpointKey, m_secKeyProxyStore->get().endpoint._endpoint); >+ xpc_dictionary_set_value(message.get(), clientCertificateAuthenticationXPCSecKeyProxyEndpointKey, secKeyProxyStore.get().endpoint._endpoint); > auto certificateDataArray = adoptOSObject(xpc_array_create(nullptr, 0)); > for (id certificate in credential.nsCredential().certificates) { > auto data = adoptCF(SecCertificateCopyData((SecCertificateRef)certificate)); >@@ -53,7 +52,7 @@ void AuthenticationChallengeProxy::sendC > xpc_dictionary_set_value(message.get(), clientCertificateAuthenticationXPCCertificatesKey, certificateDataArray.get()); > xpc_dictionary_set_uint64(message.get(), clientCertificateAuthenticationXPCPersistenceKey, static_cast<uint64_t>(credential.nsCredential().persistence)); > >- xpc_connection_send_message(m_connection->xpcConnection(), message.get()); >+ xpc_connection_send_message(connection->xpcConnection(), message.get()); > } > > } // namespace WebKit >Index: Source/WebKit/UIProcess/Cocoa/DownloadClient.mm >=================================================================== >--- Source/WebKit/UIProcess/Cocoa/DownloadClient.mm (revision 236078) >+++ Source/WebKit/UIProcess/Cocoa/DownloadClient.mm (working copy) >@@ -122,7 +122,7 @@ void DownloadClient::didReceiveAuthentic > { > // FIXME: System Preview needs code here. > if (!m_delegateMethods.downloadDidReceiveAuthenticationChallengeCompletionHandler) { >- authenticationChallenge.listener()->performDefaultHandling(); >+ authenticationChallenge.listener().performDefaultHandling(); > return; > } > >@@ -136,20 +136,20 @@ void DownloadClient::didReceiveAuthentic > if (credential) > webCredential = WebCredential::create(WebCore::Credential(credential)); > >- authenticationChallenge->listener()->useCredential(webCredential.get()); >+ authenticationChallenge->listener().useCredential(webCredential.get()); > break; > } > > case NSURLSessionAuthChallengePerformDefaultHandling: >- authenticationChallenge->listener()->performDefaultHandling(); >+ authenticationChallenge->listener().performDefaultHandling(); > break; > > case NSURLSessionAuthChallengeCancelAuthenticationChallenge: >- authenticationChallenge->listener()->cancel(); >+ authenticationChallenge->listener().cancel(); > break; > > case NSURLSessionAuthChallengeRejectProtectionSpace: >- authenticationChallenge->listener()->rejectProtectionSpaceAndContinue(); >+ authenticationChallenge->listener().rejectProtectionSpaceAndContinue(); > break; > > default: >Index: Source/WebKit/UIProcess/Cocoa/NavigationState.mm >=================================================================== >--- Source/WebKit/UIProcess/Cocoa/NavigationState.mm (revision 236078) >+++ Source/WebKit/UIProcess/Cocoa/NavigationState.mm (working copy) >@@ -852,11 +852,11 @@ void NavigationState::NavigationClient:: > void NavigationState::NavigationClient::didReceiveAuthenticationChallenge(WebPageProxy&, AuthenticationChallengeProxy& authenticationChallenge) > { > if (!m_navigationState.m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallengeCompletionHandler) >- return authenticationChallenge.performDefaultHandling(); >+ return authenticationChallenge.listener().performDefaultHandling(); > > auto navigationDelegate = m_navigationState.m_navigationDelegate.get(); > if (!navigationDelegate) >- return authenticationChallenge.performDefaultHandling(); >+ return authenticationChallenge.listener().performDefaultHandling(); > > auto checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(webView:didReceiveAuthenticationChallenge:completionHandler:)); > [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) webView:m_navigationState.m_webView didReceiveAuthenticationChallenge:wrapper(authenticationChallenge) completionHandler:BlockPtr<void(NSURLSessionAuthChallengeDisposition, NSURLCredential *)>::fromCallable([challenge = makeRef(authenticationChallenge), checker = WTFMove(checker)](NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential) { >@@ -870,20 +870,20 @@ void NavigationState::NavigationClient:: > if (credential) > webCredential = WebCredential::create(WebCore::Credential(credential)); > >- challenge->useCredential(webCredential.get()); >+ challenge->listener().useCredential(webCredential.get()); > break; > } > > case NSURLSessionAuthChallengePerformDefaultHandling: >- challenge->performDefaultHandling(); >+ challenge->listener().performDefaultHandling(); > break; > > case NSURLSessionAuthChallengeCancelAuthenticationChallenge: >- challenge->cancel(); >+ challenge->listener().cancel(); > break; > > case NSURLSessionAuthChallengeRejectProtectionSpace: >- challenge->rejectProtectionSpaceAndContinue(); >+ challenge->listener().rejectProtectionSpaceAndContinue(); > break; > > default: >Index: Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp (revision 236078) >+++ Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp (working copy) >@@ -120,7 +120,7 @@ void DownloadProxy::didReceiveAuthentica > if (!m_processPool) > return; > >- auto authenticationChallengeProxy = AuthenticationChallengeProxy::create(WTFMove(authenticationChallenge), challengeID, m_processPool->networkingProcessConnection()); >+ auto authenticationChallengeProxy = AuthenticationChallengeProxy::create(WTFMove(authenticationChallenge), challengeID, m_processPool->networkingProcessConnection(), nullptr); > > m_processPool->downloadClient().didReceiveAuthenticationChallenge(*m_processPool, *this, authenticationChallengeProxy.get()); > } >Index: Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (revision 236078) >+++ Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (working copy) >@@ -294,7 +294,7 @@ void NetworkProcessProxy::didReceiveAuth > { > #if ENABLE(SERVICE_WORKER) > if (auto* serviceWorkerProcessProxy = m_processPool.serviceWorkerProcessProxyFromPageID(pageID)) { >- auto authenticationChallenge = AuthenticationChallengeProxy::create(WTFMove(coreChallenge), challengeID, connection()); >+ auto authenticationChallenge = AuthenticationChallengeProxy::create(WTFMove(coreChallenge), challengeID, connection(), nullptr); > serviceWorkerProcessProxy->didReceiveAuthenticationChallenge(pageID, frameID, WTFMove(authenticationChallenge)); > return; > } >@@ -303,7 +303,7 @@ void NetworkProcessProxy::didReceiveAuth > WebPageProxy* page = WebProcessProxy::webPage(pageID); > MESSAGE_CHECK(page); > >- auto authenticationChallenge = AuthenticationChallengeProxy::create(WTFMove(coreChallenge), challengeID, connection()); >+ auto authenticationChallenge = AuthenticationChallengeProxy::create(WTFMove(coreChallenge), challengeID, connection(), page->secKeyProxyStore(coreChallenge)); > page->didReceiveAuthenticationChallengeProxy(frameID, WTFMove(authenticationChallenge)); > } >
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 189668
:
349905
|
349911
|
349917
|
349932
|
349934
|
349954
|
350034
|
350037
|
350039