From f507a7a5557c7cca9570c684920e055c5251b08e Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Wed, 18 Jul 2018 10:07:51 +0200 Subject: AdBlockRule: move matching logic to FilterRule --- src/webengine/urlinterceptor.cpp | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'src/webengine/urlinterceptor.cpp') diff --git a/src/webengine/urlinterceptor.cpp b/src/webengine/urlinterceptor.cpp index 1b44c47..a66ab57 100644 --- a/src/webengine/urlinterceptor.cpp +++ b/src/webengine/urlinterceptor.cpp @@ -39,24 +39,7 @@ UrlRequestInterceptor::UrlRequestInterceptor(const std::unique_ptrvalue("filter.json-path").value()); - if(rules.open(QIODevice::ReadOnly | QIODevice::Text)) { - auto doc = QJsonDocument::fromJson(rules.readAll()).object(); - Q_ASSERT(doc.value("domains").isArray()); - for(QJsonValue d : doc.value("domains").toArray()) { - domain.addDomain(d.toString()); - } - - Q_ASSERT(doc.value("rules").isArray()); - for(QJsonValue rule : doc.value("rules").toArray()) { - auto p = std::make_unique(rule.toObject()); - parseJson(p, rule.toObject()); - domain.addRule(p); - } - - rules.close(); - } } @@ -72,10 +55,6 @@ void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) return; } - if(domain.hasMatch(info.requestUrl().host())) { - domain.process(info); - } - #ifdef QT_DEBUG // qDebug("request>>>"); // qDebug("firstParty url=%s", qUtf8Printable(info.firstPartyUrl().toString())); -- cgit v1.2.1