1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

[Acid3] Make Acid3 test pass with enabled AdBlock.

AdBlock element hiding rules are inserted into body element of
page. This does not like the Acid3 test.
This commit is contained in:
nowrep 2013-05-05 00:14:42 +02:00
parent 39e6e1a0f1
commit a65d7b00b3
2 changed files with 11 additions and 2 deletions

View File

@ -313,7 +313,7 @@ void AdBlockManager::save()
settings.endGroup(); settings.endGroup();
} }
bool AdBlockManager::isEnabled() bool AdBlockManager::isEnabled() const
{ {
return m_enabled; return m_enabled;
} }
@ -353,6 +353,15 @@ QString AdBlockManager::elementHidingRules() const
QString AdBlockManager::elementHidingRulesForDomain(const QUrl &url) const QString AdBlockManager::elementHidingRulesForDomain(const QUrl &url) const
{ {
if (!isEnabled() || !canRunOnScheme(url.scheme())) {
return QString();
}
// Acid3 doesn't like the way element hiding rules are embedded into page
if (url.host() == QLatin1String("acid3.acidtests.org")) {
return QString();
}
QString rules; QString rules;
foreach (AdBlockSubscription* subscription, m_subscriptions) { foreach (AdBlockSubscription* subscription, m_subscriptions) {

View File

@ -45,7 +45,7 @@ public:
void load(); void load();
void save(); void save();
bool isEnabled(); bool isEnabled() const;
bool canRunOnScheme(const QString &scheme) const; bool canRunOnScheme(const QString &scheme) const;
QString elementHidingRules() const; QString elementHidingRules() const;