summaryrefslogtreecommitdiffstats
path: root/src/core/profile_adapter.cpp
diff options
context:
space:
mode:
authorTamas Zakor <ztamas@inf.u-szeged.hu>2020-04-20 11:41:29 +0200
committerTamas Zakor <ztamas@inf.u-szeged.hu>2020-04-23 13:55:26 +0200
commit75412200db05ddc5ee2b9aea367b580d8b0c438e (patch)
tree8177900a8af22aab7321bf6b12474876e175ae43 /src/core/profile_adapter.cpp
parentab179f60844f5b0cd6ef863b753566a3588e9d5d (diff)
Avoid the network context reset during http cache clear
Reinstate BrowsingDataRemoverObserverQt() to check if http cache clearing is in-progress or done. ProfileIODataQt::resetNetworkContext() should not be called during http cache clearing because it causes an assert. Call it after the clearing is done. Change-Id: I6750341ff23f704ba547c913f40b0cec92b1cc43 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/profile_adapter.cpp')
-rw-r--r--src/core/profile_adapter.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp
index d2c4ab1d8..b87591c97 100644
--- a/src/core/profile_adapter.cpp
+++ b/src/core/profile_adapter.cpp
@@ -142,7 +142,8 @@ void ProfileAdapter::setStorageName(const QString &storageName)
m_name = storageName;
if (!m_offTheRecord) {
m_profile->setupPrefService();
- m_profile->m_profileIOData->resetNetworkContext();
+ if (!m_profile->m_profileIOData->isClearHttpCacheInProgress())
+ m_profile->m_profileIOData->resetNetworkContext();
if (m_visitedLinksManager)
resetVisitedLinksManager();
}
@@ -154,7 +155,8 @@ void ProfileAdapter::setOffTheRecord(bool offTheRecord)
return;
m_offTheRecord = offTheRecord;
m_profile->setupPrefService();
- m_profile->m_profileIOData->resetNetworkContext();
+ if (!m_profile->m_profileIOData->isClearHttpCacheInProgress())
+ m_profile->m_profileIOData->resetNetworkContext();
if (m_visitedLinksManager)
resetVisitedLinksManager();
}
@@ -259,7 +261,8 @@ void ProfileAdapter::setDataPath(const QString &path)
m_dataPath = path;
if (!m_offTheRecord) {
m_profile->setupPrefService();
- m_profile->m_profileIOData->resetNetworkContext();
+ if (!m_profile->m_profileIOData->isClearHttpCacheInProgress())
+ m_profile->m_profileIOData->resetNetworkContext();
if (m_visitedLinksManager)
resetVisitedLinksManager();
}
@@ -286,7 +289,7 @@ void ProfileAdapter::setCachePath(const QString &path)
if (m_cachePath == path)
return;
m_cachePath = path;
- if (!m_offTheRecord)
+ if (!m_offTheRecord && !m_profile->m_profileIOData->isClearHttpCacheInProgress())
m_profile->m_profileIOData->resetNetworkContext();
}
@@ -341,7 +344,7 @@ void ProfileAdapter::setHttpCacheType(ProfileAdapter::HttpCacheType newhttpCache
m_httpCacheType = newhttpCacheType;
if (oldCacheType == httpCacheType())
return;
- if (!m_offTheRecord) {
+ if (!m_offTheRecord && !m_profile->m_profileIOData->isClearHttpCacheInProgress()) {
m_profile->m_profileIOData->resetNetworkContext();
if (m_httpCacheType == NoCache)
clearHttpCache();
@@ -361,7 +364,7 @@ void ProfileAdapter::setPersistentCookiesPolicy(ProfileAdapter::PersistentCookie
m_persistentCookiesPolicy = newPersistentCookiesPolicy;
if (oldPolicy == persistentCookiesPolicy())
return;
- if (!m_offTheRecord)
+ if (!m_offTheRecord && !m_profile->m_profileIOData->isClearHttpCacheInProgress())
m_profile->m_profileIOData->resetNetworkContext();
}
@@ -416,7 +419,7 @@ void ProfileAdapter::setHttpCacheMaxSize(int maxSize)
if (m_httpCacheMaxSize == maxSize)
return;
m_httpCacheMaxSize = maxSize;
- if (!m_offTheRecord)
+ if (!m_offTheRecord && !m_profile->m_profileIOData->isClearHttpCacheInProgress())
m_profile->m_profileIOData->resetNetworkContext();
}
@@ -592,10 +595,7 @@ void ProfileAdapter::setHttpAcceptLanguage(const QString &httpAcceptLanguage)
void ProfileAdapter::clearHttpCache()
{
- content::BrowsingDataRemover *remover = content::BrowserContext::GetBrowsingDataRemover(m_profile.data());
- remover->Remove(base::Time(), base::Time::Max(),
- content::BrowsingDataRemover::DATA_TYPE_CACHE,
- content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB | content::BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB);
+ m_profile->m_profileIOData->clearHttpCache();
}
void ProfileAdapter::setSpellCheckLanguages(const QStringList &languages)
@@ -656,7 +656,8 @@ void ProfileAdapter::setUseForGlobalCertificateVerification(bool enable)
if (enable) {
if (profileForglobalCertificateVerification) {
profileForglobalCertificateVerification->m_usedForGlobalCertificateVerification = false;
- profileForglobalCertificateVerification->m_profile->m_profileIOData->resetNetworkContext();
+ if (!m_profile->m_profileIOData->isClearHttpCacheInProgress())
+ profileForglobalCertificateVerification->m_profile->m_profileIOData->resetNetworkContext();
for (auto *client : qAsConst(profileForglobalCertificateVerification->m_clients))
client->useForGlobalCertificateVerificationChanged();
}
@@ -667,7 +668,8 @@ void ProfileAdapter::setUseForGlobalCertificateVerification(bool enable)
profileForglobalCertificateVerification = nullptr;
}
- m_profile->m_profileIOData->resetNetworkContext();
+ if (!m_profile->m_profileIOData->isClearHttpCacheInProgress())
+ m_profile->m_profileIOData->resetNetworkContext();
}
bool ProfileAdapter::isUsedForGlobalCertificateVerification() const