From 0a23bc914506a4721f81ac51bf514079c70a2938 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 20 Mar 2018 13:43:57 +0100 Subject: [PATCH] CookieJar: Adapt to changes in QtWebEngine 5.11 --- src/lib/cookies/cookiejar.cpp | 13 ++++++------- src/lib/cookies/cookiejar.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/lib/cookies/cookiejar.cpp b/src/lib/cookies/cookiejar.cpp index cf3781cb8..cb691c8e8 100644 --- a/src/lib/cookies/cookiejar.cpp +++ b/src/lib/cookies/cookiejar.cpp @@ -121,7 +121,7 @@ void CookieJar::slotCookieRemoved(const QNetworkCookie &cookie) } #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) -void CookieJar::cookieFilter(QWebEngineCookieStore::FilterRequest &request) const +bool CookieJar::cookieFilter(const QWebEngineCookieStore::FilterRequest &request) const { if (!m_allowCookies) { bool result = listMatchesDomain(m_whitelist, request.origin.host()); @@ -129,8 +129,7 @@ void CookieJar::cookieFilter(QWebEngineCookieStore::FilterRequest &request) cons #ifdef COOKIE_DEBUG qDebug() << "not in whitelist" << request.origin; #endif - request.accepted = false; - return; + return false; } } @@ -140,8 +139,7 @@ void CookieJar::cookieFilter(QWebEngineCookieStore::FilterRequest &request) cons #ifdef COOKIE_DEBUG qDebug() << "found in blacklist" << request.origin.host(); #endif - request.accepted = false; - return; + return false; } } @@ -149,9 +147,10 @@ void CookieJar::cookieFilter(QWebEngineCookieStore::FilterRequest &request) cons #ifdef COOKIE_DEBUG qDebug() << "thirdParty" << request.firstPartyUrl << request.origin; #endif - request.accepted = false; - return; + return false; } + + return true; } #endif diff --git a/src/lib/cookies/cookiejar.h b/src/lib/cookies/cookiejar.h index d48b84662..1838d0825 100644 --- a/src/lib/cookies/cookiejar.h +++ b/src/lib/cookies/cookiejar.h @@ -55,7 +55,7 @@ private: void slotCookieRemoved(const QNetworkCookie &cookie); #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) - void cookieFilter(QWebEngineCookieStore::FilterRequest &request) const; + bool cookieFilter(const QWebEngineCookieStore::FilterRequest &request) const; #endif bool acceptCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &cookieSource) const;