diff --git a/src/lib/adblock/adblockurlinterceptor.cpp b/src/lib/adblock/adblockurlinterceptor.cpp index 6a7a6daec..9960c136b 100644 --- a/src/lib/adblock/adblockurlinterceptor.cpp +++ b/src/lib/adblock/adblockurlinterceptor.cpp @@ -25,7 +25,8 @@ AdBlockUrlInterceptor::AdBlockUrlInterceptor(AdBlockManager *manager) { } -bool AdBlockUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) +void AdBlockUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) { - return m_manager->block(info); + if (m_manager->block(info)) + info.block(true); } diff --git a/src/lib/adblock/adblockurlinterceptor.h b/src/lib/adblock/adblockurlinterceptor.h index 0a25b3ef1..e87096369 100644 --- a/src/lib/adblock/adblockurlinterceptor.h +++ b/src/lib/adblock/adblockurlinterceptor.h @@ -29,7 +29,7 @@ class QUPZILLA_EXPORT AdBlockUrlInterceptor : public UrlInterceptor public: explicit AdBlockUrlInterceptor(AdBlockManager* manager); - bool interceptRequest(QWebEngineUrlRequestInfo &info); + void interceptRequest(QWebEngineUrlRequestInfo &info); private: AdBlockManager *m_manager; diff --git a/src/lib/cookies/cookiejar.cpp b/src/lib/cookies/cookiejar.cpp index 09006feef..9d15821e3 100644 --- a/src/lib/cookies/cookiejar.cpp +++ b/src/lib/cookies/cookiejar.cpp @@ -31,16 +31,15 @@ CookieJar::CookieJar(QObject* parent) : QObject(parent) - , m_client(mApp->webProfile()->cookieStoreClient()) + , m_client(mApp->webProfile()->cookieStore()) { loadSettings(); - connect(m_client, &QWebEngineCookieStoreClient::cookieAdded, this, &CookieJar::cookieAdded); - connect(m_client, &QWebEngineCookieStoreClient::cookieRemoved, this, &CookieJar::cookieRemoved); + connect(m_client, &QWebEngineCookieStore::cookieAdded, this, &CookieJar::cookieAdded); + connect(m_client, &QWebEngineCookieStore::cookieRemoved, this, &CookieJar::cookieRemoved); - m_client->setCookieFilter([this](const QWebEngineCookieStoreClient::FilterRequest &req) { - QWebEngineCookieStoreClient::FilterRequest &r = const_cast(req); - r.accepted = acceptCookie(r.firstPartyUrl, r.cookieLine, r.cookieSource); + m_client->setCookieFilter([this](QWebEngineCookieStore::FilterRequest &req) { + req.accepted = acceptCookie(req.firstPartyUrl, req.cookieLine, req.cookieSource); }); } diff --git a/src/lib/cookies/cookiejar.h b/src/lib/cookies/cookiejar.h index 42229ccef..838717b4f 100644 --- a/src/lib/cookies/cookiejar.h +++ b/src/lib/cookies/cookiejar.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include "qzcommon.h" @@ -58,7 +58,7 @@ private: QStringList m_whitelist; QStringList m_blacklist; - QWebEngineCookieStoreClient *m_client; + QWebEngineCookieStore *m_client; }; #endif // COOKIEJAR_H diff --git a/src/lib/network/networkurlinterceptor.cpp b/src/lib/network/networkurlinterceptor.cpp index 370da55a2..7c13a9119 100644 --- a/src/lib/network/networkurlinterceptor.cpp +++ b/src/lib/network/networkurlinterceptor.cpp @@ -26,21 +26,14 @@ NetworkUrlInterceptor::NetworkUrlInterceptor(QObject *parent) { } -bool NetworkUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) +void NetworkUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) { - bool result = false; - - if (m_sendDNT) { - result = true; - info.setExtraHeader(QByteArrayLiteral("DNT"), QByteArrayLiteral("1")); - } + if (m_sendDNT) + info.setHttpHeader(QByteArrayLiteral("DNT"), QByteArrayLiteral("1")); foreach (UrlInterceptor *interceptor, m_interceptors) { - if (interceptor->interceptRequest(info)) - result = true; + interceptor->interceptRequest(info); } - - return result; } void NetworkUrlInterceptor::installUrlInterceptor(UrlInterceptor *interceptor) diff --git a/src/lib/network/networkurlinterceptor.h b/src/lib/network/networkurlinterceptor.h index 03d6c666e..8f862d7f2 100644 --- a/src/lib/network/networkurlinterceptor.h +++ b/src/lib/network/networkurlinterceptor.h @@ -30,7 +30,7 @@ class QUPZILLA_EXPORT NetworkUrlInterceptor : public QWebEngineUrlRequestInterce public: explicit NetworkUrlInterceptor(QObject* parent = Q_NULLPTR); - bool interceptRequest(QWebEngineUrlRequestInfo &info); + void interceptRequest(QWebEngineUrlRequestInfo &info) Q_DECL_OVERRIDE; void installUrlInterceptor(UrlInterceptor *interceptor); void removeUrlInterceptor(UrlInterceptor *interceptor); diff --git a/src/lib/network/urlinterceptor.h b/src/lib/network/urlinterceptor.h index 386fbb6f0..ac25bc358 100644 --- a/src/lib/network/urlinterceptor.h +++ b/src/lib/network/urlinterceptor.h @@ -26,7 +26,7 @@ class UrlInterceptor : public QObject { public: explicit UrlInterceptor(QObject *parent = Q_NULLPTR) : QObject(parent) { } - virtual bool interceptRequest(QWebEngineUrlRequestInfo &info) = 0; + virtual void interceptRequest(QWebEngineUrlRequestInfo &info) = 0; }; #endif // URLINTERCEPTOR_H diff --git a/src/plugins/GreaseMonkey/gm_urlinterceptor.cpp b/src/plugins/GreaseMonkey/gm_urlinterceptor.cpp index 1b7b917ac..c60509280 100644 --- a/src/plugins/GreaseMonkey/gm_urlinterceptor.cpp +++ b/src/plugins/GreaseMonkey/gm_urlinterceptor.cpp @@ -24,14 +24,11 @@ GM_UrlInterceptor::GM_UrlInterceptor(GM_Manager *manager) { } -bool GM_UrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) +void GM_UrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) { if (info.requestUrl().toString().endsWith(QLatin1String(".user.js"))) { m_manager->downloadScript(info.requestUrl()); info.block(true); - return true; } - - return false; } diff --git a/src/plugins/GreaseMonkey/gm_urlinterceptor.h b/src/plugins/GreaseMonkey/gm_urlinterceptor.h index 60a832143..349923bc3 100644 --- a/src/plugins/GreaseMonkey/gm_urlinterceptor.h +++ b/src/plugins/GreaseMonkey/gm_urlinterceptor.h @@ -28,7 +28,7 @@ class GM_UrlInterceptor : public UrlInterceptor public: explicit GM_UrlInterceptor(GM_Manager* manager); - bool interceptRequest(QWebEngineUrlRequestInfo &info); + void interceptRequest(QWebEngineUrlRequestInfo &info); private: GM_Manager *m_manager;