[WK2] Navigating to a Blob URL does not trigger a download
https://bugs.webkit.org/show_bug.cgi?id=162574

Reviewed by Darin Adler.

Source/WebKit2:

Add support for converting Blob URL loads into downloads.

* NetworkProcess/Downloads/BlobDownloadClient.cpp:
(WebKit::BlobDownloadClient::didReceiveResponseAsync):
Make sure we return a valid suggested filename because the client side (Safari)
does not deal with empty suggested filenames. Use "unknown" by default to
match the default suggested filename of non-Blob downloads.

* NetworkProcess/Downloads/Download.cpp:
(WebKit::Download::startWithHandle):
* NetworkProcess/Downloads/Download.h:
* NetworkProcess/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::convertHandleToDownload):
* NetworkProcess/Downloads/DownloadManager.h:
* NetworkProcess/Downloads/ios/DownloadIOS.mm:
(WebKit::Download::startNetworkLoadWithHandle):
* NetworkProcess/Downloads/mac/DownloadMac.mm:
(WebKit::Download::startNetworkLoadWithHandle):
* NetworkProcess/Downloads/soup/DownloadSoup.cpp:
(WebKit::Download::startNetworkLoadWithHandle):
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
* NetworkProcess/NetworkLoad.h:
(WebKit::NetworkLoad::handle):

Tools:

Add API that tests navigating to a Blob URL and checks that that the load
properly gets converted into a download.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/Download.mm:
(-[BlobDownloadDelegate _downloadDidStart:]):
(-[BlobDownloadDelegate _download:didReceiveResponse:]):
(-[BlobDownloadDelegate _download:didReceiveData:]):
(-[BlobDownloadDelegate _download:decideDestinationWithSuggestedFilename:allowOverwrite:]):
(-[BlobDownloadDelegate _downloadDidFinish:]):
(-[DownloadBlobURLNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
(TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/DownloadRequestBlobURL.html: Added.

LayoutTests:

Rebaseline now that the suggested download name is "unknown" by default
for blob downloads as well.

* fast/dom/HTMLAnchorElement/anchor-download-expected.txt:
* fast/dom/HTMLAnchorElement/anchor-nodownload-set-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@206439 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed