1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

AdBlockRule: Add new rule type Invalid for invalid rules

This commit is contained in:
nowrep 2013-11-02 17:41:51 +01:00
parent 6f6bba66f6
commit 4a85e59778
2 changed files with 7 additions and 2 deletions

View File

@ -47,9 +47,9 @@
#include "adblockrule.h"
#include "adblocksubscription.h"
#include "qztools.h"
#include "qzregexp.h"
#include <QDebug>
#include "qzregexp.h"
#include <QUrl>
#include <QString>
#include <QStringList>
@ -362,6 +362,7 @@ void AdBlockRule::parseFilter()
// Empty rule or just comment
if (m_filter.trimmed().isEmpty() || m_filter.startsWith(QLatin1Char('!'))) {
m_isEnabled = false;
m_type = Invalid;
return;
}
@ -445,6 +446,7 @@ void AdBlockRule::parseFilter()
// If we don't handle all options, it's safer to just disable this rule
if (handledOptions != options.count()) {
m_isInternalDisabled = true;
m_type = Invalid;
return;
}

View File

@ -106,7 +106,8 @@ private:
DomainMatchRule = 1,
RegExpMatchRule = 2,
StringEndsMatchRule = 3,
StringContainsMatchRule = 4
StringContainsMatchRule = 4,
Invalid = 5
};
enum RuleOption {
@ -153,6 +154,8 @@ private:
QStringList m_allowedDomains;
QStringList m_blockedDomains;
friend class AdBlockSearchTree;
};
#endif // ADBLOCKRULE_H