Changeset 223790 in webkit
- Timestamp:
- Oct 20, 2017 1:38:41 PM (7 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r223785 r223790 1 2017-10-20 Alex Christensen <achristensen@webkit.org> 2 3 Add ObjC SPI to _WKDownloadDelegate missing from WKContextDownloadClient 4 https://bugs.webkit.org/show_bug.cgi?id=178566 5 <rdar://problem/23041906> 6 7 Reviewed by Brady Eidson. 8 9 * UIProcess/API/Cocoa/_WKDownloadDelegate.h: 10 * UIProcess/Cocoa/DownloadClient.h: 11 * UIProcess/Cocoa/DownloadClient.mm: 12 (WebKit::DownloadClient::DownloadClient): 13 (WebKit::DownloadClient::didReceiveAuthenticationChallenge): 14 (WebKit::DownloadClient::shouldDecodeSourceDataOfMIMEType): 15 (WebKit::DownloadClient::didCreateDestination): 16 (WebKit::DownloadClient::processDidCrash): 17 1 18 2017-10-20 Youenn Fablet <youenn@apple.com> 2 19 -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKDownloadDelegate.h
r223740 r223790 42 42 - (void)_download:(_WKDownload *)download didFailWithError:(NSError *)error; 43 43 - (void)_downloadDidCancel:(_WKDownload *)download; 44 - (void)_download:(_WKDownload *)download didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential*))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 45 - (void)_download:(_WKDownload *)download didCreateDestination:(NSString *)destination WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 46 - (void)_downloadProcessDidCrash:(_WKDownload *)download WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 47 - (BOOL)_download:(_WKDownload *)download shouldDecodeSourceDataOfMIMEType:(NSString *)MIMEType WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 44 48 45 49 - (NSString *)_download:(_WKDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename allowOverwrite:(BOOL *)allowOverwrite WK_API_DEPRECATED_WITH_REPLACEMENT("_download:decideDestinationWithSuggestedFilename:completionHandler:", macosx(10.10, WK_MAC_TBA), ios(8.0, WK_IOS_TBA)); -
trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.h
r223740 r223790 56 56 void didCancel(WebProcessPool&, DownloadProxy&) final; 57 57 void willSendRequest(WebProcessPool&, DownloadProxy&, WebCore::ResourceRequest&&, const WebCore::ResourceResponse&, Function<void(WebCore::ResourceRequest&&)>&&) final; 58 void didReceiveAuthenticationChallenge(WebProcessPool&, DownloadProxy&, AuthenticationChallengeProxy&) final; 59 #if !USE(NETWORK_SESSION) 60 bool shouldDecodeSourceDataOfMIMEType(WebProcessPool&, DownloadProxy&, const String&) final; 61 #endif 62 void didCreateDestination(WebProcessPool&, DownloadProxy&, const String&) final; 63 void processDidCrash(WebProcessPool&, DownloadProxy&) final; 58 64 59 65 WeakObjCPtr<id <_WKDownloadDelegate>> m_delegate; … … 69 75 bool downloadDidCancel : 1; 70 76 bool downloadDidReceiveServerRedirectToURL : 1; 77 bool downloadDidReceiveAuthenticationChallengeCompletionHandler : 1; 78 bool downloadShouldDecodeSourceDataOfMIMEType : 1; 79 bool downloadDidCreateDestination : 1; 80 bool downloadProcessDidCrash : 1; 71 81 } m_delegateMethods; 72 82 }; -
trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm
r223740 r223790 29 29 #if WK_API_ENABLED 30 30 31 #import "AuthenticationChallengeProxy.h" 32 #import "AuthenticationDecisionListener.h" 31 33 #import "CompletionHandlerCallChecker.h" 32 34 #import "DownloadProxy.h" 35 #import "WKNSURLAuthenticationChallenge.h" 33 36 #import "WKNSURLExtras.h" 37 #import "WebCredential.h" 34 38 #import "_WKDownloadDelegate.h" 35 39 #import "_WKDownloadInternal.h" … … 58 62 m_delegateMethods.downloadDidCancel = [delegate respondsToSelector:@selector(_downloadDidCancel:)]; 59 63 m_delegateMethods.downloadDidReceiveServerRedirectToURL = [delegate respondsToSelector:@selector(_download:didReceiveServerRedirectToURL:)]; 64 m_delegateMethods.downloadDidReceiveAuthenticationChallengeCompletionHandler = [delegate respondsToSelector:@selector(_download:didReceiveAuthenticationChallenge:completionHandler:)]; 65 m_delegateMethods.downloadShouldDecodeSourceDataOfMIMEType = [delegate respondsToSelector:@selector(_download:shouldDecodeSourceDataOfMIMEType:)]; 66 m_delegateMethods.downloadDidCreateDestination = [delegate respondsToSelector:@selector(_download:didCreateDestination:)]; 67 m_delegateMethods.downloadProcessDidCrash = [delegate respondsToSelector:@selector(_downloadProcessDidCrash:)]; 60 68 } 61 69 … … 76 84 if (m_delegateMethods.downloadDidReceiveData) 77 85 [m_delegate _download:wrapper(downloadProxy) didReceiveData:length]; 86 } 87 88 void DownloadClient::didReceiveAuthenticationChallenge(WebProcessPool&, DownloadProxy& downloadProxy, AuthenticationChallengeProxy& authenticationChallenge) 89 { 90 if (!m_delegateMethods.downloadDidReceiveAuthenticationChallengeCompletionHandler) { 91 authenticationChallenge.listener()->performDefaultHandling(); 92 return; 93 } 94 95 [m_delegate _download:wrapper(downloadProxy) didReceiveAuthenticationChallenge:wrapper(authenticationChallenge) completionHandler:BlockPtr<void(NSURLSessionAuthChallengeDisposition, NSURLCredential *)>::fromCallable([authenticationChallenge = makeRef(authenticationChallenge), checker = CompletionHandlerCallChecker::create(m_delegate.get().get(), @selector(_download:didReceiveAuthenticationChallenge:completionHandler:))] (NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential) { 96 if (checker->completionHandlerHasBeenCalled()) 97 return; 98 checker->didCallCompletionHandler(); 99 switch (disposition) { 100 case NSURLSessionAuthChallengeUseCredential: { 101 RefPtr<WebCredential> webCredential; 102 if (credential) 103 webCredential = WebCredential::create(WebCore::Credential(credential)); 104 105 authenticationChallenge->listener()->useCredential(webCredential.get()); 106 break; 107 } 108 109 case NSURLSessionAuthChallengePerformDefaultHandling: 110 authenticationChallenge->listener()->performDefaultHandling(); 111 break; 112 113 case NSURLSessionAuthChallengeCancelAuthenticationChallenge: 114 authenticationChallenge->listener()->cancel(); 115 break; 116 117 case NSURLSessionAuthChallengeRejectProtectionSpace: 118 authenticationChallenge->listener()->rejectProtectionSpaceAndContinue(); 119 break; 120 121 default: 122 [NSException raise:NSInvalidArgumentException format:@"Invalid NSURLSessionAuthChallengeDisposition (%ld)", (long)disposition]; 123 } 124 }).get()]; 125 } 126 127 #if !USE(NETWORK_SESSION) 128 bool DownloadClient::shouldDecodeSourceDataOfMIMEType(WebProcessPool&, DownloadProxy& downloadProxy, const String& mimeType) 129 { 130 if (m_delegateMethods.downloadShouldDecodeSourceDataOfMIMEType) 131 return [m_delegate _download:wrapper(downloadProxy) shouldDecodeSourceDataOfMIMEType:mimeType]; 132 return true; 133 } 134 #endif 135 136 void DownloadClient::didCreateDestination(WebProcessPool&, DownloadProxy& downloadProxy, const String& destination) 137 { 138 if (m_delegateMethods.downloadDidCreateDestination) 139 [m_delegate _download:wrapper(downloadProxy) didCreateDestination:destination]; 140 } 141 142 void DownloadClient::processDidCrash(WebProcessPool&, DownloadProxy& downloadProxy) 143 { 144 if (m_delegateMethods.downloadProcessDidCrash) 145 [m_delegate _downloadProcessDidCrash:wrapper(downloadProxy)]; 78 146 } 79 147
Note: See TracChangeset
for help on using the changeset viewer.