Changeset 235364 in webkit


Ignore:
Timestamp:
Aug 27, 2018, 8:44:18 AM (7 years ago)
Author:
achristensen@apple.com
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):

Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r235346 r235364  
     12018-08-27  Alex Christensen  <achristensen@webkit.org>
     2
     3        Fix authentication for clients of WKPageLoaderClient after r234941
     4        https://bugs.webkit.org/show_bug.cgi?id=188939
     5
     6        Reviewed by Youenn Fablet.
     7
     8        I simplified the authentication code path elegantly for clients of WKPageNavigationClient/WKNavigationDelegate,
     9        but clients of WKPageLoaderClient that do not implement didReceiveAuthenticationChallengeInFrame would hang.
     10        This fixes that.  I've also made the performDefaultHandling (when delegates are not implemented) and rejectProtectionSpaceAndContinue
     11        (when canAuthenticationAgainstProtectionSpace returns false) behave correctly.
     12
     13        * UIProcess/API/APILoaderClient.h:
     14        (API::LoaderClient::didReachLayoutMilestone):
     15        (API::LoaderClient::canAuthenticateAgainstProtectionSpaceInFrame): Deleted.
     16        * UIProcess/API/C/WKPage.cpp:
     17        (WKPageSetPageLoaderClient):
     18        (WKPageSetPageNavigationClient):
     19        * UIProcess/Cocoa/NavigationState.mm:
     20        (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
     21
    1222018-08-26  Sam Weinig  <sam@webkit.org>
    223
  • trunk/Source/WebKit/UIProcess/API/APILoaderClient.h

    r235200 r235364  
    7777
    7878    virtual void didReachLayoutMilestone(WebKit::WebPageProxy&, WebCore::LayoutMilestones) { }
    79    
    80     virtual bool canAuthenticateAgainstProtectionSpaceInFrame(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, WebKit::WebProtectionSpace*) { return false; }
    8179    virtual void didReceiveAuthenticationChallengeInFrame(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, WebKit::AuthenticationChallengeProxy&) { }
    8280
  • trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp

    r235200 r235364  
    11661166        }
    11671167
    1168         bool canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy& page, WebFrameProxy& frame, WebProtectionSpace* protectionSpace) override
    1169         {
    1170             if (!m_client.canAuthenticateAgainstProtectionSpaceInFrame)
    1171                 return false;
    1172 
    1173             return m_client.canAuthenticateAgainstProtectionSpaceInFrame(toAPI(&page), toAPI(&frame), toAPI(protectionSpace), m_client.base.clientInfo);
    1174         }
    1175 
    11761168        void didReceiveAuthenticationChallengeInFrame(WebPageProxy& page, WebFrameProxy& frame, AuthenticationChallengeProxy& authenticationChallenge) override
    11771169        {
     1170            if (m_client.canAuthenticateAgainstProtectionSpaceInFrame && !m_client.canAuthenticateAgainstProtectionSpaceInFrame(toAPI(&page), toAPI(&frame), toAPI(authenticationChallenge.protectionSpace()), m_client.base.clientInfo))
     1171                return authenticationChallenge.rejectProtectionSpaceAndContinue();
    11781172            if (!m_client.didReceiveAuthenticationChallengeInFrame)
    1179                 return;
     1173                return authenticationChallenge.performDefaultHandling();
    11801174
    11811175            m_client.didReceiveAuthenticationChallengeInFrame(toAPI(&page), toAPI(&frame), toAPI(&authenticationChallenge), m_client.base.clientInfo);
     
    23112305        }
    23122306       
    2313         bool canAuthenticateAgainstProtectionSpace(WebPageProxy& page, WebProtectionSpace* protectionSpace) override
    2314         {
    2315             if (!m_client.canAuthenticateAgainstProtectionSpace)
    2316                 return false;
    2317             return m_client.canAuthenticateAgainstProtectionSpace(toAPI(&page), toAPI(protectionSpace), m_client.base.clientInfo);
    2318         }
    2319        
    23202307        void didReceiveAuthenticationChallenge(WebPageProxy& page, AuthenticationChallengeProxy& authenticationChallenge) override
    23212308        {
     
    23232310                return authenticationChallenge.rejectProtectionSpaceAndContinue();
    23242311            if (!m_client.didReceiveAuthenticationChallenge)
    2325                 return authenticationChallenge.rejectProtectionSpaceAndContinue();
     2312                return authenticationChallenge.performDefaultHandling();
    23262313            m_client.didReceiveAuthenticationChallenge(toAPI(&page), toAPI(&authenticationChallenge), m_client.base.clientInfo);
    23272314        }
  • trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm

    r235332 r235364  
    854854{
    855855    if (!m_navigationState.m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallengeCompletionHandler)
    856         return authenticationChallenge.rejectProtectionSpaceAndContinue();
     856        return authenticationChallenge.performDefaultHandling();
    857857
    858858    auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
Note: See TracChangeset for help on using the changeset viewer.