diff options
author | Szabolcs David <davidsz@inf.u-szeged.hu> | 2021-02-17 20:31:15 +0100 |
---|---|---|
committer | Szabolcs David <davidsz@inf.u-szeged.hu> | 2021-03-07 00:06:16 +0100 |
commit | 012df52a13081e3f106021b14ab9796a371fbbe1 (patch) | |
tree | e0c2c75fd4e6c8a712bbafa5fa5a340f2a2b2abf /src/core/net | |
parent | 8f56ea6806d9a72d4b705da5f6f90fa5a6873567 (diff) |
Implement PluginServiceFilterQt
Let Chromium know about the status of plugin availability from
WebEngineSettings. This way it can decide whether the response is
a download and it has more benefits:
- It doesn't have to start a new load request to download a PDF file,
it just treats the original response accordingly.
- Fixes websites which are protected from cross-domain requests (e.g. by
checking the Referer header) and/or redirecting requests for PDFs.
Calling DownloadManager "manually" and not passing the original request
headers did not work when the server relied on them.
Task-number: QTBUG-78114
Change-Id: I8cfa90c211418001c60c4b2f0f8818ee453101fc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/net')
-rw-r--r-- | src/core/net/plugin_response_interceptor_url_loader_throttle.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp index 326bdabb1..d868e4f54 100644 --- a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp +++ b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp @@ -91,12 +91,9 @@ void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse(const GURL WebEngineSettings *settings = contentsDelegate->webEngineSettings(); if (!settings->testAttribute(WebEngineSettings::PdfViewerEnabled) || !settings->testAttribute(WebEngineSettings::PluginsEnabled)) { - // If the applications has been set up to always download PDF files to open them in an - // external viewer, trigger the download. - std::unique_ptr<download::DownloadUrlParameters> params( - content::DownloadRequestUtils::CreateDownloadForWebContentsMainFrame(web_contents, response_url, - MISSING_TRAFFIC_ANNOTATION)); - content::BrowserContext::GetDownloadManager(web_contents->GetBrowserContext())->DownloadUrl(std::move(params)); + // PluginServiceFilterQt will inform the URLLoader about the disabled state of plugins + // and we can expect the download to be triggered automatically. It's unnecessary to + // go further and start the guest view embedding process. return; } |