Downloads started by context menu actions should also have a web view associated
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Nov 2016 07:50:57 +0000 (07:50 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Nov 2016 07:50:57 +0000 (07:50 +0000)
commit1e48a60d47f97a991afcdae2bf087e2d3b321601
tree7a8bdaaa734eadc5c74794b25f31ad60a6207aa4
parent1fa7ff3ac79d95e87cff4a91e958448c7b0bad6b
Downloads started by context menu actions should also have a web view associated
https://bugs.webkit.org/show_bug.cgi?id=164364

Reviewed by Michael Catanzaro.

Source/WebKit2:

When a request is converted to a download WebPageProxy calls handleDownloadRequest() and clients handle that to
associate the web view to the download. When a download is started by a context menu action, WebPageProxy calls
WebProcessPool::download() with this as initiatingPage parameter, but clients are not notified in this case.

* UIProcess/API/gtk/WebKitDownload.cpp:
(webkitDownloadCreateForRequest): Deleted.
* UIProcess/API/gtk/WebKitDownloadPrivate.h:
* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkitWebContextStartDownload): Use webkitWebContextGetOrCreateDownload() after WebProcessPool::download()
because the WebKitDownload could have already been created by the web view download handler at this point.
* UIProcess/API/gtk/WebKitWebView.cpp:
(webkit_web_view_download_uri): We no longer need to associate the web view to the download here.
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::download): If an initiatingPage has been passed, call handleDownloadRequest() to notify
the page client.

Tools:

Add a GTK+ unit tests to check that downloads started by the context menu have a web view associated.

* TestWebKitAPI/Tests/WebKit2Gtk/TestDownloads.cpp:
(downloadLocalFileSuccessfully):
(testDownloadOverwriteDestinationDisallowed):
(testDownloadLocalFileError):
(testDownloadRemoteFile):
(testDownloadRemoteFileError):
(testDownloadMIMEType):
(contextMenuCallback):
(testContextMenuDownloadActions):
(beforeAll):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208882 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h
Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
Source/WebKit2/UIProcess/WebProcessPool.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestDownloads.cpp