mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
Allow whitelisted cookies to be kept
Keep whitelisted cookies from being deleted when deleteCookiesOnClose is true Differential Revision: https://phabricator.kde.org/D13097
This commit is contained in:
parent
45658dc521
commit
326be38a45
|
@ -786,7 +786,7 @@ void MainApplication::saveSettings()
|
|||
ClearPrivateData::clearLocalStorage();
|
||||
}
|
||||
if (deleteCookies) {
|
||||
m_cookieJar->deleteAllCookies();
|
||||
m_cookieJar->deleteAllCookies(false);
|
||||
}
|
||||
if (deleteCache) {
|
||||
QzTools::removeRecursively(mApp->webProfile()->cachePath());
|
||||
|
|
|
@ -78,9 +78,18 @@ QVector<QNetworkCookie> CookieJar::getAllCookies() const
|
|||
return m_cookies;
|
||||
}
|
||||
|
||||
void CookieJar::deleteAllCookies()
|
||||
void CookieJar::deleteAllCookies(bool deleteAll)
|
||||
{
|
||||
m_client->deleteAllCookies();
|
||||
if (deleteAll || m_whitelist.isEmpty()) {
|
||||
m_client->deleteAllCookies();
|
||||
return;
|
||||
}
|
||||
|
||||
for (const QNetworkCookie &cookie : qAsConst(m_cookies)) {
|
||||
if (!listMatchesDomain(m_whitelist, cookie.domain())) {
|
||||
m_client->deleteCookie(cookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CookieJar::matchDomain(QString cookieDomain, QString siteDomain) const
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
void deleteCookie(const QNetworkCookie &cookie);
|
||||
|
||||
QVector<QNetworkCookie> getAllCookies() const;
|
||||
void deleteAllCookies();
|
||||
void deleteAllCookies(bool deleteAll = true);
|
||||
|
||||
Q_SIGNALS:
|
||||
void cookieAdded(const QNetworkCookie &cookie);
|
||||
|
|
Loading…
Reference in New Issue
Block a user