Title: [236344] trunk/Source/WebKit
Revision
236344
Author
[email protected]
Date
2018-09-21 12:25:21 -0700 (Fri, 21 Sep 2018)

Log Message

Simply authentication code even more!
https://bugs.webkit.org/show_bug.cgi?id=189719

Reviewed by Andy Estes.

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:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (236343 => 236344)


--- trunk/Source/WebKit/ChangeLog	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/ChangeLog	2018-09-21 19:25:21 UTC (rev 236344)
@@ -1,3 +1,58 @@
+2018-09-21  Alex Christensen  <[email protected]>
+
+        Simply authentication code even more!
+        https://bugs.webkit.org/show_bug.cgi?id=189719
+
+        Reviewed by Andy Estes.
+
+        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-21  Chris Dumez  <[email protected]>
 
         Regression(Mojave): Resuming a WK2 download crashes

Modified: trunk/Source/WebKit/NetworkProcess/Downloads/Download.cpp (236343 => 236344)


--- trunk/Source/WebKit/NetworkProcess/Downloads/Download.cpp	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/NetworkProcess/Downloads/Download.cpp	2018-09-21 19:25:21 UTC (rev 236344)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "Download.h"
 
+#include "AuthenticationChallengeDisposition.h"
 #include "AuthenticationManager.h"
 #include "Connection.h"
 #include "DataReference.h"

Modified: trunk/Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp (236343 => 236344)


--- trunk/Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp	2018-09-21 19:25:21 UTC (rev 236344)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "NetworkCORSPreflightChecker.h"
 
+#include "AuthenticationChallengeDisposition.h"
 #include "AuthenticationManager.h"
 #include "Logging.h"
 #include "NetworkLoadParameters.h"

Modified: trunk/Source/WebKit/NetworkProcess/NetworkLoad.cpp (236343 => 236344)


--- trunk/Source/WebKit/NetworkProcess/NetworkLoad.cpp	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/NetworkProcess/NetworkLoad.cpp	2018-09-21 19:25:21 UTC (rev 236344)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "NetworkLoad.h"
 
+#include "AuthenticationChallengeDisposition.h"
 #include "AuthenticationManager.h"
 #include "DownloadProxyMessages.h"
 #include "NetworkProcess.h"

Modified: trunk/Source/WebKit/NetworkProcess/PingLoad.cpp (236343 => 236344)


--- trunk/Source/WebKit/NetworkProcess/PingLoad.cpp	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/NetworkProcess/PingLoad.cpp	2018-09-21 19:25:21 UTC (rev 236344)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "PingLoad.h"
 
+#include "AuthenticationChallengeDisposition.h"
 #include "AuthenticationManager.h"
 #include "Logging.h"
 #include "NetworkLoadChecker.h"

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (236343 => 236344)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2018-09-21 19:25:21 UTC (rev 236344)
@@ -26,6 +26,7 @@
 #import "config.h"
 #import "NetworkDataTaskCocoa.h"
 
+#import "AuthenticationChallengeDisposition.h"
 #import "AuthenticationManager.h"
 #import "Download.h"
 #import "DownloadProxyMessages.h"

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (236343 => 236344)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2018-09-21 19:25:21 UTC (rev 236344)
@@ -26,6 +26,7 @@
 #import "config.h"
 #import "NetworkSessionCocoa.h"
 
+#import "AuthenticationChallengeDisposition.h"
 #import "AuthenticationManager.h"
 #import "DataReference.h"
 #import "Download.h"

Modified: trunk/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp (236343 => 236344)


--- trunk/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp	2018-09-21 19:25:21 UTC (rev 236344)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "NetworkDataTaskCurl.h"
 
+#include "AuthenticationChallengeDisposition.h"
 #include "AuthenticationManager.h"
 #include "NetworkSessionCurl.h"
 #include <WebCore/AuthenticationChallenge.h>

Modified: trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp (236343 => 236344)


--- trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp	2018-09-21 19:25:21 UTC (rev 236344)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "NetworkDataTaskSoup.h"
 
+#include "AuthenticationChallengeDisposition.h"
 #include "AuthenticationManager.h"
 #include "DataReference.h"
 #include "Download.h"

Added: trunk/Source/WebKit/Shared/Authentication/AuthenticationChallengeDisposition.h (0 => 236344)


--- trunk/Source/WebKit/Shared/Authentication/AuthenticationChallengeDisposition.h	                        (rev 0)
+++ trunk/Source/WebKit/Shared/Authentication/AuthenticationChallengeDisposition.h	2018-09-21 19:25:21 UTC (rev 236344)
@@ -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

Modified: trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.cpp (236343 => 236344)


--- trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.cpp	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.cpp	2018-09-21 19:25:21 UTC (rev 236344)
@@ -134,101 +134,15 @@
     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);
+    for (auto& coalescedChallengeID : coalesceChallengesMatching(challengeID)) {
+        auto challenge = m_challenges.take(coalescedChallengeID);
+        ASSERT(!challenge.challenge.isNull());
+        challenge.completionHandler(disposition, 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();
-}
-
 } // namespace WebKit

Modified: trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.h (236343 => 236344)


--- trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.h	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.h	2018-09-21 19:25:21 UTC (rev 236344)
@@ -51,12 +51,7 @@
 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 @@
     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 @@
     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;

Modified: trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.messages.in (236343 => 236344)


--- trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.messages.in	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.messages.in	2018-09-21 19:25:21 UTC (rev 236344)
@@ -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);
 }

Modified: trunk/Source/WebKit/Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm (236343 => 236344)


--- trunk/Source/WebKit/Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm	2018-09-21 19:25:21 UTC (rev 236344)
@@ -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 @@
         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()));
     });
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/APINavigationClient.h (236343 => 236344)


--- trunk/Source/WebKit/UIProcess/API/APINavigationClient.h	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/UIProcess/API/APINavigationClient.h	2018-09-21 19:25:21 UTC (rev 236344)
@@ -27,6 +27,7 @@
 
 #include "APIData.h"
 #include "APIString.h"
+#include "AuthenticationChallengeDisposition.h"
 #include "AuthenticationChallengeProxy.h"
 #include "AuthenticationDecisionListener.h"
 #include "PluginModuleInfo.h"
@@ -87,7 +88,7 @@
 
     virtual void renderingProgressDidChange(WebKit::WebPageProxy&, WebCore::LayoutMilestones) { }
 
-    virtual void didReceiveAuthenticationChallenge(WebKit::WebPageProxy&, WebKit::AuthenticationChallengeProxy& challenge) { challenge.listener().performDefaultHandling(); }
+    virtual void didReceiveAuthenticationChallenge(WebKit::WebPageProxy&, WebKit::AuthenticationChallengeProxy& challenge) { challenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::PerformDefaultHandling); }
 
     // FIXME: These function should not be part of this client.
     virtual bool processDidTerminate(WebKit::WebPageProxy&, WebKit::ProcessTerminationReason) { return false; }

Modified: trunk/Source/WebKit/UIProcess/API/C/WKAuthenticationDecisionListener.cpp (236343 => 236344)


--- trunk/Source/WebKit/UIProcess/API/C/WKAuthenticationDecisionListener.cpp	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/UIProcess/API/C/WKAuthenticationDecisionListener.cpp	2018-09-21 19:25:21 UTC (rev 236344)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "WKAuthenticationDecisionListener.h"
 
+#include "AuthenticationChallengeDisposition.h"
 #include "AuthenticationDecisionListener.h"
 #include "WKAPICast.h"
 #include "WebCredential.h"
@@ -39,18 +40,15 @@
 
 void WKAuthenticationDecisionListenerUseCredential(WKAuthenticationDecisionListenerRef authenticationListener, WKCredentialRef credential)
 {
-    if (credential)
-        toImpl(authenticationListener)->useCredential(toImpl(credential)->credential());
-    else
-        toImpl(authenticationListener)->useCredential(std::nullopt);
+    toImpl(authenticationListener)->completeChallenge(AuthenticationChallengeDisposition::UseCredential, credential ? toImpl(credential)->credential() : WebCore::Credential());
 }
 
 void WKAuthenticationDecisionListenerCancel(WKAuthenticationDecisionListenerRef authenticationListener)
 {
-    toImpl(authenticationListener)->cancel();
+    toImpl(authenticationListener)->completeChallenge(AuthenticationChallengeDisposition::Cancel);
 }
 
 void WKAuthenticationDecisionListenerRejectProtectionSpaceAndContinue(WKAuthenticationDecisionListenerRef authenticationListener)
 {
-    toImpl(authenticationListener)->rejectProtectionSpaceAndContinue();
+    toImpl(authenticationListener)->completeChallenge(AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue);
 }

Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (236343 => 236344)


--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp	2018-09-21 19:25:21 UTC (rev 236344)
@@ -49,6 +49,7 @@
 #include "APIUIClient.h"
 #include "APIWebsitePolicies.h"
 #include "APIWindowFeatures.h"
+#include "AuthenticationChallengeDisposition.h"
 #include "AuthenticationChallengeProxy.h"
 #include "AuthenticationDecisionListener.h"
 #include "LegacySessionStateCoding.h"
@@ -2149,9 +2150,9 @@
         void didReceiveAuthenticationChallenge(WebPageProxy& page, AuthenticationChallengeProxy& authenticationChallenge) override
         {
             if (m_client.canAuthenticateAgainstProtectionSpace && !m_client.canAuthenticateAgainstProtectionSpace(toAPI(&page), toAPI(WebProtectionSpace::create(authenticationChallenge.core().protectionSpace()).ptr()), m_client.base.clientInfo))
-                return authenticationChallenge.listener().rejectProtectionSpaceAndContinue();
+                return authenticationChallenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue);
             if (!m_client.didReceiveAuthenticationChallenge)
-                return authenticationChallenge.listener().performDefaultHandling();
+                return authenticationChallenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::PerformDefaultHandling);
             m_client.didReceiveAuthenticationChallenge(toAPI(&page), toAPI(&authenticationChallenge), m_client.base.clientInfo);
         }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm (236343 => 236344)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm	2018-09-21 19:25:21 UTC (rev 236344)
@@ -28,6 +28,7 @@
 
 #if WK_API_ENABLED
 
+#import "AuthenticationChallengeDisposition.h"
 #import "AuthenticationDecisionListener.h"
 #import "WebCertificateInfo.h"
 #import "WebCredential.h"
@@ -70,7 +71,7 @@
 {
     checkChallenge(challenge);
     WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
-    webChallenge.listener().cancel();
+    webChallenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::Cancel);
 }
 
 - (void)continueWithoutCredentialForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
@@ -77,7 +78,7 @@
 {
     checkChallenge(challenge);
     WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
-    webChallenge.listener().useCredential(std::nullopt);
+    webChallenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::UseCredential);
 }
 
 - (void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
@@ -84,7 +85,7 @@
 {
     checkChallenge(challenge);
     WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
-    webChallenge.listener().useCredential(WebCore::Credential(credential));
+    webChallenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::UseCredential, WebCore::Credential(credential));
 }
 
 - (void)performDefaultHandlingForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
@@ -91,7 +92,7 @@
 {
     checkChallenge(challenge);
     WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
-    webChallenge.listener().performDefaultHandling();
+    webChallenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::PerformDefaultHandling);
 }
 
 - (void)rejectProtectionSpaceAndContinueWithChallenge:(NSURLAuthenticationChallenge *)challenge
@@ -98,7 +99,7 @@
 {
     checkChallenge(challenge);
     WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
-    webChallenge.listener().rejectProtectionSpaceAndContinue();
+    webChallenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue);
 }
 
 @end

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitAuthenticationRequest.cpp (236343 => 236344)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitAuthenticationRequest.cpp	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitAuthenticationRequest.cpp	2018-09-21 19:25:21 UTC (rev 236344)
@@ -20,6 +20,7 @@
 #include "config.h"
 #include "WebKitAuthenticationRequest.h"
 
+#include "AuthenticationChallengeDisposition.h"
 #include "AuthenticationDecisionListener.h"
 #include "WebCredential.h"
 #include "WebKitAuthenticationRequestPrivate.h"
@@ -315,10 +316,7 @@
 {
     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().completeChallenge(WebKit::AuthenticationChallengeDisposition::UseCredential, credential ? webkitCredentialGetCredential(credential) : WebCore::Credential());
 
     request->priv->handledRequest = true;
 }
@@ -336,7 +334,7 @@
 {
     g_return_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request));
 
-    request->priv->authenticationChallenge->listener().cancel();
+    request->priv->authenticationChallenge->listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::Cancel);
 
     g_signal_emit(request, signals[CANCELLED], 0);
 }

Modified: trunk/Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp (236343 => 236344)


--- trunk/Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp	2018-09-21 19:25:21 UTC (rev 236344)
@@ -44,33 +44,15 @@
 
 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;
-            }
+        if (secKeyProxyStore) {
+            secKeyProxyStore->initialize(credential);
+            sendClientCertificateCredentialOverXpc(connection, *secKeyProxyStore, challengeID, credential);
+            return;
+        }
 #endif
-
-            connection->send(Messages::AuthenticationManager::UseCredentialForChallenge(challengeID, *credential), 0);
-        }
+        connection->send(Messages::AuthenticationManager::CompleteAuthenticationChallenge(challengeID, disposition, credential), 0);
     }))
 {
 }

Modified: trunk/Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.cpp (236343 => 236344)


--- trunk/Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.cpp	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.cpp	2018-09-21 19:25:21 UTC (rev 236344)
@@ -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,13 @@
 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::completeChallenge(AuthenticationChallengeDisposition disposition, const WebCore::Credential& credential)
 {
     if (m_completionHandler)
-        m_completionHandler(AuthenticationChallengeDisposition::UseCredential, WTFMove(credential));
+        m_completionHandler(disposition, credential);
 }
 
-void AuthenticationDecisionListener::cancel()
-{
-    if (m_completionHandler)
-        m_completionHandler(AuthenticationChallengeDisposition::Cancel, std::nullopt);
-}
-
-void AuthenticationDecisionListener::performDefaultHandling()
-{
-    if (m_completionHandler)
-        m_completionHandler(AuthenticationChallengeDisposition::PerformDefaultHandling, std::nullopt);
-}
-
-void AuthenticationDecisionListener::rejectProtectionSpaceAndContinue()
-{
-    if (m_completionHandler)
-        m_completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue, std::nullopt);
-}
-    
 } // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.h (236343 => 236344)


--- trunk/Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.h	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.h	2018-09-21 19:25:21 UTC (rev 236344)
@@ -37,21 +37,18 @@
 
 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 cancel();
-    void performDefaultHandling();
-    void rejectProtectionSpaceAndContinue();
+    void completeChallenge(AuthenticationChallengeDisposition, const WebCore::Credential& = { });
 
 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

Modified: trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm (236343 => 236344)


--- trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm	2018-09-21 19:25:21 UTC (rev 236344)
@@ -28,6 +28,7 @@
 
 #if WK_API_ENABLED
 
+#import "AuthenticationChallengeDisposition.h"
 #import "AuthenticationChallengeProxy.h"
 #import "AuthenticationDecisionListener.h"
 #import "CompletionHandlerCallChecker.h"
@@ -122,7 +123,7 @@
 {
     // FIXME: System Preview needs code here.
     if (!m_delegateMethods.downloadDidReceiveAuthenticationChallengeCompletionHandler) {
-        authenticationChallenge.listener().performDefaultHandling();
+        authenticationChallenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::PerformDefaultHandling);
         return;
     }
 
@@ -132,21 +133,18 @@
         checker->didCallCompletionHandler();
         switch (disposition) {
         case NSURLSessionAuthChallengeUseCredential:
-            if (credential)
-                authenticationChallenge->listener().useCredential(WebCore::Credential(credential));
-            else
-                authenticationChallenge->listener().useCredential(std::nullopt);
+            authenticationChallenge->listener().completeChallenge(AuthenticationChallengeDisposition::UseCredential, credential ? WebCore::Credential(credential) : WebCore::Credential());
             break;
         case NSURLSessionAuthChallengePerformDefaultHandling:
-            authenticationChallenge->listener().performDefaultHandling();
+            authenticationChallenge->listener().completeChallenge(AuthenticationChallengeDisposition::PerformDefaultHandling);
             break;
             
         case NSURLSessionAuthChallengeCancelAuthenticationChallenge:
-            authenticationChallenge->listener().cancel();
+            authenticationChallenge->listener().completeChallenge(AuthenticationChallengeDisposition::Cancel);
             break;
             
         case NSURLSessionAuthChallengeRejectProtectionSpace:
-            authenticationChallenge->listener().rejectProtectionSpaceAndContinue();
+            authenticationChallenge->listener().completeChallenge(AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue);
             break;
             
         default:

Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (236343 => 236344)


--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm	2018-09-21 19:25:21 UTC (rev 236344)
@@ -34,6 +34,7 @@
 #import "APIString.h"
 #import "APIURL.h"
 #import "APIWebsiteDataStore.h"
+#import "AuthenticationChallengeDisposition.h"
 #import "AuthenticationDecisionListener.h"
 #import "CompletionHandlerCallChecker.h"
 #import "Logging.h"
@@ -849,14 +850,29 @@
     [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webView:m_navigationState.m_webView renderingProgressDidChange:renderingProgressEvents(layoutMilestones)];
 }
 
+static AuthenticationChallengeDisposition toAuthenticationChallengeDisposition(NSURLSessionAuthChallengeDisposition disposition)
+{
+    switch (disposition) {
+    case NSURLSessionAuthChallengeUseCredential:
+        return AuthenticationChallengeDisposition::UseCredential;
+    case NSURLSessionAuthChallengePerformDefaultHandling:
+        return AuthenticationChallengeDisposition::PerformDefaultHandling;
+    case NSURLSessionAuthChallengeCancelAuthenticationChallenge:
+        return AuthenticationChallengeDisposition::Cancel;
+    case NSURLSessionAuthChallengeRejectProtectionSpace:
+        return AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue;
+    }
+    [NSException raise:NSInvalidArgumentException format:@"Invalid NSURLSessionAuthChallengeDisposition (%ld)", (long)disposition];
+}
+    
 void NavigationState::NavigationClient::didReceiveAuthenticationChallenge(WebPageProxy&, AuthenticationChallengeProxy& authenticationChallenge)
 {
     if (!m_navigationState.m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallengeCompletionHandler)
-        return authenticationChallenge.listener().performDefaultHandling();
+        return authenticationChallenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::PerformDefaultHandling);
 
     auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
     if (!navigationDelegate)
-        return authenticationChallenge.listener().performDefaultHandling();
+        return authenticationChallenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::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) {
@@ -863,29 +879,7 @@
         if (checker->completionHandlerHasBeenCalled())
             return;
         checker->didCallCompletionHandler();
-
-        switch (disposition) {
-        case NSURLSessionAuthChallengeUseCredential:
-            if (credential)
-                challenge->listener().useCredential(Credential(credential));
-            else
-                challenge->listener().useCredential(std::nullopt);
-            break;
-        case NSURLSessionAuthChallengePerformDefaultHandling:
-            challenge->listener().performDefaultHandling();
-            break;
-
-        case NSURLSessionAuthChallengeCancelAuthenticationChallenge:
-            challenge->listener().cancel();
-            break;
-
-        case NSURLSessionAuthChallengeRejectProtectionSpace:
-            challenge->listener().rejectProtectionSpaceAndContinue();
-            break;
-
-        default:
-            [NSException raise:NSInvalidArgumentException format:@"Invalid NSURLSessionAuthChallengeDisposition (%ld)", (long)disposition];
-        }
+        challenge->listener().completeChallenge(toAuthenticationChallengeDisposition(disposition), Credential(credential));
     }).get()];
 }
 

Modified: trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp (236343 => 236344)


--- trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp	2018-09-21 19:25:21 UTC (rev 236344)
@@ -28,6 +28,7 @@
 
 #if ENABLE(SERVICE_WORKER)
 
+#include "AuthenticationChallengeDisposition.h"
 #include "AuthenticationChallengeProxy.h"
 #include "AuthenticationDecisionListener.h"
 #include "WebCredential.h"
@@ -98,11 +99,11 @@
     auto& protectionSpace = challenge->core().protectionSpace();
     if (protectionSpace.authenticationScheme() == WebCore::ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested && processPool().allowsAnySSLCertificateForServiceWorker()) {
         auto credential = WebCore::Credential("accept server trust"_s, emptyString(), WebCore::CredentialPersistenceNone);
-        challenge->listener().useCredential(credential);
+        challenge->listener().completeChallenge(AuthenticationChallengeDisposition::UseCredential, credential);
         return;
     }
     notImplemented();
-    challenge->listener().performDefaultHandling();
+    challenge->listener().completeChallenge(AuthenticationChallengeDisposition::PerformDefaultHandling);
 }
 
 void ServiceWorkerProcessProxy::didFinishLaunching(ProcessLauncher* launcher, IPC::Connection::Identifier connectionIdentifier)

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (236343 => 236344)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2018-09-21 19:19:55 UTC (rev 236343)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2018-09-21 19:25:21 UTC (rev 236344)
@@ -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 */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to