Title: [235364] trunk/Source/WebKit
Revision
235364
Author
[email protected]
Date
2018-08-27 08:44:18 -0700 (Mon, 27 Aug 2018)

Log Message

Fix authentication for clients of WKPageLoaderClient after r234941
https://bugs.webkit.org/show_bug.cgi?id=188939

Reviewed by Youenn Fablet.

I simplified the authentication code path elegantly for clients of WKPageNavigationClient/WKNavigationDelegate,
but clients of WKPageLoaderClient that do not implement didReceiveAuthenticationChallengeInFrame would hang.
This fixes that.  I've also made the performDefaultHandling (when delegates are not implemented) and rejectProtectionSpaceAndContinue
(when canAuthenticationAgainstProtectionSpace returns false) behave correctly.

* UIProcess/API/APILoaderClient.h:
(API::LoaderClient::didReachLayoutMilestone):
(API::LoaderClient::canAuthenticateAgainstProtectionSpaceInFrame): Deleted.
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageLoaderClient):
(WKPageSetPageNavigationClient):
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (235363 => 235364)


--- trunk/Source/WebKit/ChangeLog	2018-08-27 15:42:07 UTC (rev 235363)
+++ trunk/Source/WebKit/ChangeLog	2018-08-27 15:44:18 UTC (rev 235364)
@@ -1,3 +1,24 @@
+2018-08-27  Alex Christensen  <[email protected]>
+
+        Fix authentication for clients of WKPageLoaderClient after r234941
+        https://bugs.webkit.org/show_bug.cgi?id=188939
+
+        Reviewed by Youenn Fablet.
+
+        I simplified the authentication code path elegantly for clients of WKPageNavigationClient/WKNavigationDelegate,
+        but clients of WKPageLoaderClient that do not implement didReceiveAuthenticationChallengeInFrame would hang.
+        This fixes that.  I've also made the performDefaultHandling (when delegates are not implemented) and rejectProtectionSpaceAndContinue
+        (when canAuthenticationAgainstProtectionSpace returns false) behave correctly.
+
+        * UIProcess/API/APILoaderClient.h:
+        (API::LoaderClient::didReachLayoutMilestone):
+        (API::LoaderClient::canAuthenticateAgainstProtectionSpaceInFrame): Deleted.
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSetPageLoaderClient):
+        (WKPageSetPageNavigationClient):
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
+
 2018-08-26  Sam Weinig  <[email protected]>
 
         Using _WKRemoteObjectInterface with a protocol that inherits from a non-NSObject protocol crashes

Modified: trunk/Source/WebKit/UIProcess/API/APILoaderClient.h (235363 => 235364)


--- trunk/Source/WebKit/UIProcess/API/APILoaderClient.h	2018-08-27 15:42:07 UTC (rev 235363)
+++ trunk/Source/WebKit/UIProcess/API/APILoaderClient.h	2018-08-27 15:44:18 UTC (rev 235364)
@@ -76,8 +76,6 @@
     virtual void didDetectXSSForFrame(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, API::Object*) { }
 
     virtual void didReachLayoutMilestone(WebKit::WebPageProxy&, WebCore::LayoutMilestones) { }
-    
-    virtual bool canAuthenticateAgainstProtectionSpaceInFrame(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, WebKit::WebProtectionSpace*) { return false; }
     virtual void didReceiveAuthenticationChallengeInFrame(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, WebKit::AuthenticationChallengeProxy&) { }
 
     virtual void didStartProgress(WebKit::WebPageProxy&) { }

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


--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp	2018-08-27 15:42:07 UTC (rev 235363)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp	2018-08-27 15:44:18 UTC (rev 235364)
@@ -1165,18 +1165,12 @@
             m_client.didDetectXSSForFrame(toAPI(&page), toAPI(&frame), toAPI(userData), m_client.base.clientInfo);
         }
 
-        bool canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy& page, WebFrameProxy& frame, WebProtectionSpace* protectionSpace) override
-        {
-            if (!m_client.canAuthenticateAgainstProtectionSpaceInFrame)
-                return false;
-
-            return m_client.canAuthenticateAgainstProtectionSpaceInFrame(toAPI(&page), toAPI(&frame), toAPI(protectionSpace), m_client.base.clientInfo);
-        }
-
         void didReceiveAuthenticationChallengeInFrame(WebPageProxy& page, WebFrameProxy& frame, AuthenticationChallengeProxy& authenticationChallenge) override
         {
+            if (m_client.canAuthenticateAgainstProtectionSpaceInFrame && !m_client.canAuthenticateAgainstProtectionSpaceInFrame(toAPI(&page), toAPI(&frame), toAPI(authenticationChallenge.protectionSpace()), m_client.base.clientInfo))
+                return authenticationChallenge.rejectProtectionSpaceAndContinue();
             if (!m_client.didReceiveAuthenticationChallengeInFrame)
-                return;
+                return authenticationChallenge.performDefaultHandling();
 
             m_client.didReceiveAuthenticationChallengeInFrame(toAPI(&page), toAPI(&frame), toAPI(&authenticationChallenge), m_client.base.clientInfo);
         }
@@ -2310,19 +2304,12 @@
             m_client.renderingProgressDidChange(toAPI(&page), pageRenderingProgressEvents(milestones), nullptr, m_client.base.clientInfo);
         }
         
-        bool canAuthenticateAgainstProtectionSpace(WebPageProxy& page, WebProtectionSpace* protectionSpace) override
-        {
-            if (!m_client.canAuthenticateAgainstProtectionSpace)
-                return false;
-            return m_client.canAuthenticateAgainstProtectionSpace(toAPI(&page), toAPI(protectionSpace), m_client.base.clientInfo);
-        }
-        
         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.didReceiveAuthenticationChallenge)
-                return authenticationChallenge.rejectProtectionSpaceAndContinue();
+                return authenticationChallenge.performDefaultHandling();
             m_client.didReceiveAuthenticationChallenge(toAPI(&page), toAPI(&authenticationChallenge), m_client.base.clientInfo);
         }
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (235363 => 235364)


--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm	2018-08-27 15:42:07 UTC (rev 235363)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm	2018-08-27 15:44:18 UTC (rev 235364)
@@ -853,7 +853,7 @@
 void NavigationState::NavigationClient::didReceiveAuthenticationChallenge(WebPageProxy&, AuthenticationChallengeProxy& authenticationChallenge)
 {
     if (!m_navigationState.m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallengeCompletionHandler)
-        return authenticationChallenge.rejectProtectionSpaceAndContinue();
+        return authenticationChallenge.performDefaultHandling();
 
     auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
     if (!navigationDelegate)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to