mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-24 12:46:35 +01:00
AdBlock: Don't remove url interceptor when disabled
Instead just return early in block() when AdBlock is disabled
This commit is contained in:
parent
8cbccbf71d
commit
690eb2c447
@ -99,6 +99,10 @@ bool AdBlockManager::block(QWebEngineUrlRequestInfo &request)
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
|
||||
if (!isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef ADBLOCK_DEBUG
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
@ -107,8 +111,9 @@ bool AdBlockManager::block(QWebEngineUrlRequestInfo &request)
|
||||
const QString urlDomain = request.requestUrl().host().toLower();
|
||||
const QString urlScheme = request.requestUrl().scheme().toLower();
|
||||
|
||||
if (!isEnabled() || !canRunOnScheme(urlScheme) || !canBeBlocked(request.firstPartyUrl()))
|
||||
return 0;
|
||||
if (!canRunOnScheme(urlScheme) || !canBeBlocked(request.firstPartyUrl())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool res = false;
|
||||
const AdBlockRule* blockedRule = m_matcher->match(request, urlDomain, urlString);
|
||||
@ -267,7 +272,6 @@ void AdBlockManager::load()
|
||||
settings.endGroup();
|
||||
|
||||
if (!m_enabled) {
|
||||
mApp->networkManager()->removeUrlInterceptor(m_interceptor);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user