[WK2] Notify client when downloads are redirected
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Sep 2017 19:51:58 +0000 (19:51 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Sep 2017 19:51:58 +0000 (19:51 +0000)
commit654df55cef551e3d7da72398b91121995dba3a39
tree3c70fd6d778d4faf746edffbc2d10b7b29badc93
parent9ec6696ce4b5ba49f4a503b61c2c42958cc151b3
[WK2] Notify client when downloads are redirected
https://bugs.webkit.org/show_bug.cgi?id=176481
<rdar://problem/34309065>

Reviewed by Geoffrey Garen.

Source/WebKit:

Notify client when downloads are redirected via both ObjC and C
API.

* NetworkProcess/Downloads/Download.cpp:
(WebKit::Download::willSendRedirectedRequest):
* NetworkProcess/Downloads/Download.h:
* NetworkProcess/Downloads/mac/DownloadMac.mm:
(-[WKDownloadAsDelegate download:willSendRequest:redirectResponse:]):
* UIProcess/API/APIDownloadClient.h:
(API::DownloadClient::willSendRequest):
* UIProcess/API/C/WKContext.cpp:
(WKContextSetDownloadClient):
* UIProcess/API/C/WKContextDownloadClient.h:
* UIProcess/API/Cocoa/_WKDownloadDelegate.h:
* UIProcess/Cocoa/DownloadClient.h:
* UIProcess/Cocoa/DownloadClient.mm:
(WebKit::DownloadClient::DownloadClient):
(WebKit::DownloadClient::willSendRequest):
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::willSendRequest):
* UIProcess/Downloads/DownloadProxy.h:
* UIProcess/Downloads/DownloadProxy.messages.in:

* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::showContextMenuWithItems):
Set menu proxy before calling menuFromProposedMenu() client delegate.
This allows me to perform one of the menu item's action from the
menuFromProposedMenu() client delegate in my API test.

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/Download.mm:
(-[UIDownloadAsFileTestDelegate _webView:contextMenu:forElement:]):
(-[RedirectedDownloadDelegate _download:decideDestinationWithSuggestedFilename:allowOverwrite:]):
(-[RedirectedDownloadDelegate _download:didReceiveServerRedirectToURL:]):
(-[RedirectedDownloadDelegate _downloadDidFinish:]):
(TEST):
Add API test coverage.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::downloadDidReceiveServerRedirectToURL):
* WebKitTestRunner/TestController.h:
Add layout test infrastructure.

LayoutTests:

Add layout test coverage.

* http/tests/download/anchor-download-redirect-expected.txt: Added.
* http/tests/download/anchor-download-redirect.html: Added.
* platform/ios-wk2/TestExpectations:
* platform/mac-wk1/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221749 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/download/anchor-download-redirect-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/download/anchor-download-redirect.html [new file with mode: 0644]
LayoutTests/platform/ios-wk2/TestExpectations
LayoutTests/platform/mac-wk1/TestExpectations
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/Downloads/Download.cpp
Source/WebKit/NetworkProcess/Downloads/Download.h
Source/WebKit/NetworkProcess/Downloads/mac/DownloadMac.mm
Source/WebKit/UIProcess/API/APIDownloadClient.h
Source/WebKit/UIProcess/API/C/WKContext.cpp
Source/WebKit/UIProcess/API/C/WKContextDownloadClient.h
Source/WebKit/UIProcess/API/Cocoa/_WKDownloadDelegate.h
Source/WebKit/UIProcess/Cocoa/DownloadClient.h
Source/WebKit/UIProcess/Cocoa/DownloadClient.mm
Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp
Source/WebKit/UIProcess/Downloads/DownloadProxy.h
Source/WebKit/UIProcess/Downloads/DownloadProxy.messages.in
Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h