Title: [259521] trunk/Source/WebKit
Revision
259521
Author
[email protected]
Date
2020-04-03 16:45:58 -0700 (Fri, 03 Apr 2020)

Log Message

Use AuthenticationChallenge instead of AuthenticationChallengeProxy for ResourceLoadDelegate
https://bugs.webkit.org/show_bug.cgi?id=207639

Patch by Alex Christensen <[email protected]> on 2020-04-03
Reviewed by David Kilzer.

In r254345 my younger and more naive self used AuthenticationChallengeProxy instead of AuthenticationChallenge
because he didn't know about the WebCore::mac function, which is called by AuthenticationChallengeProxy, and it's
all I needed to get an NSURLAuthenticationChallenge.  Skipping the AuthenticationChallengeProxy step cleans up
AuthenticationChallengeProxy by removing the unnecessary ability to have a null CompletionHandler.

Covered by existing tests.

* UIProcess/API/APIResourceLoadClient.h:
* UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
(WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
(): Deleted.
* UIProcess/Cocoa/ResourceLoadDelegate.h:
* UIProcess/Cocoa/ResourceLoadDelegate.mm:
(WebKit::ResourceLoadDelegate::ResourceLoadClient::didReceiveChallenge const):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::resourceLoadDidReceiveChallenge):
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebPageProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (259520 => 259521)


--- trunk/Source/WebKit/ChangeLog	2020-04-03 23:39:06 UTC (rev 259520)
+++ trunk/Source/WebKit/ChangeLog	2020-04-03 23:45:58 UTC (rev 259521)
@@ -1,3 +1,29 @@
+2020-04-03  Alex Christensen  <[email protected]>
+
+        Use AuthenticationChallenge instead of AuthenticationChallengeProxy for ResourceLoadDelegate
+        https://bugs.webkit.org/show_bug.cgi?id=207639
+
+        Reviewed by David Kilzer.
+
+        In r254345 my younger and more naive self used AuthenticationChallengeProxy instead of AuthenticationChallenge
+        because he didn't know about the WebCore::mac function, which is called by AuthenticationChallengeProxy, and it's
+        all I needed to get an NSURLAuthenticationChallenge.  Skipping the AuthenticationChallengeProxy step cleans up
+        AuthenticationChallengeProxy by removing the unnecessary ability to have a null CompletionHandler.
+
+        Covered by existing tests.
+
+        * UIProcess/API/APIResourceLoadClient.h:
+        * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
+        (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
+        (): Deleted.
+        * UIProcess/Cocoa/ResourceLoadDelegate.h:
+        * UIProcess/Cocoa/ResourceLoadDelegate.mm:
+        (WebKit::ResourceLoadDelegate::ResourceLoadClient::didReceiveChallenge const):
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::resourceLoadDidReceiveChallenge):
+        * UIProcess/WebPageProxy.cpp:
+        * UIProcess/WebPageProxy.h:
+
 2020-04-03  Kate Cheney  <[email protected]>
 
         Prevent non app-bound domain cookies from being read or set using API calls

Modified: trunk/Source/WebKit/UIProcess/API/APIResourceLoadClient.h (259520 => 259521)


--- trunk/Source/WebKit/UIProcess/API/APIResourceLoadClient.h	2020-04-03 23:39:06 UTC (rev 259520)
+++ trunk/Source/WebKit/UIProcess/API/APIResourceLoadClient.h	2020-04-03 23:45:58 UTC (rev 259521)
@@ -29,8 +29,11 @@
 #include <WebCore/ResourceRequest.h>
 #include <WebCore/ResourceResponse.h>
 
+namespace WebCore {
+class AuthenticationChallenge;
+}
+
 namespace WebKit {
-class AuthenticationChallengeProxy;
 struct ResourceLoadInfo;
 }
 
@@ -42,7 +45,7 @@
 
     virtual void didSendRequest(WebKit::ResourceLoadInfo&&, WebCore::ResourceRequest&&) const = 0;
     virtual void didPerformHTTPRedirection(WebKit::ResourceLoadInfo&&, WebCore::ResourceResponse&&, WebCore::ResourceRequest&&) const = 0;
-    virtual void didReceiveChallenge(WebKit::ResourceLoadInfo&&, WebKit::AuthenticationChallengeProxy&) const = 0;
+    virtual void didReceiveChallenge(WebKit::ResourceLoadInfo&&, WebCore::AuthenticationChallenge&&) const = 0;
     virtual void didReceiveResponse(WebKit::ResourceLoadInfo&&, WebCore::ResourceResponse&&) const = 0;
     virtual void didCompleteWithError(WebKit::ResourceLoadInfo&&, WebCore::ResourceResponse&&, WebCore::ResourceError&&) const = 0;
 };

Modified: trunk/Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp (259520 => 259521)


--- trunk/Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp	2020-04-03 23:39:06 UTC (rev 259520)
+++ trunk/Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp	2020-04-03 23:45:58 UTC (rev 259521)
@@ -45,7 +45,7 @@
 
 AuthenticationChallengeProxy::AuthenticationChallengeProxy(WebCore::AuthenticationChallenge&& authenticationChallenge, uint64_t challengeID, Ref<IPC::Connection>&& connection, WeakPtr<SecKeyProxyStore>&& secKeyProxyStore)
     : m_coreAuthenticationChallenge(WTFMove(authenticationChallenge))
-    , m_listener(AuthenticationDecisionListener::create(challengeID ? CompletionHandler<void(AuthenticationChallengeDisposition, const WebCore::Credential&)>([challengeID, connection = WTFMove(connection), secKeyProxyStore = WTFMove(secKeyProxyStore)](AuthenticationChallengeDisposition disposition, const WebCore::Credential& credential) {
+    , 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);
@@ -53,8 +53,9 @@
         }
 #endif
         connection->send(Messages::AuthenticationManager::CompleteAuthenticationChallenge(challengeID, disposition, credential), 0);
-    }) : nullptr))
+    }))
 {
+    ASSERT(challengeID);
 }
 
 WebCredential* AuthenticationChallengeProxy::proposedCredential() const

Modified: trunk/Source/WebKit/UIProcess/Cocoa/ResourceLoadDelegate.h (259520 => 259521)


--- trunk/Source/WebKit/UIProcess/Cocoa/ResourceLoadDelegate.h	2020-04-03 23:39:06 UTC (rev 259520)
+++ trunk/Source/WebKit/UIProcess/Cocoa/ResourceLoadDelegate.h	2020-04-03 23:45:58 UTC (rev 259521)
@@ -61,7 +61,7 @@
         // API::ResourceLoadClient
         void didSendRequest(ResourceLoadInfo&&, WebCore::ResourceRequest&&) const final;
         void didPerformHTTPRedirection(ResourceLoadInfo&&, WebCore::ResourceResponse&&, WebCore::ResourceRequest&&) const final;
-        void didReceiveChallenge(ResourceLoadInfo&&, WebKit::AuthenticationChallengeProxy&) const final;
+        void didReceiveChallenge(ResourceLoadInfo&&, WebCore::AuthenticationChallenge&&) const final;
         void didReceiveResponse(ResourceLoadInfo&&, WebCore::ResourceResponse&&) const final;
         void didCompleteWithError(ResourceLoadInfo&&, WebCore::ResourceResponse&&, WebCore::ResourceError&&) const final;
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/ResourceLoadDelegate.mm (259520 => 259521)


--- trunk/Source/WebKit/UIProcess/Cocoa/ResourceLoadDelegate.mm	2020-04-03 23:39:06 UTC (rev 259520)
+++ trunk/Source/WebKit/UIProcess/Cocoa/ResourceLoadDelegate.mm	2020-04-03 23:45:58 UTC (rev 259521)
@@ -26,6 +26,7 @@
 #import "config.h"
 #import "ResourceLoadDelegate.h"
 
+#import <WebCore/AuthenticationMac.h>
 #import "AuthenticationChallengeProxy.h"
 #import "WKNSURLAuthenticationChallenge.h"
 #import "_WKResourceLoadDelegate.h"
@@ -97,7 +98,7 @@
     [delegate webView:m_resourceLoadDelegate.m_webView.get().get() resourceLoad:wrapper(API::ResourceLoadInfo::create(WTFMove(loadInfo)).get()) didPerformHTTPRedirection:response.nsURLResponse() newRequest:request.nsURLRequest(WebCore::HTTPBodyUpdatePolicy::DoNotUpdateHTTPBody)];
 }
 
-void ResourceLoadDelegate::ResourceLoadClient::didReceiveChallenge(WebKit::ResourceLoadInfo&& loadInfo, WebKit::AuthenticationChallengeProxy& challenge) const
+void ResourceLoadDelegate::ResourceLoadClient::didReceiveChallenge(WebKit::ResourceLoadInfo&& loadInfo, WebCore::AuthenticationChallenge&& challenge) const
 {
     if (!m_resourceLoadDelegate.m_delegateMethods.didReceiveChallenge)
         return;
@@ -106,7 +107,7 @@
     if (!delegate)
         return;
 
-    [delegate webView:m_resourceLoadDelegate.m_webView.get().get() resourceLoad:wrapper(API::ResourceLoadInfo::create(WTFMove(loadInfo)).get()) didReceiveChallenge:wrapper(challenge)];
+    [delegate webView:m_resourceLoadDelegate.m_webView.get().get() resourceLoad:wrapper(API::ResourceLoadInfo::create(WTFMove(loadInfo)).get()) didReceiveChallenge:mac(challenge)];
 }
 
 void ResourceLoadDelegate::ResourceLoadClient::didReceiveResponse(WebKit::ResourceLoadInfo&& loadInfo, WebCore::ResourceResponse&& response) const

Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (259520 => 259521)


--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp	2020-04-03 23:39:06 UTC (rev 259520)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp	2020-04-03 23:45:58 UTC (rev 259521)
@@ -504,8 +504,7 @@
     if (!page)
         return;
 
-    auto challengeProxy = AuthenticationChallengeProxy::create(WTFMove(challenge), 0, *connection(), nullptr);
-    page->resourceLoadDidReceiveChallenge(WTFMove(loadInfo), challengeProxy.get());
+    page->resourceLoadDidReceiveChallenge(WTFMove(loadInfo), WTFMove(challenge));
 }
 
 void NetworkProcessProxy::resourceLoadDidReceiveResponse(WebPageProxyIdentifier pageID, ResourceLoadInfo&& loadInfo, WebCore::ResourceResponse&& response)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (259520 => 259521)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-04-03 23:39:06 UTC (rev 259520)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-04-03 23:45:58 UTC (rev 259521)
@@ -6105,10 +6105,10 @@
         m_resourceLoadClient->didPerformHTTPRedirection(WTFMove(loadInfo), WTFMove(response), WTFMove(request));
 }
 
-void WebPageProxy::resourceLoadDidReceiveChallenge(ResourceLoadInfo&& loadInfo, WebKit::AuthenticationChallengeProxy& challenge)
+void WebPageProxy::resourceLoadDidReceiveChallenge(ResourceLoadInfo&& loadInfo, WebCore::AuthenticationChallenge&& challenge)
 {
     if (m_resourceLoadClient)
-        m_resourceLoadClient->didReceiveChallenge(WTFMove(loadInfo), challenge);
+        m_resourceLoadClient->didReceiveChallenge(WTFMove(loadInfo), WTFMove(challenge));
 }
 
 void WebPageProxy::resourceLoadDidReceiveResponse(ResourceLoadInfo&& loadInfo, WebCore::ResourceResponse&& response)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (259520 => 259521)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2020-04-03 23:39:06 UTC (rev 259520)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2020-04-03 23:45:58 UTC (rev 259521)
@@ -476,7 +476,7 @@
 
     void resourceLoadDidSendRequest(ResourceLoadInfo&&, WebCore::ResourceRequest&&);
     void resourceLoadDidPerformHTTPRedirection(ResourceLoadInfo&&, WebCore::ResourceResponse&&, WebCore::ResourceRequest&&);
-    void resourceLoadDidReceiveChallenge(ResourceLoadInfo&&, WebKit::AuthenticationChallengeProxy&);
+    void resourceLoadDidReceiveChallenge(ResourceLoadInfo&&, WebCore::AuthenticationChallenge&&);
     void resourceLoadDidReceiveResponse(ResourceLoadInfo&&, WebCore::ResourceResponse&&);
     void resourceLoadDidCompleteWithError(ResourceLoadInfo&&, WebCore::ResourceResponse&&, WebCore::ResourceError&&);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to