[Pkg-mozext-commits] [adblock-plus] 439/464: Issue 430 - added case for filter hit reset in Filter Listener

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 20:44:42 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit e9fd2d9e0f0c72c129369e8b28bb2205124c6d59
Author: Manvel Saroyan <manvel at adblockplus.org>
Date:   Fri Jun 13 13:19:02 2014 +0400

    Issue 430 - added case for filter hit reset in Filter Listener
---
 lib/filterListener.js | 9 +++++++--
 lib/ui.js             | 2 --
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/filterListener.js b/lib/filterListener.js
index 3b5a209..1687a26 100644
--- a/lib/filterListener.js
+++ b/lib/filterListener.js
@@ -46,7 +46,7 @@ let isDirty = 0;
  * This object can be used to change properties of the filter change listeners.
  * @class
  */
-let FilterListener = exports.FilterListener =
+let FilterListener =
 {
   /**
    * Set to true when executing many changes, changes will only be fully applied after this variable is set to false again.
@@ -235,7 +235,12 @@ function onSubscriptionChange(action, subscription, newValue, oldValue)
  */
 function onFilterChange(action, filter, newValue, oldValue)
 {
-  if (action == "hitCount" || action == "lastHit")
+  if (action == "hitCount" && newValue == 0)
+  {
+    // Filter hits are being reset, make sure these changes are saved.
+    FilterListener.setDirty(0);
+  }
+  else if (action == "hitCount" || action == "lastHit")
     FilterListener.setDirty(0.002);
   else
     FilterListener.setDirty(1);
diff --git a/lib/ui.js b/lib/ui.js
index ab5b089..b3dcbe5 100644
--- a/lib/ui.js
+++ b/lib/ui.js
@@ -21,7 +21,6 @@ Cu.import("resource://gre/modules/Services.jsm");
 let {Utils} = require("utils");
 let {Prefs} = require("prefs");
 let {Policy} = require("contentPolicy");
-let {FilterListener} = require("filterListener");
 let {FilterStorage} = require("filterStorage");
 let {FilterNotifier} = require("filterNotifier");
 let {RequestNotifier} = require("requestNotifier");
@@ -1190,7 +1189,6 @@ let UI = exports.UI =
         return;
 
       FilterStorage.resetHitCounts();
-      FilterListener.setDirty(0);   // Force saving to disk
       Prefs.savestats = false;
     }
     else

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list