summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/adblock/adblockmanager.cpp9
-rw-r--r--src/adblock/adblockrule.cpp2
-rw-r--r--src/adblock/adblockruletextmatchimpl.cpp4
-rw-r--r--src/adblock/adblockruletextmatchimpl.h1
4 files changed, 14 insertions, 2 deletions
diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp
index 4b603b8c..fe4d028a 100644
--- a/src/adblock/adblockmanager.cpp
+++ b/src/adblock/adblockmanager.cpp
@@ -208,6 +208,9 @@ void AdBlockManager::loadRuleString(const QString &stringRule)
return;
const QString filter = stringRule.mid(2);
+ if (filter.isEmpty())
+ return;
+
AdBlockRule rule(filter);
_whiteList << rule;
return;
@@ -216,7 +219,11 @@ void AdBlockManager::loadRuleString(const QString &stringRule)
// hide (CSS) rules
if (stringRule.startsWith(QL1S("##")))
{
- _hideList << stringRule.mid(2);
+ const QString filter = stringRule.mid(2);
+ if (filter.isEmpty())
+ return;
+
+ _hideList << filter;
return;
}
diff --git a/src/adblock/adblockrule.cpp b/src/adblock/adblockrule.cpp
index d65c340d..01a8e420 100644
--- a/src/adblock/adblockrule.cpp
+++ b/src/adblock/adblockrule.cpp
@@ -59,7 +59,7 @@ RuleTypes AdBlockRule::ruleType(const QString &filter)
{
if (AdBlockRuleTextMatchImpl::isTextMatchFilter(filter))
return TextRule;
-
+
if (AdBlockRuleNullImpl::isNullFilter(filter))
return NullRule;
diff --git a/src/adblock/adblockruletextmatchimpl.cpp b/src/adblock/adblockruletextmatchimpl.cpp
index fd901e9c..1938cb92 100644
--- a/src/adblock/adblockruletextmatchimpl.cpp
+++ b/src/adblock/adblockruletextmatchimpl.cpp
@@ -3,6 +3,7 @@
* This file is a part of the rekonq project
*
* Copyright (C) 2010-2011 by Benjamin Poulain <ikipou at gmail dot com>
+* Copyright (C) 2010-2013 by Andrea Diamantini <adjam7 at gmail dot com>
*
*
* This program is free software; you can redistribute it and/or
@@ -48,6 +49,9 @@ bool AdBlockRuleTextMatchImpl::match(const QNetworkRequest &request, const QStri
{
Q_UNUSED(request);
Q_UNUSED(encodedUrl);
+ if (m_textToMatch.isEmpty())
+ return false;
+
// Case sensitive compare is faster, but would be incorrect with encodedUrl since
// we do want case insensitive.
// What we do is work on a lowercase version of m_textToMatch, and compare to the lowercase
diff --git a/src/adblock/adblockruletextmatchimpl.h b/src/adblock/adblockruletextmatchimpl.h
index 7a99f41d..8c1b1363 100644
--- a/src/adblock/adblockruletextmatchimpl.h
+++ b/src/adblock/adblockruletextmatchimpl.h
@@ -3,6 +3,7 @@
* This file is a part of the rekonq project
*
* Copyright (C) 2010-2011 by Benjamin Poulain <ikipou at gmail dot com>
+* Copyright (C) 2010-2013 by Andrea Diamantini <adjam7 at gmail dot com>
*
*
* This program is free software; you can redistribute it and/or