Changeset 234941 in webkit
- Timestamp:
- Aug 16, 2018 10:59:30 AM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r234940 r234941 1 2018-08-16 Alex Christensen <achristensen@webkit.org> 2 3 Stop using canAuthenticateAgainstProtectionSpace in modern WebKit 4 https://bugs.webkit.org/show_bug.cgi?id=188639 5 6 Reviewed by Youenn Fablet. 7 8 canAuthenticateAgainstProtectionSpace is an unnecessary step in the authentication process. 9 It is leftover from when it was necessary when we used NSURLConnection, which is only used in WebKitLegacy now. 10 Now it's just an extra IPC roundtrip asking if we should use NSURLSessionAuthChallengeRejectProtectionSpace 11 or if we are going to ask the API client. We can move this step into the C API for compatibility 12 with the 1 client that still uses it (not for long, see rdar://problem/43358403) and simplify and optimize 13 authentication. 14 15 * NetworkProcess/Downloads/PendingDownload.cpp: 16 (WebKit::PendingDownload::canAuthenticateAgainstProtectionSpaceAsync): Deleted. 17 * NetworkProcess/Downloads/PendingDownload.h: 18 * NetworkProcess/NetworkCORSPreflightChecker.cpp: 19 (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge): 20 * NetworkProcess/NetworkLoad.cpp: 21 (WebKit::NetworkLoad::~NetworkLoad): 22 (WebKit::NetworkLoad::didReceiveChallenge): 23 (WebKit::NetworkLoad::completeAuthenticationChallenge): Deleted. 24 (WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace): Deleted. 25 * NetworkProcess/NetworkLoad.h: 26 * NetworkProcess/NetworkLoadClient.h: 27 * NetworkProcess/NetworkProcess.cpp: 28 (WebKit::NetworkProcess::cancelDownload): 29 (WebKit::NetworkProcess::canAuthenticateAgainstProtectionSpace): Deleted. 30 (WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpace): Deleted. 31 * NetworkProcess/NetworkProcess.h: 32 * NetworkProcess/NetworkProcess.messages.in: 33 * NetworkProcess/NetworkResourceLoader.cpp: 34 (WebKit::NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync): Deleted. 35 * NetworkProcess/NetworkResourceLoader.h: 36 * NetworkProcess/PreconnectTask.cpp: 37 (WebKit::PreconnectTask::canAuthenticateAgainstProtectionSpaceAsync): Deleted. 38 * NetworkProcess/PreconnectTask.h: 39 * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp: 40 (WebKit::NetworkCache::SpeculativeLoad::canAuthenticateAgainstProtectionSpaceAsync): Deleted. 41 * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h: 42 * Shared/Authentication/AuthenticationManager.cpp: 43 (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge): 44 * Shared/Authentication/AuthenticationManager.h: 45 * UIProcess/API/C/WKPage.cpp: 46 (WKPageSetPageNavigationClient): 47 * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: 48 * UIProcess/Cocoa/NavigationState.h: 49 * UIProcess/Cocoa/NavigationState.mm: 50 (WebKit::NavigationState::setNavigationDelegate): 51 (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): 52 (WebKit::NavigationState::NavigationClient::canAuthenticateAgainstProtectionSpace): Deleted. 53 * UIProcess/Network/NetworkProcessProxy.cpp: 54 (WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace): Deleted. 55 * UIProcess/Network/NetworkProcessProxy.h: 56 * UIProcess/Network/NetworkProcessProxy.messages.in: 57 * UIProcess/WebPageProxy.cpp: 58 (WebKit::WebPageProxy::canAuthenticateAgainstProtectionSpace): Deleted. 59 * UIProcess/WebPageProxy.h: 60 1 61 2018-08-15 Jer Noble <jer.noble@apple.com> 2 62 -
trunk/Source/WebKit/NetworkProcess/Downloads/PendingDownload.cpp
r227364 r234941 77 77 } 78 78 79 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)80 void PendingDownload::canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace& protectionSpace)81 {82 m_networkLoad->continueCanAuthenticateAgainstProtectionSpace(true);83 }84 #endif85 86 79 void PendingDownload::didFailLoading(const WebCore::ResourceError& error) 87 80 { -
trunk/Source/WebKit/NetworkProcess/Downloads/PendingDownload.h
r227364 r234941 52 52 // NetworkLoadClient. 53 53 void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override { } 54 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)55 void canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace&) override;56 #endif57 54 bool isSynchronous() const override { return false; } 58 55 bool isAllowedToAskUserForCredentials() const final { return m_isAllowedToAskUserForCredentials; } -
trunk/Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp
r234896 r234941 103 103 } 104 104 105 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)106 NetworkProcess::singleton().canAuthenticateAgainstProtectionSpace(challenge.protectionSpace(), m_parameters.pageID, m_parameters.frameID, [this, weakThis = makeWeakPtr(this), completionHandler = WTFMove(completionHandler), challenge = WTFMove(challenge)] (bool canAuthenticate) mutable {107 if (!canAuthenticate)108 return completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpace, { });109 NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge(m_parameters.pageID, m_parameters.frameID, challenge, WTFMove(completionHandler));110 });111 #else112 105 NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge(m_parameters.pageID, m_parameters.frameID, challenge, WTFMove(completionHandler)); 113 #endif114 106 } 115 107 -
trunk/Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.h
r234896 r234941 40 40 namespace WebKit { 41 41 42 class NetworkCORSPreflightChecker final : private NetworkDataTaskClient , public CanMakeWeakPtr<NetworkCORSPreflightChecker>{42 class NetworkCORSPreflightChecker final : private NetworkDataTaskClient { 43 43 WTF_MAKE_FAST_ALLOCATED; 44 44 public: -
trunk/Source/WebKit/NetworkProcess/NetworkLoad.cpp
r234896 r234941 43 43 #if PLATFORM(COCOA) 44 44 #include "NetworkDataTaskCocoa.h" 45 #include "NetworkSessionCocoa.h" 45 46 #endif 46 47 … … 122 123 if (m_responseCompletionHandler) 123 124 m_responseCompletionHandler(PolicyAction::Ignore); 124 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)125 if (m_challengeCompletionHandler)126 m_challengeCompletionHandler(AuthenticationChallengeDisposition::Cancel, { });127 #endif128 125 if (m_task) 129 126 m_task->clearClient(); … … 257 254 void NetworkLoad::didReceiveChallenge(AuthenticationChallenge&& challenge, ChallengeCompletionHandler&& completionHandler) 258 255 { 259 m_challenge = challenge; 260 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 261 m_challengeCompletionHandler = WTFMove(completionHandler); 262 m_client.get().canAuthenticateAgainstProtectionSpaceAsync(challenge.protectionSpace()); 263 #else 264 completeAuthenticationChallenge(WTFMove(completionHandler)); 265 #endif 266 } 267 268 void NetworkLoad::completeAuthenticationChallenge(ChallengeCompletionHandler&& completionHandler) 269 { 270 auto scheme = m_challenge->protectionSpace().authenticationScheme(); 256 auto scheme = challenge.protectionSpace().authenticationScheme(); 271 257 bool isTLSHandshake = scheme == ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested 272 258 || scheme == ProtectionSpaceAuthenticationSchemeClientCertificateRequested; … … 277 263 } 278 264 279 if (!m_task) 280 return; 281 265 #if PLATFORM(COCOA) 266 if (scheme == ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested 267 && NetworkSessionCocoa::allowsSpecificHTTPSCertificateForHost(challenge)) 268 return completionHandler(AuthenticationChallengeDisposition::UseCredential, serverTrustCredential(challenge)); 269 #endif 270 282 271 if (auto* pendingDownload = m_task->pendingDownload()) 283 NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge(*pendingDownload, *m_challenge, WTFMove(completionHandler));272 NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge(*pendingDownload, challenge, WTFMove(completionHandler)); 284 273 else 285 NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge(m_parameters.webPageID, m_parameters.webFrameID, *m_challenge, WTFMove(completionHandler)); 286 } 287 288 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 289 void NetworkLoad::continueCanAuthenticateAgainstProtectionSpace(bool result) 290 { 291 if (!m_challengeCompletionHandler) { 292 ASSERT_NOT_REACHED(); 293 return; 294 } 295 296 auto completionHandler = std::exchange(m_challengeCompletionHandler, nullptr); 297 if (!result) { 298 if (NetworkSession::allowsSpecificHTTPSCertificateForHost(*m_challenge)) 299 completionHandler(AuthenticationChallengeDisposition::UseCredential, serverTrustCredential(*m_challenge)); 300 else 301 completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpace, { }); 302 return; 303 } 304 305 completeAuthenticationChallenge(WTFMove(completionHandler)); 306 } 307 #endif 274 NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge(m_parameters.webPageID, m_parameters.webFrameID, challenge, WTFMove(completionHandler)); 275 } 308 276 309 277 void NetworkLoad::didReceiveResponseNetworkSession(ResourceResponse&& response, ResponseCompletionHandler&& completionHandler) -
trunk/Source/WebKit/NetworkProcess/NetworkLoad.h
r234896 r234941 70 70 bool shouldCaptureExtraNetworkLoadMetrics() const final; 71 71 72 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)73 void continueCanAuthenticateAgainstProtectionSpace(bool);74 #endif75 76 72 String description() const; 77 73 … … 96 92 void throttleDelayCompleted(); 97 93 98 void completeAuthenticationChallenge(ChallengeCompletionHandler&&);99 100 94 std::reference_wrapper<NetworkLoadClient> m_client; 101 95 const NetworkLoadParameters m_parameters; 102 96 CompletionHandler<void(WebCore::ResourceRequest&&)> m_redirectCompletionHandler; 103 97 RefPtr<NetworkDataTask> m_task; 104 std::optional<WebCore::AuthenticationChallenge> m_challenge;105 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)106 ChallengeCompletionHandler m_challengeCompletionHandler;107 #endif108 98 ResponseCompletionHandler m_responseCompletionHandler; 109 99 -
trunk/Source/WebKit/NetworkProcess/NetworkLoadClient.h
r228231 r234941 48 48 49 49 virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) = 0; 50 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)51 virtual void canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace&) = 0;52 #endif53 50 virtual void willSendRedirectedRequest(WebCore::ResourceRequest&&, WebCore::ResourceRequest&& redirectRequest, WebCore::ResourceResponse&& redirectResponse) = 0; 54 51 enum class ShouldContinueDidReceiveResponse { No, Yes }; -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r234896 r234941 668 668 downloadManager().cancelDownload(downloadID); 669 669 } 670 671 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)672 void NetworkProcess::canAuthenticateAgainstProtectionSpace(const WebCore::ProtectionSpace& protectionSpace, uint64_t pageID, uint64_t frameID, CompletionHandler<void(bool)>&& completionHandler)673 {674 static uint64_t lastCompletionHandlerID = 0;675 uint64_t completionHandlerID = ++lastCompletionHandlerID;676 m_canAuthenticateAgainstProtectionSpaceCompletionHandlers.add(completionHandlerID, WTFMove(completionHandler));677 parentProcessConnection()->send(Messages::NetworkProcessProxy::CanAuthenticateAgainstProtectionSpace(completionHandlerID, pageID, frameID, protectionSpace), 0);678 }679 680 void NetworkProcess::continueCanAuthenticateAgainstProtectionSpace(uint64_t completionHandlerID, bool canAuthenticate)681 {682 if (auto completionHandler = m_canAuthenticateAgainstProtectionSpaceCompletionHandlers.take(completionHandlerID)) {683 completionHandler(canAuthenticate);684 return;685 }686 ASSERT_NOT_REACHED();687 }688 689 #endif690 670 691 671 void NetworkProcess::continueWillSendRequest(DownloadID downloadID, WebCore::ResourceRequest&& request) -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r234910 r234941 124 124 void findPendingDownloadLocation(NetworkDataTask&, ResponseCompletionHandler&&, const WebCore::ResourceResponse&); 125 125 126 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)127 void canAuthenticateAgainstProtectionSpace(const WebCore::ProtectionSpace&, uint64_t pageID, uint64_t frameID, CompletionHandler<void(bool)>&&);128 #endif129 130 126 void prefetchDNS(const String&); 131 127 … … 223 219 void resumeDownload(PAL::SessionID, DownloadID, const IPC::DataReference& resumeData, const String& path, SandboxExtension::Handle&&); 224 220 void cancelDownload(DownloadID); 225 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)226 void continueCanAuthenticateAgainstProtectionSpace(uint64_t completionHandlerID, bool canAuthenticate);227 #endif228 221 void continueWillSendRequest(DownloadID, WebCore::ResourceRequest&&); 229 222 void continueDecidePendingDownloadDestination(DownloadID, String destination, SandboxExtension::Handle&&, bool allowOverwrite); … … 284 277 285 278 HashMap<uint64_t, Function<void()>> m_sandboxExtensionForBlobsCompletionHandlers; 286 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)287 HashMap<uint64_t, CompletionHandler<void(bool)>> m_canAuthenticateAgainstProtectionSpaceCompletionHandlers;288 #endif289 279 HashSet<PAL::SessionID> m_sessionsControlledByAutomation; 290 280 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in
r234440 r234941 47 47 CancelDownload(WebKit::DownloadID downloadID) 48 48 49 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)50 ContinueCanAuthenticateAgainstProtectionSpace(uint64_t loaderID, bool canAuthenticate)51 #endif52 49 ContinueWillSendRequest(WebKit::DownloadID downloadID, WebCore::ResourceRequest request) 53 50 ContinueDecidePendingDownloadDestination(WebKit::DownloadID downloadID, String destination, WebKit::SandboxExtension::Handle sandboxExtensionHandle, bool allowOverwrite) -
trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
r234896 r234941 936 936 } 937 937 938 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)939 void NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync(const ProtectionSpace& protectionSpace)940 {941 NetworkProcess::singleton().canAuthenticateAgainstProtectionSpace(protectionSpace, pageID(), frameID(), [this, protectedThis = makeRef(*this)] (bool result) {942 if (m_networkLoad)943 m_networkLoad->continueCanAuthenticateAgainstProtectionSpace(result);944 });945 }946 #endif947 948 938 bool NetworkResourceLoader::isAlwaysOnLoggingAllowed() const 949 939 { -
trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.h
r234896 r234941 95 95 // NetworkLoadClient. 96 96 void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override; 97 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)98 void canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace&) override;99 #endif100 97 bool isSynchronous() const override; 101 98 bool isAllowedToAskUserForCredentials() const override { return m_isAllowedToAskUserForCredentials; } -
trunk/Source/WebKit/NetworkProcess/PreconnectTask.cpp
r234896 r234941 97 97 } 98 98 99 void PreconnectTask::canAuthenticateAgainstProtectionSpaceAsync(const ProtectionSpace& protectionSpace)100 {101 if (!pageID()) {102 // The preconnect was started by the UIProcess.103 m_networkLoad->continueCanAuthenticateAgainstProtectionSpace(false);104 return;105 }106 NetworkProcess::singleton().canAuthenticateAgainstProtectionSpace(protectionSpace, pageID(), frameID(), [weakThis = makeWeakPtr(this)] (bool result) {107 if (weakThis)108 weakThis->m_networkLoad->continueCanAuthenticateAgainstProtectionSpace(result);109 });110 }111 112 99 void PreconnectTask::didFinish(const ResourceError& error) 113 100 { -
trunk/Source/WebKit/NetworkProcess/PreconnectTask.h
r234896 r234941 38 38 class NetworkLoadParameters; 39 39 40 class PreconnectTask final : public NetworkLoadClient , public CanMakeWeakPtr<PreconnectTask>{40 class PreconnectTask final : public NetworkLoadClient { 41 41 public: 42 42 explicit PreconnectTask(NetworkLoadParameters&&, WTF::CompletionHandler<void(const WebCore::ResourceError&)>&& completionHandler = { }); … … 51 51 bool isAllowedToAskUserForCredentials() const final { return false; } 52 52 void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) final; 53 void canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace&) final;54 53 void willSendRedirectedRequest(WebCore::ResourceRequest&&, WebCore::ResourceRequest&& redirectRequest, WebCore::ResourceResponse&& redirectResponse) final; 55 54 ShouldContinueDidReceiveResponse didReceiveResponse(WebCore::ResourceResponse&&) final; -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp
r233668 r234941 123 123 } 124 124 125 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)126 void SpeculativeLoad::canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace&)127 {128 m_networkLoad->continueCanAuthenticateAgainstProtectionSpace(false);129 }130 #endif131 132 125 void SpeculativeLoad::didFailLoading(const ResourceError&) 133 126 { -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoad.h
r224134 r234941 54 54 // NetworkLoadClient. 55 55 void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override { } 56 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)57 void canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace&) override;58 #endif59 56 bool isSynchronous() const override { return false; } 60 57 bool isAllowedToAskUserForCredentials() const final { return false; } -
trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.cpp
r231916 r234941 112 112 void AuthenticationManager::didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const AuthenticationChallenge& authenticationChallenge, ChallengeCompletionHandler&& completionHandler) 113 113 { 114 ASSERT(pageID);115 ASSERT(frameID);114 if (!pageID || !frameID) // Initiated by SpeculativeLoadManager 115 return completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpace, { }); 116 116 117 117 uint64_t challengeID = addChallengeToChallengeMap({ pageID, authenticationChallenge, WTFMove(completionHandler) }); -
trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.h
r233654 r234941 69 69 void didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&); 70 70 void didReceiveAuthenticationChallenge(IPC::MessageSender& download, const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&); 71 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)72 void continueCanAuthenticateAgainstProtectionSpace(DownloadID, bool canAuthenticate);73 #endif74 71 75 72 void useCredentialForChallenge(uint64_t challengeID, const WebCore::Credential&); -
trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp
r234168 r234941 2298 2298 void didReceiveAuthenticationChallenge(WebPageProxy& page, AuthenticationChallengeProxy& authenticationChallenge) override 2299 2299 { 2300 if (m_client.canAuthenticateAgainstProtectionSpace && !m_client.canAuthenticateAgainstProtectionSpace(toAPI(&page), toAPI(authenticationChallenge.protectionSpace()), m_client.base.clientInfo)) 2301 return authenticationChallenge.rejectProtectionSpaceAndContinue(); 2300 2302 if (!m_client.didReceiveAuthenticationChallenge) 2301 return ;2303 return authenticationChallenge.rejectProtectionSpaceAndContinue(); 2302 2304 m_client.didReceiveAuthenticationChallenge(toAPI(&page), toAPI(&authenticationChallenge), m_client.base.clientInfo); 2303 2305 } -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h
r234903 r234941 76 76 - (void)_webView:(WKWebView *)webView renderingProgressDidChange:(_WKRenderingProgressEvents)progressEvents; 77 77 78 - (void)_webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge WK_API_DEPRECATED_WITH_REPLACEMENT("webView:didReceiveAuthenticationChallenge:completionHandler:", macosx(10.10, 10.13.4), ios(8.0, 11.3));79 80 78 - (void)_webViewWebProcessDidCrash:(WKWebView *)webView; 81 79 - (void)_webViewWebProcessDidBecomeResponsive:(WKWebView *)webView; -
trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h
r234903 r234941 109 109 void renderingProgressDidChange(WebPageProxy&, WebCore::LayoutMilestones) override; 110 110 111 bool canAuthenticateAgainstProtectionSpace(WebPageProxy&, WebProtectionSpace*) override;112 111 void didReceiveAuthenticationChallenge(WebPageProxy&, AuthenticationChallengeProxy&) override; 113 112 bool processDidTerminate(WebPageProxy&, ProcessTerminationReason) override; … … 208 207 bool webViewWebContentProcessDidTerminate : 1; 209 208 bool webViewWebContentProcessDidTerminateWithReason : 1; 210 bool webViewDidReceiveAuthenticationChallenge : 1;211 209 bool webViewWebProcessDidCrash : 1; 212 210 bool webViewWebProcessDidBecomeResponsive : 1; -
trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm
r234903 r234941 165 165 m_navigationDelegateMethods.webViewWebContentProcessDidTerminate = [delegate respondsToSelector:@selector(webViewWebContentProcessDidTerminate:)]; 166 166 m_navigationDelegateMethods.webViewWebContentProcessDidTerminateWithReason = [delegate respondsToSelector:@selector(_webView:webContentProcessDidTerminateWithReason:)]; 167 m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallenge = [delegate respondsToSelector:@selector(_webView:didReceiveAuthenticationChallenge:)];168 167 m_navigationDelegateMethods.webViewWebProcessDidCrash = [delegate respondsToSelector:@selector(_webViewWebProcessDidCrash:)]; 169 168 m_navigationDelegateMethods.webViewWebProcessDidBecomeResponsive = [delegate respondsToSelector:@selector(_webViewWebProcessDidBecomeResponsive:)]; … … 870 869 } 871 870 872 bool NavigationState::NavigationClient::canAuthenticateAgainstProtectionSpace(WebPageProxy&, WebProtectionSpace* protectionSpace)873 {874 return !!m_navigationState.m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallengeCompletionHandler;875 }876 877 871 void NavigationState::NavigationClient::didReceiveAuthenticationChallenge(WebPageProxy&, AuthenticationChallengeProxy& authenticationChallenge) 878 872 { 879 if (m_navigationState.m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallengeCompletionHandler) { 880 auto navigationDelegate = m_navigationState.m_navigationDelegate.get(); 881 if (!navigationDelegate) { 882 authenticationChallenge.listener()->performDefaultHandling(); 873 if (!m_navigationState.m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallengeCompletionHandler) 874 return authenticationChallenge.rejectProtectionSpaceAndContinue(); 875 876 auto navigationDelegate = m_navigationState.m_navigationDelegate.get(); 877 if (!navigationDelegate) 878 return authenticationChallenge.performDefaultHandling(); 879 880 auto checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(webView:didReceiveAuthenticationChallenge:completionHandler:)); 881 [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) { 882 if (checker->completionHandlerHasBeenCalled()) 883 883 return; 884 checker->didCallCompletionHandler(); 885 886 switch (disposition) { 887 case NSURLSessionAuthChallengeUseCredential: { 888 RefPtr<WebCredential> webCredential; 889 if (credential) 890 webCredential = WebCredential::create(WebCore::Credential(credential)); 891 892 challenge->useCredential(webCredential.get()); 893 break; 884 894 } 885 895 886 auto checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(webView:didReceiveAuthenticationChallenge:completionHandler:)); 887 [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) { 888 if (checker->completionHandlerHasBeenCalled()) 889 return; 890 checker->didCallCompletionHandler(); 891 892 switch (disposition) { 893 case NSURLSessionAuthChallengeUseCredential: { 894 RefPtr<WebCredential> webCredential; 895 if (credential) 896 webCredential = WebCredential::create(WebCore::Credential(credential)); 897 898 challenge->listener()->useCredential(webCredential.get()); 899 break; 900 } 901 902 case NSURLSessionAuthChallengePerformDefaultHandling: 903 challenge->listener()->performDefaultHandling(); 904 break; 905 906 case NSURLSessionAuthChallengeCancelAuthenticationChallenge: 907 challenge->listener()->cancel(); 908 break; 909 910 case NSURLSessionAuthChallengeRejectProtectionSpace: 911 challenge->listener()->rejectProtectionSpaceAndContinue(); 912 break; 913 914 default: 915 [NSException raise:NSInvalidArgumentException format:@"Invalid NSURLSessionAuthChallengeDisposition (%ld)", (long)disposition]; 916 } 917 }).get()]; 918 return; 919 } 920 921 if (!m_navigationState.m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallenge) 922 return; 923 924 auto navigationDelegate = m_navigationState.m_navigationDelegate.get(); 925 if (!navigationDelegate) 926 return; 927 928 #pragma clang diagnostic push 929 #pragma clang diagnostic ignored "-Wdeprecated-declarations" 930 [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webView:m_navigationState.m_webView didReceiveAuthenticationChallenge:wrapper(authenticationChallenge)]; 931 #pragma clang diagnostic pop 896 case NSURLSessionAuthChallengePerformDefaultHandling: 897 challenge->performDefaultHandling(); 898 break; 899 900 case NSURLSessionAuthChallengeCancelAuthenticationChallenge: 901 challenge->cancel(); 902 break; 903 904 case NSURLSessionAuthChallengeRejectProtectionSpace: 905 challenge->rejectProtectionSpaceAndContinue(); 906 break; 907 908 default: 909 [NSException raise:NSInvalidArgumentException format:@"Invalid NSURLSessionAuthChallengeDisposition (%ld)", (long)disposition]; 910 } 911 }).get()]; 932 912 } 933 913 -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r234440 r234941 400 400 } 401 401 402 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)403 void NetworkProcessProxy::canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, const WebCore::ProtectionSpace& protectionSpace)404 {405 // NetworkProcess state cannot asynchronously be kept in sync with these objects406 // like we expect WebProcess <-> UIProcess state to be kept in sync.407 // So there's no guarantee the messaged WebPageProxy or WebFrameProxy exist here in the UIProcess.408 // We need to validate both the page and the frame up front.409 if (auto* page = WebProcessProxy::webPage(pageID)) {410 if (page->process().webFrame(frameID)) {411 page->canAuthenticateAgainstProtectionSpace(loaderID, frameID, protectionSpace);412 return;413 }414 #if ENABLE(SERVICE_WORKER)415 } else if (m_processPool.serviceWorkerProcessProxyFromPageID(pageID)) {416 send(Messages::NetworkProcess::ContinueCanAuthenticateAgainstProtectionSpace(loaderID, true), 0);417 return;418 #endif419 }420 // In the case where we will not be able to reply to this message with a client reply,421 // we should message back a default to the Networking process.422 send(Messages::NetworkProcess::ContinueCanAuthenticateAgainstProtectionSpace(loaderID, false), 0);423 }424 #endif425 426 402 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 427 403 void NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor(PAL::SessionID sessionID, const Vector<String>& domainsToBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& completionHandler) -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
r234440 r234941 144 144 void logDiagnosticMessageWithResult(uint64_t pageID, const String& message, const String& description, uint32_t result, WebCore::ShouldSample); 145 145 void logDiagnosticMessageWithValue(uint64_t pageID, const String& message, const String& description, double value, unsigned significantFigures, WebCore::ShouldSample); 146 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)147 void canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, const WebCore::ProtectionSpace&);148 #endif149 146 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 150 147 void didUpdateBlockCookies(uint64_t contextId); -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in
r234440 r234941 44 44 LogDiagnosticMessageWithValue(uint64_t pageID, String message, String description, double value, unsigned significantFigures, enum WebCore::ShouldSample shouldSample) 45 45 46 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)47 CanAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, WebCore::ProtectionSpace protectionSpace)48 #endif49 46 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 50 47 DidUpdateBlockCookies(uint64_t callbackId) -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r234920 r234941 6390 6390 #endif 6391 6391 6392 void WebPageProxy::canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t frameID, const ProtectionSpace& coreProtectionSpace)6393 {6394 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)6395 WebFrameProxy* frame = m_process->webFrame(frameID);6396 MESSAGE_CHECK(frame);6397 6398 RefPtr<WebProtectionSpace> protectionSpace = WebProtectionSpace::create(coreProtectionSpace);6399 6400 bool canAuthenticate;6401 if (m_navigationClient)6402 canAuthenticate = m_navigationClient->canAuthenticateAgainstProtectionSpace(*this, protectionSpace.get());6403 else6404 canAuthenticate = m_loaderClient->canAuthenticateAgainstProtectionSpaceInFrame(*this, *frame, protectionSpace.get());6405 6406 m_process->processPool().sendToNetworkingProcess(Messages::NetworkProcess::ContinueCanAuthenticateAgainstProtectionSpace(loaderID, canAuthenticate));6407 #endif6408 }6409 6410 6392 void WebPageProxy::didReceiveAuthenticationChallengeProxy(uint64_t frameID, Ref<AuthenticationChallengeProxy>&& authenticationChallenge) 6411 6393 { -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r234920 r234941 1291 1291 bool isAlwaysOnLoggingAllowed() const; 1292 1292 1293 void canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t frameID, const WebCore::ProtectionSpace&);1294 1295 1293 #if ENABLE(GAMEPAD) 1296 1294 void gamepadActivity(const Vector<GamepadData>&, bool shouldMakeGamepadsVisible);
Note: See TracChangeset
for help on using the changeset viewer.