aboutsummaryrefslogtreecommitdiff
path: root/src/webengine
diff options
context:
space:
mode:
Diffstat (limited to 'src/webengine')
-rw-r--r--src/webengine/urlinterceptor.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/webengine/urlinterceptor.cpp b/src/webengine/urlinterceptor.cpp
index 3ffcb44..19bc64f 100644
--- a/src/webengine/urlinterceptor.cpp
+++ b/src/webengine/urlinterceptor.cpp
@@ -21,10 +21,6 @@
#include "urlinterceptor.h"
#include "filter/filtercollection.h"
-#ifdef DEBUG_VERBOSE
-#include <QTime>
-#endif
-
UrlRequestInterceptor::UrlRequestInterceptor(QObject *parent) :
QWebEngineUrlRequestInterceptor(parent)
{
@@ -33,25 +29,18 @@ UrlRequestInterceptor::UrlRequestInterceptor(QObject *parent) :
void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{
#ifdef DEBUG_VERBOSE
- QTime time;
- qDebug("%s --> [%i] %s", qUtf8Printable(info.firstPartyUrl().toString()), info.resourceType(), qUtf8Printable(info.requestUrl().toString()));
- time.start();
+ qDebug("%s -[%i]-> %s", qUtf8Printable(info.firstPartyUrl().toString()), info.resourceType(), qUtf8Printable(info.requestUrl().toString()));
#endif
-
for(auto s : m_manager->subscriptions()) {
- FilterCollection::MatchResult r = s->match(info);
- if(r.match) {
- info.block(r.block);
+ bool shouldBlock = s->match(info);
+ if(shouldBlock) {
+ info.block(true);
#ifdef DEBUG_VERBOSE
- qDebug(">> matched [%s] [%s] in %i ms", r.block ? "blocked" : "allowed", qUtf8Printable(r.pattern), time.elapsed());
+ qDebug(">> blocked");
#endif
return;
}
}
-
-#ifdef DEBUG_VERBOSE
- qDebug(">> passed in %i ms", time.elapsed());
-#endif
}
void UrlRequestInterceptor::setSubscription(BlockerManager *manager)