Changeset 250292 in webkit
- Timestamp:
- Sep 24, 2019, 6:58:40 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r250291 r250292 1 2019-09-24 Alex Christensen <achristensen@webkit.org> 2 3 Require a WebsiteDataStore when creating or resuming downloads 4 https://bugs.webkit.org/show_bug.cgi?id=202081 5 6 Reviewed by Youenn Fablet. 7 8 No change in behavior, but I'll have to move Safari to the new SPI. 9 This makes it so there are no cases where we guess we need to use the default session, 10 and it allows downloads to function correctly once there is a NetworkProcess singleton. 11 Removing the unused WebProcessPool& in the callbacks will allow us to eventually have 12 downloads only associated with a WebsiteDataStore and not a WebProcessPool. 13 14 * UIProcess/API/APIDownloadClient.h: 15 (API::DownloadClient::didStart): 16 (API::DownloadClient::didReceiveAuthenticationChallenge): 17 (API::DownloadClient::didReceiveResponse): 18 (API::DownloadClient::didReceiveData): 19 (API::DownloadClient::decideDestinationWithSuggestedFilename): 20 (API::DownloadClient::didCreateDestination): 21 (API::DownloadClient::didFinish): 22 (API::DownloadClient::didFail): 23 (API::DownloadClient::didCancel): 24 (API::DownloadClient::processDidCrash): 25 (API::DownloadClient::willSendRequest): 26 * UIProcess/API/C/WKContext.cpp: 27 (WKContextSetDownloadClient): 28 (WKContextDownloadURLRequest): 29 (WKContextResumeDownload): 30 * UIProcess/API/C/WKContext.h: 31 * UIProcess/API/Cocoa/WKProcessPool.mm: 32 (-[WKProcessPool _setDownloadDelegate:]): 33 (-[WKProcessPool _downloadURLRequest:originatingWebView:]): 34 (-[WKProcessPool _resumeDownloadFromData:path:originatingWebView:]): 35 (-[WKProcessPool _downloadURLRequest:websiteDataStore:originatingWebView:]): 36 (-[WKProcessPool _resumeDownloadFromData:websiteDataStore:path:originatingWebView:]): 37 * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: 38 * UIProcess/API/glib/WebKitDownloadClient.cpp: 39 * UIProcess/API/glib/WebKitWebContext.cpp: 40 (webkitWebContextDispose): 41 (webkitWebContextStartDownload): 42 * UIProcess/Cocoa/DownloadClient.h: 43 * UIProcess/Cocoa/DownloadClient.mm: 44 (WebKit::DownloadClient::didStart): 45 (WebKit::DownloadClient::didReceiveResponse): 46 (WebKit::DownloadClient::didReceiveData): 47 (WebKit::DownloadClient::didReceiveAuthenticationChallenge): 48 (WebKit::DownloadClient::didCreateDestination): 49 (WebKit::DownloadClient::processDidCrash): 50 (WebKit::DownloadClient::decideDestinationWithSuggestedFilename): 51 (WebKit::DownloadClient::didFinish): 52 (WebKit::DownloadClient::didFail): 53 (WebKit::DownloadClient::didCancel): 54 (WebKit::DownloadClient::willSendRequest): 55 * UIProcess/Downloads/DownloadProxy.cpp: 56 (WebKit::DownloadProxy::create): 57 (WebKit::DownloadProxy::DownloadProxy): 58 (WebKit::DownloadProxy::invalidate): 59 (WebKit::DownloadProxy::processDidClose): 60 (WebKit::DownloadProxy::didStart): 61 (WebKit::DownloadProxy::didReceiveAuthenticationChallenge): 62 (WebKit::DownloadProxy::willSendRequest): 63 (WebKit::DownloadProxy::didReceiveResponse): 64 (WebKit::DownloadProxy::didReceiveData): 65 (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync): 66 (WebKit::DownloadProxy::didCreateDestination): 67 (WebKit::DownloadProxy::didFinish): 68 (WebKit::DownloadProxy::didFail): 69 (WebKit::DownloadProxy::didCancel): 70 * UIProcess/Downloads/DownloadProxy.h: 71 * UIProcess/Downloads/DownloadProxyMap.cpp: 72 (WebKit::DownloadProxyMap::createDownloadProxy): 73 * UIProcess/Downloads/DownloadProxyMap.h: 74 * UIProcess/Network/NetworkProcessProxy.cpp: 75 (WebKit::NetworkProcessProxy::createDownloadProxy): 76 * UIProcess/Network/NetworkProcessProxy.h: 77 * UIProcess/WebPageProxy.cpp: 78 (WebKit::WebPageProxy::receivedPolicyDecision): 79 (WebKit::WebPageProxy::contextMenuItemSelected): 80 * UIProcess/WebProcessPool.cpp: 81 (WebKit::WebProcessPool::WebProcessPool): 82 (WebKit::WebProcessPool::setDownloadClient): 83 (WebKit::WebProcessPool::download): 84 (WebKit::WebProcessPool::resumeDownload): 85 (WebKit::WebProcessPool::createDownloadProxy): 86 * UIProcess/WebProcessPool.h: 87 1 88 2019-09-24 Youenn Fablet <youenn@apple.com> 2 89 -
trunk/Source/WebKit/UIProcess/API/APIDownloadClient.h
r248762 r250292 26 26 #pragma once 27 27 28 #include "AuthenticationChallengeDisposition.h" 29 #include "AuthenticationChallengeProxy.h" 30 #include "AuthenticationDecisionListener.h" 28 31 #include <wtf/CompletionHandler.h> 29 32 #include <wtf/text/WTFString.h> … … 38 41 class AuthenticationChallengeProxy; 39 42 class DownloadProxy; 40 class Web ProcessPool;43 class WebsiteDataStore; 41 44 class WebProtectionSpace; 42 45 … … 51 54 virtual ~DownloadClient() { } 52 55 53 virtual void didStart(WebKit:: WebProcessPool&, WebKit::DownloadProxy&) { }54 virtual void didReceiveAuthenticationChallenge(WebKit:: WebProcessPool&, WebKit::DownloadProxy&, WebKit::AuthenticationChallengeProxy&) {}55 virtual void didReceiveResponse(WebKit:: WebProcessPool&, WebKit::DownloadProxy&, const WebCore::ResourceResponse&) { }56 virtual void didReceiveData(WebKit:: WebProcessPool&, WebKit::DownloadProxy&, uint64_t) { }57 virtual void decideDestinationWithSuggestedFilename(WebKit:: WebProcessPool&, WebKit::DownloadProxy&, const WTF::String&, Function<void(WebKit::AllowOverwrite, WTF::String)>&& completionHandler) { completionHandler(WebKit::AllowOverwrite::No, { }); }58 virtual void didCreateDestination(WebKit:: WebProcessPool&, WebKit::DownloadProxy&, const WTF::String&) { }59 virtual void didFinish(WebKit:: WebProcessPool&, WebKit::DownloadProxy&) { }60 virtual void didFail(WebKit:: WebProcessPool&, WebKit::DownloadProxy&, const WebCore::ResourceError&) { }61 virtual void didCancel(WebKit:: WebProcessPool&, WebKit::DownloadProxy&) { }62 virtual void processDidCrash(WebKit:: WebProcessPool&, WebKit::DownloadProxy&) { }63 virtual void willSendRequest(WebKit:: WebProcessPool&, WebKit::DownloadProxy&, WebCore::ResourceRequest&& request, const WebCore::ResourceResponse&, CompletionHandler<void(WebCore::ResourceRequest&&)>&& completionHandler) { completionHandler(WTFMove(request)); }56 virtual void didStart(WebKit::DownloadProxy&) { } 57 virtual void didReceiveAuthenticationChallenge(WebKit::DownloadProxy&, WebKit::AuthenticationChallengeProxy& challenge) { challenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::Cancel); } 58 virtual void didReceiveResponse(WebKit::DownloadProxy&, const WebCore::ResourceResponse&) { } 59 virtual void didReceiveData(WebKit::DownloadProxy&, uint64_t) { } 60 virtual void decideDestinationWithSuggestedFilename(WebKit::DownloadProxy&, const WTF::String&, Function<void(WebKit::AllowOverwrite, WTF::String)>&& completionHandler) { completionHandler(WebKit::AllowOverwrite::No, { }); } 61 virtual void didCreateDestination(WebKit::DownloadProxy&, const WTF::String&) { } 62 virtual void didFinish(WebKit::DownloadProxy&) { } 63 virtual void didFail(WebKit::DownloadProxy&, const WebCore::ResourceError&) { } 64 virtual void didCancel(WebKit::DownloadProxy&) { } 65 virtual void processDidCrash(WebKit::DownloadProxy&) { } 66 virtual void willSendRequest(WebKit::DownloadProxy&, WebCore::ResourceRequest&& request, const WebCore::ResourceResponse&, CompletionHandler<void(WebCore::ResourceRequest&&)>&& completionHandler) { completionHandler(WTFMove(request)); } 64 67 }; 65 68 -
trunk/Source/WebKit/UIProcess/API/C/WKContext.cpp
r250169 r250292 169 169 } 170 170 171 void WKContextSetDownloadClient(WKContextRef context Ref, const WKContextDownloadClientBase* wkClient)171 void WKContextSetDownloadClient(WKContextRef context, const WKContextDownloadClientBase* wkClient) 172 172 { 173 173 class DownloadClient final : public API::Client<WKContextDownloadClientBase>, public API::DownloadClient { 174 174 public: 175 explicit DownloadClient(const WKContextDownloadClientBase* client) 175 explicit DownloadClient(const WKContextDownloadClientBase* client, WKContextRef context) 176 : m_context(context) 176 177 { 177 178 initialize(client); 178 179 } 179 180 private: 180 void didStart(WebKit:: WebProcessPool& processPool, WebKit::DownloadProxy& downloadProxy) final181 void didStart(WebKit::DownloadProxy& downloadProxy) final 181 182 { 182 183 if (!m_client.didStart) 183 184 return; 184 185 m_client.didStart(WebKit::toAPI(&processPool), WebKit::toAPI(&downloadProxy), m_client.base.clientInfo); 186 } 187 188 void didReceiveAuthenticationChallenge(WebKit::WebProcessPool& processPool, WebKit::DownloadProxy& downloadProxy, WebKit::AuthenticationChallengeProxy& authenticationChallengeProxy) final 185 m_client.didStart(m_context, WebKit::toAPI(&downloadProxy), m_client.base.clientInfo); 186 } 187 void didReceiveAuthenticationChallenge(WebKit::DownloadProxy& downloadProxy, WebKit::AuthenticationChallengeProxy& authenticationChallengeProxy) final 189 188 { 190 189 if (!m_client.didReceiveAuthenticationChallenge) 191 190 return; 192 193 m_client.didReceiveAuthenticationChallenge(WebKit::toAPI(&processPool), WebKit::toAPI(&downloadProxy), WebKit::toAPI(&authenticationChallengeProxy), m_client.base.clientInfo); 194 } 195 196 void didReceiveResponse(WebKit::WebProcessPool& processPool, WebKit::DownloadProxy& downloadProxy, const WebCore::ResourceResponse& response) final 191 m_client.didReceiveAuthenticationChallenge(m_context, WebKit::toAPI(&downloadProxy), WebKit::toAPI(&authenticationChallengeProxy), m_client.base.clientInfo); 192 } 193 void didReceiveResponse(WebKit::DownloadProxy& downloadProxy, const WebCore::ResourceResponse& response) final 197 194 { 198 195 if (!m_client.didReceiveResponse) 199 196 return; 200 201 m_client.didReceiveResponse(WebKit::toAPI(&processPool), WebKit::toAPI(&downloadProxy), WebKit::toAPI(API::URLResponse::create(response).ptr()), m_client.base.clientInfo); 202 } 203 204 void didReceiveData(WebKit::WebProcessPool& processPool, WebKit::DownloadProxy& downloadProxy, uint64_t length) final 197 m_client.didReceiveResponse(m_context, WebKit::toAPI(&downloadProxy), WebKit::toAPI(API::URLResponse::create(response).ptr()), m_client.base.clientInfo); 198 } 199 void didReceiveData(WebKit::DownloadProxy& downloadProxy, uint64_t length) final 205 200 { 206 201 if (!m_client.didReceiveData) 207 202 return; 208 209 m_client.didReceiveData(WebKit::toAPI(&processPool), WebKit::toAPI(&downloadProxy), length, m_client.base.clientInfo); 210 } 211 212 void decideDestinationWithSuggestedFilename(WebKit::WebProcessPool& processPool, WebKit::DownloadProxy& downloadProxy, const String& filename, Function<void(WebKit::AllowOverwrite, WTF::String)>&& completionHandler) final 203 m_client.didReceiveData(m_context, WebKit::toAPI(&downloadProxy), length, m_client.base.clientInfo); 204 } 205 void decideDestinationWithSuggestedFilename(WebKit::DownloadProxy& downloadProxy, const String& filename, Function<void(WebKit::AllowOverwrite, WTF::String)>&& completionHandler) final 213 206 { 214 207 if (!m_client.decideDestinationWithSuggestedFilename) 215 208 return completionHandler(WebKit::AllowOverwrite::No, { }); 216 217 209 bool allowOverwrite = false; 218 auto destination = adoptWK(m_client.decideDestinationWithSuggestedFilename( WebKit::toAPI(&processPool), WebKit::toAPI(&downloadProxy), WebKit::toAPI(filename.impl()), &allowOverwrite, m_client.base.clientInfo));210 auto destination = adoptWK(m_client.decideDestinationWithSuggestedFilename(m_context, WebKit::toAPI(&downloadProxy), WebKit::toAPI(filename.impl()), &allowOverwrite, m_client.base.clientInfo)); 219 211 completionHandler(allowOverwrite ? WebKit::AllowOverwrite::Yes : WebKit::AllowOverwrite::No, WebKit::toWTFString(destination.get())); 220 212 } 221 222 void didCreateDestination(WebKit::WebProcessPool& processPool, WebKit::DownloadProxy& downloadProxy, const String& path) final 213 void didCreateDestination(WebKit::DownloadProxy& downloadProxy, const String& path) final 223 214 { 224 215 if (!m_client.didCreateDestination) 225 216 return; 226 227 m_client.didCreateDestination(WebKit::toAPI(&processPool), WebKit::toAPI(&downloadProxy), WebKit::toAPI(path.impl()), m_client.base.clientInfo); 228 } 229 230 void didFinish(WebKit::WebProcessPool& processPool, WebKit::DownloadProxy& downloadProxy) final 217 m_client.didCreateDestination(m_context, WebKit::toAPI(&downloadProxy), WebKit::toAPI(path.impl()), m_client.base.clientInfo); 218 } 219 void didFinish(WebKit::DownloadProxy& downloadProxy) final 231 220 { 232 221 if (!m_client.didFinish) 233 222 return; 234 235 m_client.didFinish(WebKit::toAPI(&processPool), WebKit::toAPI(&downloadProxy), m_client.base.clientInfo); 236 } 237 238 void didFail(WebKit::WebProcessPool& processPool, WebKit::DownloadProxy& downloadProxy, const WebCore::ResourceError& error) final 223 m_client.didFinish(m_context, WebKit::toAPI(&downloadProxy), m_client.base.clientInfo); 224 } 225 void didFail(WebKit::DownloadProxy& downloadProxy, const WebCore::ResourceError& error) final 239 226 { 240 227 if (!m_client.didFail) 241 228 return; 242 243 m_client.didFail(WebKit::toAPI(&processPool), WebKit::toAPI(&downloadProxy), WebKit::toAPI(error), m_client.base.clientInfo); 244 } 245 246 void didCancel(WebKit::WebProcessPool& processPool, WebKit::DownloadProxy& downloadProxy) final 229 m_client.didFail(m_context, WebKit::toAPI(&downloadProxy), WebKit::toAPI(error), m_client.base.clientInfo); 230 } 231 void didCancel(WebKit::DownloadProxy& downloadProxy) final 247 232 { 248 233 if (!m_client.didCancel) 249 234 return; 250 251 m_client.didCancel(WebKit::toAPI(&processPool), WebKit::toAPI(&downloadProxy), m_client.base.clientInfo); 252 } 253 254 void processDidCrash(WebKit::WebProcessPool& processPool, WebKit::DownloadProxy& downloadProxy) final 235 m_client.didCancel(m_context, WebKit::toAPI(&downloadProxy), m_client.base.clientInfo); 236 } 237 void processDidCrash(WebKit::DownloadProxy& downloadProxy) final 255 238 { 256 239 if (!m_client.processDidCrash) 257 240 return; 258 259 m_client.processDidCrash(WebKit::toAPI(&processPool), WebKit::toAPI(&downloadProxy), m_client.base.clientInfo); 260 } 261 262 void willSendRequest(WebKit::WebProcessPool& processPool, WebKit::DownloadProxy& downloadProxy, WebCore::ResourceRequest&& request, const WebCore::ResourceResponse&, CompletionHandler<void(WebCore::ResourceRequest&&)>&& completionHandler) final 241 m_client.processDidCrash(m_context, WebKit::toAPI(&downloadProxy), m_client.base.clientInfo); 242 } 243 void willSendRequest(WebKit::DownloadProxy& downloadProxy, WebCore::ResourceRequest&& request, const WebCore::ResourceResponse&, CompletionHandler<void(WebCore::ResourceRequest&&)>&& completionHandler) final 263 244 { 264 245 if (m_client.didReceiveServerRedirect) 265 m_client.didReceiveServerRedirect(WebKit::toAPI(&processPool), WebKit::toAPI(&downloadProxy), WebKit::toURLRef(request.url().string().impl()), m_client.base.clientInfo); 266 246 m_client.didReceiveServerRedirect(m_context, WebKit::toAPI(&downloadProxy), WebKit::toURLRef(request.url().string().impl()), m_client.base.clientInfo); 267 247 completionHandler(WTFMove(request)); 268 248 } 249 WKContextRef m_context; 269 250 }; 270 271 WebKit::toImpl(contextRef)->setDownloadClient(makeUnique<DownloadClient>(wkClient)); 251 WebKit::toImpl(context)->setDownloadClient(makeUniqueRef<DownloadClient>(wkClient, context)); 272 252 } 273 253 … … 277 257 } 278 258 279 WKDownloadRef WKContextDownloadURLRequest(WKContextRef contextRef, WKURLRequestRef requestRef)280 { 281 return WebKit::toAPI(&WebKit::toImpl(contextRef)->download(0, WebKit::toImpl(requestRef)->resourceRequest()));282 } 283 284 WKDownloadRef WKContextResumeDownload(WKContextRef contextRef, WKDataRef resumeData, WKStringRef path)285 { 286 return WebKit::toAPI(&WebKit::toImpl(contextRef)->resumeDownload(nullptr, WebKit::toImpl(resumeData), WebKit::toWTFString(path)));259 WKDownloadRef WKContextDownloadURLRequest(WKContextRef, WKURLRequestRef) 260 { 261 return nullptr; 262 } 263 264 WKDownloadRef WKContextResumeDownload(WKContextRef, WKDataRef, WKStringRef) 265 { 266 return nullptr; 287 267 } 288 268 -
trunk/Source/WebKit/UIProcess/API/C/WKContext.h
r249614 r250292 117 117 WK_EXPORT void WKContextSetConnectionClient(WKContextRef context, const WKContextConnectionClientBase* client); 118 118 119 WK_EXPORT WKDownloadRef WKContextDownloadURLRequest(WKContextRef context, WKURLRequestRef request) ;120 WK_EXPORT WKDownloadRef WKContextResumeDownload(WKContextRef context, WKDataRef resumeData, WKStringRef path) ;119 WK_EXPORT WKDownloadRef WKContextDownloadURLRequest(WKContextRef context, WKURLRequestRef request) WK_C_API_DEPRECATED; 120 WK_EXPORT WKDownloadRef WKContextResumeDownload(WKContextRef context, WKDataRef resumeData, WKStringRef path) WK_C_API_DEPRECATED; 121 121 122 122 WK_EXPORT void WKContextSetInitializationUserDataForInjectedBundle(WKContextRef context, WKTypeRef userData); -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
r249853 r250292 36 36 #import "WKObject.h" 37 37 #import "WKWebViewInternal.h" 38 #import "WKWebsiteDataStoreInternal.h" 38 39 #import "WebCertificateInfo.h" 39 40 #import "WebCookieManagerProxy.h" … … 374 375 { 375 376 _downloadDelegate = downloadDelegate; 376 _processPool->setDownloadClient(makeUnique <WebKit::DownloadClient>(downloadDelegate));377 _processPool->setDownloadClient(makeUniqueRef<WebKit::DownloadClient>(downloadDelegate)); 377 378 } 378 379 … … 616 617 - (_WKDownload *)_downloadURLRequest:(NSURLRequest *)request originatingWebView:(WKWebView *)webView 617 618 { 618 return (_WKDownload *)_processPool->download([webView _page], request).wrapper();619 return nil; 619 620 } 620 621 621 622 - (_WKDownload *)_resumeDownloadFromData:(NSData *)resumeData path:(NSString *)path originatingWebView:(WKWebView *)webView 622 623 { 623 return wrapper(_processPool->resumeDownload([webView _page], API::Data::createWithoutCopying(resumeData).ptr(), path)); 624 return nil; 625 } 626 627 - (_WKDownload *)_downloadURLRequest:(NSURLRequest *)request websiteDataStore:(WKWebsiteDataStore *)dataStore originatingWebView:(WKWebView *)webView 628 { 629 return wrapper(_processPool->download(*dataStore->_websiteDataStore, [webView _page], request)); 630 } 631 632 - (_WKDownload *)_resumeDownloadFromData:(NSData *)resumeData websiteDataStore:(WKWebsiteDataStore *)dataStore path:(NSString *)path originatingWebView:(WKWebView *)webView 633 { 634 return wrapper(_processPool->resumeDownload(*dataStore->_websiteDataStore, [webView _page], API::Data::createWithoutCopying(resumeData).get(), path)); 624 635 } 625 636 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
r249684 r250292 28 28 29 29 @class WKWebView; 30 @class WKWebsiteDataStore; 30 31 @class _WKAutomationSession; 31 32 @class _WKDownload; … … 82 83 - (void)_registerURLSchemeAsCanDisplayOnlyIfCanRequest:(NSString *)scheme WK_API_AVAILABLE(macos(10.14), ios(12.0)); 83 84 84 - (_WKDownload *)_downloadURLRequest:(NSURLRequest *)request originatingWebView:(WKWebView *)webView WK_API_AVAILABLE(macos(10.14.4), ios(12.2)); 85 - (_WKDownload *)_resumeDownloadFromData:(NSData *)resumeData path:(NSString *)path originatingWebView:(WKWebView *)webView WK_API_AVAILABLE(macos(10.14.4), ios(12.2)); 85 - (_WKDownload *)_downloadURLRequest:(NSURLRequest *)request originatingWebView:(WKWebView *)webView WK_API_DEPRECATED_WITH_REPLACEMENT("_downloadURLRequest:websiteDataStore:originatingWebView:", macos(10.14.4, WK_MAC_TBA), ios(12.2, WK_IOS_TBA)); 86 - (_WKDownload *)_resumeDownloadFromData:(NSData *)resumeData path:(NSString *)path originatingWebView:(WKWebView *)webView WK_API_DEPRECATED_WITH_REPLACEMENT("_resumeDownloadFromData:websiteDataStore:path:originatingWebView:", macos(10.14.4, WK_MAC_TBA), ios(12.2, WK_IOS_TBA)); 87 88 - (_WKDownload *)_downloadURLRequest:(NSURLRequest *)request websiteDataStore:(WKWebsiteDataStore *)dataStore originatingWebView:(WKWebView *)webView WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 89 - (_WKDownload *)_resumeDownloadFromData:(NSData *)resumeData websiteDataStore:(WKWebsiteDataStore *)dataStore path:(NSString *)path originatingWebView:(WKWebView *)webView WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 86 90 87 91 // Test only. Should be called only while no web content processes are running. -
trunk/Source/WebKit/UIProcess/API/glib/WebKitDownloadClient.cpp
r248846 r250292 26 26 #include "WebKitWebContextPrivate.h" 27 27 #include "WebKitWebViewPrivate.h" 28 #include "Web ProcessPool.h"28 #include "WebsiteDataStore.h" 29 29 #include <wtf/glib/GRefPtr.h> 30 30 #include <wtf/text/CString.h> … … 41 41 42 42 private: 43 void didStart( WebProcessPool&,DownloadProxy& downloadProxy) override43 void didStart(DownloadProxy& downloadProxy) override 44 44 { 45 45 GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(&downloadProxy); … … 48 48 } 49 49 50 void didReceiveAuthenticationChallenge( WebProcessPool&,DownloadProxy& downloadProxy, AuthenticationChallengeProxy& authenticationChallenge) override50 void didReceiveAuthenticationChallenge(DownloadProxy& downloadProxy, AuthenticationChallengeProxy& authenticationChallenge) override 51 51 { 52 52 GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(&downloadProxy); … … 59 59 } 60 60 61 void didReceiveResponse( WebProcessPool&,DownloadProxy& downloadProxy, const ResourceResponse& resourceResponse) override61 void didReceiveResponse(DownloadProxy& downloadProxy, const ResourceResponse& resourceResponse) override 62 62 { 63 63 GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(&downloadProxy); … … 69 69 } 70 70 71 void didReceiveData( WebProcessPool&,DownloadProxy& downloadProxy, uint64_t length) override71 void didReceiveData(DownloadProxy& downloadProxy, uint64_t length) override 72 72 { 73 73 GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(&downloadProxy); … … 75 75 } 76 76 77 void decideDestinationWithSuggestedFilename( WebProcessPool&,DownloadProxy& downloadProxy, const String& filename, Function<void(AllowOverwrite, String)>&& completionHandler) override77 void decideDestinationWithSuggestedFilename(DownloadProxy& downloadProxy, const String& filename, Function<void(AllowOverwrite, String)>&& completionHandler) override 78 78 { 79 79 GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(&downloadProxy); … … 83 83 } 84 84 85 void didCreateDestination( WebProcessPool&,DownloadProxy& downloadProxy, const String& path) override85 void didCreateDestination(DownloadProxy& downloadProxy, const String& path) override 86 86 { 87 87 GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(&downloadProxy); … … 89 89 } 90 90 91 void didFail( WebProcessPool&,DownloadProxy& downloadProxy, const ResourceError& error) override91 void didFail(DownloadProxy& downloadProxy, const ResourceError& error) override 92 92 { 93 93 GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(&downloadProxy); … … 100 100 } 101 101 102 void didCancel( WebProcessPool&,DownloadProxy& downloadProxy) override102 void didCancel(DownloadProxy& downloadProxy) override 103 103 { 104 104 GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(&downloadProxy); … … 107 107 } 108 108 109 void didFinish( WebProcessPool&,DownloadProxy& downloadProxy) override109 void didFinish(DownloadProxy& downloadProxy) override 110 110 { 111 111 GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(&downloadProxy); … … 119 119 void attachDownloadClientToContext(WebKitWebContext* webContext) 120 120 { 121 webkitWebContextGetProcessPool(webContext).setDownloadClient(makeUnique <DownloadClient>(webContext));121 webkitWebContextGetProcessPool(webContext).setDownloadClient(makeUniqueRef<DownloadClient>(webContext)); 122 122 } -
trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
r250169 r250292 363 363 priv->clientsDetached = true; 364 364 priv->processPool->setInjectedBundleClient(nullptr); 365 priv->processPool->setDownloadClient( nullptr);365 priv->processPool->setDownloadClient(makeUniqueRef<API::DownloadClient>()); 366 366 priv->processPool->setLegacyCustomProtocolManagerClient(nullptr); 367 367 } … … 1659 1659 { 1660 1660 WebCore::ResourceRequest request(String::fromUTF8(uri)); 1661 return webkitWebContextGetOrCreateDownload(&context->priv->processPool->download( initiatingPage, request));1661 return webkitWebContextGetOrCreateDownload(&context->priv->processPool->download(WebKit::WebsiteDataStore::defaultDataStore().get(), initiatingPage, request)); 1662 1662 } 1663 1663 -
trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.h
r242339 r250292 48 48 private: 49 49 // From API::DownloadClient 50 void didStart( WebProcessPool&,DownloadProxy&) final;51 void didReceiveResponse( WebProcessPool&,DownloadProxy&, const WebCore::ResourceResponse&) final;52 void didReceiveData( WebProcessPool&,DownloadProxy&, uint64_t length) final;53 void decideDestinationWithSuggestedFilename( WebProcessPool&,DownloadProxy&, const String& suggestedFilename, Function<void(AllowOverwrite, String)>&&) final;54 void didFinish( WebProcessPool&,DownloadProxy&) final;55 void didFail( WebProcessPool&,DownloadProxy&, const WebCore::ResourceError&) final;56 void didCancel( WebProcessPool&,DownloadProxy&) final;57 void willSendRequest( WebProcessPool&,DownloadProxy&, WebCore::ResourceRequest&&, const WebCore::ResourceResponse&, CompletionHandler<void(WebCore::ResourceRequest&&)>&&) final;58 void didReceiveAuthenticationChallenge( WebProcessPool&,DownloadProxy&, AuthenticationChallengeProxy&) final;59 void didCreateDestination( WebProcessPool&,DownloadProxy&, const String&) final;60 void processDidCrash( WebProcessPool&,DownloadProxy&) final;50 void didStart(DownloadProxy&) final; 51 void didReceiveResponse(DownloadProxy&, const WebCore::ResourceResponse&) final; 52 void didReceiveData(DownloadProxy&, uint64_t length) final; 53 void decideDestinationWithSuggestedFilename(DownloadProxy&, const String& suggestedFilename, Function<void(AllowOverwrite, String)>&&) final; 54 void didFinish(DownloadProxy&) final; 55 void didFail(DownloadProxy&, const WebCore::ResourceError&) final; 56 void didCancel(DownloadProxy&) final; 57 void willSendRequest(DownloadProxy&, WebCore::ResourceRequest&&, const WebCore::ResourceResponse&, CompletionHandler<void(WebCore::ResourceRequest&&)>&&) final; 58 void didReceiveAuthenticationChallenge(DownloadProxy&, AuthenticationChallengeProxy&) final; 59 void didCreateDestination(DownloadProxy&, const String&) final; 60 void processDidCrash(DownloadProxy&) final; 61 61 62 62 #if USE(SYSTEM_PREVIEW) -
trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm
r249855 r250292 66 66 } 67 67 68 void DownloadClient::didStart( WebProcessPool&,DownloadProxy& downloadProxy)68 void DownloadClient::didStart(DownloadProxy& downloadProxy) 69 69 { 70 70 #if USE(SYSTEM_PREVIEW) … … 83 83 } 84 84 85 void DownloadClient::didReceiveResponse( WebProcessPool&,DownloadProxy& downloadProxy, const WebCore::ResourceResponse& response)85 void DownloadClient::didReceiveResponse(DownloadProxy& downloadProxy, const WebCore::ResourceResponse& response) 86 86 { 87 87 #if USE(SYSTEM_PREVIEW) … … 99 99 } 100 100 101 void DownloadClient::didReceiveData( WebProcessPool&,DownloadProxy& downloadProxy, uint64_t length)101 void DownloadClient::didReceiveData(DownloadProxy& downloadProxy, uint64_t length) 102 102 { 103 103 #if USE(SYSTEM_PREVIEW) … … 114 114 } 115 115 116 void DownloadClient::didReceiveAuthenticationChallenge( WebProcessPool&,DownloadProxy& downloadProxy, AuthenticationChallengeProxy& authenticationChallenge)116 void DownloadClient::didReceiveAuthenticationChallenge(DownloadProxy& downloadProxy, AuthenticationChallengeProxy& authenticationChallenge) 117 117 { 118 118 // FIXME: System Preview needs code here. … … 148 148 } 149 149 150 void DownloadClient::didCreateDestination( WebProcessPool&,DownloadProxy& downloadProxy, const String& destination)150 void DownloadClient::didCreateDestination(DownloadProxy& downloadProxy, const String& destination) 151 151 { 152 152 #if USE(SYSTEM_PREVIEW) … … 161 161 } 162 162 163 void DownloadClient::processDidCrash( WebProcessPool&,DownloadProxy& downloadProxy)163 void DownloadClient::processDidCrash(DownloadProxy& downloadProxy) 164 164 { 165 165 #if USE(SYSTEM_PREVIEW) … … 176 176 } 177 177 178 void DownloadClient::decideDestinationWithSuggestedFilename( WebProcessPool&,DownloadProxy& downloadProxy, const String& filename, Function<void(AllowOverwrite, String)>&& completionHandler)178 void DownloadClient::decideDestinationWithSuggestedFilename(DownloadProxy& downloadProxy, const String& filename, Function<void(AllowOverwrite, String)>&& completionHandler) 179 179 { 180 180 #if USE(SYSTEM_PREVIEW) … … 206 206 } 207 207 208 void DownloadClient::didFinish( WebProcessPool&,DownloadProxy& downloadProxy)208 void DownloadClient::didFinish(DownloadProxy& downloadProxy) 209 209 { 210 210 #if USE(SYSTEM_PREVIEW) … … 225 225 } 226 226 227 void DownloadClient::didFail( WebProcessPool&,DownloadProxy& downloadProxy, const WebCore::ResourceError& error)227 void DownloadClient::didFail(DownloadProxy& downloadProxy, const WebCore::ResourceError& error) 228 228 { 229 229 #if USE(SYSTEM_PREVIEW) … … 240 240 } 241 241 242 void DownloadClient::didCancel( WebProcessPool&,DownloadProxy& downloadProxy)242 void DownloadClient::didCancel(DownloadProxy& downloadProxy) 243 243 { 244 244 #if USE(SYSTEM_PREVIEW) … … 255 255 } 256 256 257 void DownloadClient::willSendRequest( WebProcessPool&,DownloadProxy& downloadProxy, WebCore::ResourceRequest&& request, const WebCore::ResourceResponse&, CompletionHandler<void(WebCore::ResourceRequest&&)>&& completionHandler)257 void DownloadClient::willSendRequest(DownloadProxy& downloadProxy, WebCore::ResourceRequest&& request, const WebCore::ResourceResponse&, CompletionHandler<void(WebCore::ResourceRequest&&)>&& completionHandler) 258 258 { 259 259 if (m_delegateMethods.downloadDidReceiveServerRedirectToURL) -
trunk/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp
r247705 r250292 52 52 } 53 53 54 Ref<DownloadProxy> DownloadProxy::create(DownloadProxyMap& downloadProxyMap, Web ProcessPool& processPool, const ResourceRequest& resourceRequest)55 { 56 return adoptRef(*new DownloadProxy(downloadProxyMap, processPool, resourceRequest));57 } 58 59 DownloadProxy::DownloadProxy(DownloadProxyMap& downloadProxyMap, Web ProcessPool& processPool, const ResourceRequest& resourceRequest)54 Ref<DownloadProxy> DownloadProxy::create(DownloadProxyMap& downloadProxyMap, WebsiteDataStore& dataStore, WebProcessPool& processPool, const ResourceRequest& resourceRequest) 55 { 56 return adoptRef(*new DownloadProxy(downloadProxyMap, dataStore, processPool, resourceRequest)); 57 } 58 59 DownloadProxy::DownloadProxy(DownloadProxyMap& downloadProxyMap, WebsiteDataStore& dataStore, WebProcessPool& processPool, const ResourceRequest& resourceRequest) 60 60 : m_downloadProxyMap(downloadProxyMap) 61 , m_dataStore(&dataStore) 61 62 , m_processPool(&processPool) 62 63 , m_downloadID(generateDownloadID()) … … 83 84 ASSERT(m_processPool); 84 85 m_processPool = nullptr; 86 ASSERT(m_dataStore); 87 m_dataStore = nullptr; 85 88 } 86 89 … … 90 93 return; 91 94 92 m_processPool->downloadClient().processDidCrash(* m_processPool, *this);95 m_processPool->downloadClient().processDidCrash(*this); 93 96 } 94 97 … … 129 132 return; 130 133 131 m_processPool->downloadClient().didStart(* m_processPool, *this);134 m_processPool->downloadClient().didStart(*this); 132 135 } 133 136 … … 139 142 auto authenticationChallengeProxy = AuthenticationChallengeProxy::create(WTFMove(authenticationChallenge), challengeID, makeRef(*m_processPool->networkingProcessConnection()), nullptr); 140 143 141 m_processPool->downloadClient().didReceiveAuthenticationChallenge(* m_processPool, *this, authenticationChallengeProxy.get());144 m_processPool->downloadClient().didReceiveAuthenticationChallenge(*this, authenticationChallengeProxy.get()); 142 145 } 143 146 … … 147 150 return; 148 151 149 m_processPool->downloadClient().willSendRequest(* m_processPool, *this, WTFMove(proposedRequest), redirectResponse, [this, protectedThis = makeRef(*this)](ResourceRequest&& newRequest) {152 m_processPool->downloadClient().willSendRequest(*this, WTFMove(proposedRequest), redirectResponse, [this, protectedThis = makeRef(*this)](ResourceRequest&& newRequest) { 150 153 m_redirectChain.append(newRequest.url()); 151 154 … … 166 169 return; 167 170 168 m_processPool->downloadClient().didReceiveResponse(* m_processPool, *this, response);171 m_processPool->downloadClient().didReceiveResponse(*this, response); 169 172 } 170 173 … … 174 177 return; 175 178 176 m_processPool->downloadClient().didReceiveData(* m_processPool, *this, length);179 m_processPool->downloadClient().didReceiveData(*this, length); 177 180 } 178 181 … … 182 185 return; 183 186 184 m_processPool->downloadClient().decideDestinationWithSuggestedFilename(* m_processPool, *this, suggestedFilename, [this, protectedThis = makeRef(*this), downloadID = downloadID] (AllowOverwrite allowOverwrite, String destination) {187 m_processPool->downloadClient().decideDestinationWithSuggestedFilename(*this, suggestedFilename, [this, protectedThis = makeRef(*this), downloadID = downloadID] (AllowOverwrite allowOverwrite, String destination) { 185 188 SandboxExtension::Handle sandboxExtensionHandle; 186 189 if (!destination.isNull()) … … 200 203 return; 201 204 202 m_processPool->downloadClient().didCreateDestination(* m_processPool, *this, path);205 m_processPool->downloadClient().didCreateDestination(*this, path); 203 206 } 204 207 … … 208 211 return; 209 212 210 m_processPool->downloadClient().didFinish(* m_processPool, *this);213 m_processPool->downloadClient().didFinish(*this); 211 214 212 215 // This can cause the DownloadProxy object to be deleted. … … 229 232 m_resumeData = createData(resumeData); 230 233 231 m_processPool->downloadClient().didFail(* m_processPool, *this, error);234 m_processPool->downloadClient().didFail(*this, error); 232 235 233 236 // This can cause the DownloadProxy object to be deleted. … … 239 242 m_resumeData = createData(resumeData); 240 243 241 m_processPool->downloadClient().didCancel(* m_processPool, *this);244 m_processPool->downloadClient().didCancel(*this); 242 245 243 246 // This can cause the DownloadProxy object to be deleted. -
trunk/Source/WebKit/UIProcess/Downloads/DownloadProxy.h
r249855 r250292 54 54 class WebPageProxy; 55 55 class WebProcessPool; 56 class WebsiteDataStore; 56 57 57 58 class DownloadProxy : public API::ObjectImpl<API::Object::Type::Download>, public IPC::MessageReceiver { 58 59 public: 59 static Ref<DownloadProxy> create(DownloadProxyMap&, Web ProcessPool&, const WebCore::ResourceRequest&);60 static Ref<DownloadProxy> create(DownloadProxyMap&, WebsiteDataStore&, WebProcessPool&, const WebCore::ResourceRequest&); 60 61 ~DownloadProxy(); 61 62 … … 100 101 101 102 private: 102 explicit DownloadProxy(DownloadProxyMap&, Web ProcessPool&, const WebCore::ResourceRequest&);103 explicit DownloadProxy(DownloadProxyMap&, WebsiteDataStore&, WebProcessPool&, const WebCore::ResourceRequest&); 103 104 104 105 // IPC::MessageReceiver … … 119 120 120 121 DownloadProxyMap& m_downloadProxyMap; 122 RefPtr<WebsiteDataStore> m_dataStore; 121 123 RefPtr<WebProcessPool> m_processPool; 122 124 DownloadID m_downloadID; -
trunk/Source/WebKit/UIProcess/Downloads/DownloadProxyMap.cpp
r249479 r250292 81 81 } 82 82 83 DownloadProxy& DownloadProxyMap::createDownloadProxy(Web ProcessPool& processPool, const WebCore::ResourceRequest& resourceRequest)83 DownloadProxy& DownloadProxyMap::createDownloadProxy(WebsiteDataStore& dataStore, WebProcessPool& processPool, const WebCore::ResourceRequest& resourceRequest) 84 84 { 85 auto downloadProxy = DownloadProxy::create(*this, processPool, resourceRequest);85 auto downloadProxy = DownloadProxy::create(*this, dataStore, processPool, resourceRequest); 86 86 m_downloads.set(downloadProxy->downloadID(), downloadProxy.copyRef()); 87 87 -
trunk/Source/WebKit/UIProcess/Downloads/DownloadProxyMap.h
r245480 r250292 46 46 class ProcessAssertion; 47 47 class WebProcessPool; 48 class WebsiteDataStore; 48 49 49 50 class DownloadProxyMap : public CanMakeWeakPtr<DownloadProxyMap> { … … 55 56 ~DownloadProxyMap(); 56 57 57 DownloadProxy& createDownloadProxy(Web ProcessPool&, const WebCore::ResourceRequest&);58 DownloadProxy& createDownloadProxy(WebsiteDataStore&, WebProcessPool&, const WebCore::ResourceRequest&); 58 59 void downloadFinished(DownloadProxy&); 59 60 -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r250169 r250292 29 29 #include "APIContentRuleList.h" 30 30 #include "AuthenticationChallengeProxy.h" 31 #include "DownloadProxyMap.h" 31 32 #include "DownloadProxyMessages.h" 32 33 #if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER) … … 177 178 } 178 179 179 DownloadProxy& NetworkProcessProxy::createDownloadProxy( const ResourceRequest& resourceRequest)180 DownloadProxy& NetworkProcessProxy::createDownloadProxy(WebsiteDataStore& dataStore, const ResourceRequest& resourceRequest) 180 181 { 181 182 if (!m_downloadProxyMap) 182 183 m_downloadProxyMap = makeUnique<DownloadProxyMap>(*this); 183 184 184 return m_downloadProxyMap->createDownloadProxy( m_processPool, resourceRequest);185 return m_downloadProxyMap->createDownloadProxy(dataStore, m_processPool, resourceRequest); 185 186 } 186 187 -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
r250169 r250292 90 90 void getNetworkProcessConnection(WebProcessProxy&, Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply&&); 91 91 92 DownloadProxy& createDownloadProxy( const WebCore::ResourceRequest&);92 DownloadProxy& createDownloadProxy(WebsiteDataStore&, const WebCore::ResourceRequest&); 93 93 94 94 void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, CompletionHandler<void(WebsiteData)>&&); -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r250169 r250292 2954 2954 if (action == PolicyAction::Download) { 2955 2955 // Create a download proxy. 2956 auto& download = m_process->processPool().createDownloadProxy(m_ decidePolicyForResponseRequest, this);2956 auto& download = m_process->processPool().createDownloadProxy(m_websiteDataStore, m_decidePolicyForResponseRequest, this); 2957 2957 if (navigation) { 2958 2958 download.setWasUserInitiated(navigation->wasUserInitiated()); … … 6129 6129 #endif 6130 6130 if (item.action() == ContextMenuItemTagDownloadImageToDisk) { 6131 m_process->processPool().download( this, URL(URL(), m_activeContextMenuContextData.webHitTestResultData().absoluteImageURL));6131 m_process->processPool().download(m_websiteDataStore, this, URL(URL(), m_activeContextMenuContextData.webHitTestResultData().absoluteImageURL)); 6132 6132 return; 6133 6133 } 6134 6134 if (item.action() == ContextMenuItemTagDownloadLinkToDisk) { 6135 6135 auto& hitTestResult = m_activeContextMenuContextData.webHitTestResultData(); 6136 m_process->processPool().download( this, URL(URL(), hitTestResult.absoluteLinkURL), hitTestResult.linkSuggestedFilename);6136 m_process->processPool().download(m_websiteDataStore, this, URL(URL(), hitTestResult.absoluteLinkURL), hitTestResult.linkSuggestedFilename); 6137 6137 return; 6138 6138 } 6139 6139 if (item.action() == ContextMenuItemTagDownloadMediaToDisk) { 6140 m_process->processPool().download( this, URL(URL(), m_activeContextMenuContextData.webHitTestResultData().absoluteMediaURL));6140 m_process->processPool().download(m_websiteDataStore, this, URL(URL(), m_activeContextMenuContextData.webHitTestResultData().absoluteMediaURL)); 6141 6141 return; 6142 6142 } -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r250254 r250292 217 217 , m_injectedBundleClient(makeUnique<API::InjectedBundleClient>()) 218 218 , m_automationClient(makeUnique<API::AutomationClient>()) 219 , m_downloadClient(makeUnique <API::DownloadClient>())219 , m_downloadClient(makeUniqueRef<API::DownloadClient>()) 220 220 , m_historyClient(makeUnique<API::LegacyContextHistoryClient>()) 221 221 , m_customProtocolManagerClient(makeUnique<API::CustomProtocolManagerClient>()) … … 361 361 } 362 362 363 void WebProcessPool::setDownloadClient(std::unique_ptr<API::DownloadClient>&& downloadClient) 364 { 365 if (!downloadClient) 366 m_downloadClient = makeUnique<API::DownloadClient>(); 367 else 368 m_downloadClient = WTFMove(downloadClient); 363 void WebProcessPool::setDownloadClient(UniqueRef<API::DownloadClient>&& downloadClient) 364 { 365 m_downloadClient = WTFMove(downloadClient); 369 366 } 370 367 … … 1328 1325 } 1329 1326 1330 DownloadProxy& WebProcessPool::download(Web PageProxy* initiatingPage, const ResourceRequest& request, const String& suggestedFilename)1331 { 1332 auto& downloadProxy = createDownloadProxy( request, initiatingPage);1333 PAL::SessionID sessionID = initiatingPage ? initiatingPage->sessionID() : PAL::SessionID::defaultSessionID();1327 DownloadProxy& WebProcessPool::download(WebsiteDataStore& dataStore, WebPageProxy* initiatingPage, const ResourceRequest& request, const String& suggestedFilename) 1328 { 1329 auto& downloadProxy = createDownloadProxy(dataStore, request, initiatingPage); 1330 PAL::SessionID sessionID = dataStore.sessionID(); 1334 1331 1335 1332 if (initiatingPage) … … 1360 1357 } 1361 1358 1362 DownloadProxy& WebProcessPool::resumeDownload(Web PageProxy* initiatingPage, const API::Data*resumeData, const String& path)1363 { 1364 auto& downloadProxy = createDownloadProxy( ResourceRequest(), initiatingPage);1365 PAL::SessionID sessionID = initiatingPage ? initiatingPage->sessionID() : PAL::SessionID::defaultSessionID();1359 DownloadProxy& WebProcessPool::resumeDownload(WebsiteDataStore& dataStore, WebPageProxy* initiatingPage, const API::Data& resumeData, const String& path) 1360 { 1361 auto& downloadProxy = createDownloadProxy(dataStore, ResourceRequest(), initiatingPage); 1362 PAL::SessionID sessionID = dataStore.sessionID(); 1366 1363 1367 1364 SandboxExtension::Handle sandboxExtensionHandle; … … 1370 1367 1371 1368 if (networkProcess()) { 1372 networkProcess()->send(Messages::NetworkProcess::ResumeDownload(sessionID, downloadProxy.downloadID(), resumeData ->dataReference(), path, sandboxExtensionHandle), 0);1369 networkProcess()->send(Messages::NetworkProcess::ResumeDownload(sessionID, downloadProxy.downloadID(), resumeData.dataReference(), path, sandboxExtensionHandle), 0); 1373 1370 return downloadProxy; 1374 1371 } … … 1621 1618 } 1622 1619 1623 DownloadProxy& WebProcessPool::createDownloadProxy( const ResourceRequest& request, WebPageProxy* originatingPage)1624 { 1625 auto& downloadProxy = ensureNetworkProcess().createDownloadProxy( request);1620 DownloadProxy& WebProcessPool::createDownloadProxy(WebsiteDataStore& dataStore, const ResourceRequest& request, WebPageProxy* originatingPage) 1621 { 1622 auto& downloadProxy = ensureNetworkProcess().createDownloadProxy(dataStore, request); 1626 1623 downloadProxy.setOriginatingPage(originatingPage); 1627 1624 return downloadProxy; -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r250169 r250292 29 29 #include "APIObject.h" 30 30 #include "APIProcessPoolConfiguration.h" 31 #include "DownloadProxyMap.h"32 31 #include "GenericCallback.h" 33 32 #include "HiddenPageThrottlingAutoIncreasesCounter.h" … … 97 96 namespace WebKit { 98 97 99 class DownloadProxy;100 98 class HighPerformanceGraphicsUsageSampler; 101 99 class UIGamepad; … … 172 170 void initializeConnectionClient(const WKContextConnectionClientBase*); 173 171 void setHistoryClient(std::unique_ptr<API::LegacyContextHistoryClient>&&); 174 void setDownloadClient( std::unique_ptr<API::DownloadClient>&&);172 void setDownloadClient(UniqueRef<API::DownloadClient>&&); 175 173 void setAutomationClient(std::unique_ptr<API::AutomationClient>&&); 176 174 void setLegacyCustomProtocolManagerClient(std::unique_ptr<API::CustomProtocolManagerClient>&&); … … 220 218 #endif 221 219 222 DownloadProxy& download(Web PageProxy* initiatingPage, const WebCore::ResourceRequest&, const String& suggestedFilename = { });223 DownloadProxy& resumeDownload(Web PageProxy* initiatingPage, const API::Data*resumeData, const String& path);220 DownloadProxy& download(WebsiteDataStore&, WebPageProxy* initiatingPage, const WebCore::ResourceRequest&, const String& suggestedFilename = { }); 221 DownloadProxy& resumeDownload(WebsiteDataStore&, WebPageProxy* initiatingPage, const API::Data& resumeData, const String& path); 224 222 225 223 void setInjectedBundleInitializationUserData(RefPtr<API::Object>&& userData) { m_injectedBundleInitializationUserData = WTFMove(userData); } … … 295 293 296 294 // Downloads. 297 DownloadProxy& createDownloadProxy( const WebCore::ResourceRequest&, WebPageProxy* originatingPage);298 API::DownloadClient& downloadClient() { return *m_downloadClient; }295 DownloadProxy& createDownloadProxy(WebsiteDataStore&, const WebCore::ResourceRequest&, WebPageProxy* originatingPage); 296 API::DownloadClient& downloadClient() { return m_downloadClient.get(); } 299 297 300 298 API::LegacyContextHistoryClient& historyClient() { return *m_historyClient; } … … 639 637 WebContextConnectionClient m_connectionClient; 640 638 std::unique_ptr<API::AutomationClient> m_automationClient; 641 std::unique_ptr<API::DownloadClient> m_downloadClient;639 UniqueRef<API::DownloadClient> m_downloadClient; 642 640 std::unique_ptr<API::LegacyContextHistoryClient> m_historyClient; 643 641 std::unique_ptr<API::CustomProtocolManagerClient> m_customProtocolManagerClient; -
trunk/Tools/ChangeLog
r250286 r250292 1 2019-09-24 Alex Christensen <achristensen@webkit.org> 2 3 Require a WebsiteDataStore when creating or resuming downloads 4 https://bugs.webkit.org/show_bug.cgi?id=202081 5 6 Reviewed by Youenn Fablet. 7 8 * TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm: 9 (-[DownloadProgressTestRunner startDownload:expectedLength:]): 10 1 11 2019-09-23 Zan Dobersek <zdobersek@igalia.com> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm
r242339 r250292 249 249 break; 250 250 case DownloadStartType::StartInProcessPool: 251 [m_webView.get().configuration.processPool _downloadURLRequest:request.get() originatingWebView:nullptr];251 [m_webView.get().configuration.processPool _downloadURLRequest:request.get() websiteDataStore:[WKWebsiteDataStore defaultDataStore] originatingWebView:nullptr]; 252 252 break; 253 253 }
Note:
See TracChangeset
for help on using the changeset viewer.