Skip to content
This repository has been archived by the owner on May 10, 2018. It is now read-only.

Commit

Permalink
AdBlock: Fix issue when enabling rule didn't work until restart.
Browse files Browse the repository at this point in the history
When attempting to enable rule that was already disabled on startup,
it won't have an effect until completely restarting the browser.
  • Loading branch information
nowrep committed Nov 4, 2013
1 parent 2abefea commit 5fbf11c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG
Expand Up @@ -9,6 +9,7 @@ Version 1.5.0
* added KWallet password backend plugin
* added Gnome-Keyring password backend plugin
* added StatusBar Icons plugin that adds extra icons to statusbar
* great performance improvement for matching basic rules in AdBlock
* themes can now be loaded from profile directories
* pagescreen can now save output into number of formats, including PDF
* proxy exceptions now supports wildcards (*, ?)
Expand All @@ -23,6 +24,7 @@ Version 1.5.0
* fixed: size of preferences dialog on low-res screens
* fixed: loading plugins with relative paths in portable build
* fixed: displaying a lot of RSS feeds in RSS widget in locationbar
* fixed: enabling disabled rules in AdBlock now works everytime

Version 1.4.4
* released 1 September 2013
Expand Down
3 changes: 3 additions & 0 deletions src/lib/adblock/adblockrule.cpp
Expand Up @@ -361,7 +361,10 @@ void AdBlockRule::parseFilter()

// Empty rule or just comment
if (m_filter.trimmed().isEmpty() || m_filter.startsWith(QLatin1Char('!'))) {
// We want to differentiate rule disabled by user and rule disabled in subscription file
// m_isInternalDisabled is also used when rule is disabled due to all options not being supported
m_isEnabled = false;
m_isInternalDisabled = true;
m_type = Invalid;
return;
}
Expand Down
10 changes: 9 additions & 1 deletion src/lib/adblock/adblocksubscription.cpp
Expand Up @@ -392,11 +392,19 @@ void AdBlockSubscription::populateCache()
int count = m_rules.count();
for (int i = 0; i < count; ++i) {
const AdBlockRule* rule = m_rules.at(i);
if (!rule->isEnabled()) {

// Don't add internally disabled rules to cache
if (rule->isInternalDisabled()) {
continue;
}

if (rule->isCssRule()) {
// We will add only enabled css rules to cache, because there is no enabled/disabled
// check on match. They are directly embedded to pages.
if (!rule->isEnabled()) {
continue;
}

if (rule->isDomainRestricted()) {
m_domainRestrictedCssRules.append(rule);
}
Expand Down

0 comments on commit 5fbf11c

Please sign in to comment.