diff options
author | Szabolcs David <davidsz@inf.u-szeged.hu> | 2018-02-07 15:17:52 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-02-16 10:10:41 +0000 |
commit | 68a140dd4bbb9f2dd40fadb0d5110ba8f11db24e (patch) | |
tree | 35bd01306a774e3a0bae70f871ec60b925ce96fc | |
parent | 84c048891e9e3a78801395e93e48775eafa2bcd0 (diff) |
Clear HTTP cache before disabling it
It is a workaround to satisfy this online cache test:
http://refreshyourcache.com/en/cache-test/
This way Chromium provides "cache-control: no-cache" headers and indicates
the disabled state of our cache backend.
Task-number: QTBUG-63606
Change-Id: I0fdaf0b8dcaa98891b3d0380f4deeaa28a8aba4b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | src/core/url_request_context_getter_qt.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index 2622cb09e..d3f461639 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -48,6 +48,7 @@ #include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h" #include "content/network/proxy_service_mojo.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/browsing_data_remover.h" #include "content/public/browser/cookie_store_factory.h" #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" @@ -406,6 +407,13 @@ void URLRequestContextGetterQt::updateHttpCache() m_httpCachePath = m_browserContext.data()->httpCachePath(); m_httpCacheMaxSize = m_browserContext.data()->httpCacheMaxSize(); + if (m_httpCacheType == BrowserContextAdapter::NoCache) { + content::BrowsingDataRemover *remover = content::BrowserContext::GetBrowsingDataRemover(m_browserContext.data()->browserContext()); + remover->Remove(base::Time(), base::Time::Max(), + content::BrowsingDataRemover::DATA_TYPE_CACHE, + content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB | content::BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB); + } + if (m_contextInitialized && !m_updateAllStorage && !m_updateHttpCache) { m_updateHttpCache = true; content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, |