OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 12 matching lines...) Expand all Loading... |
23 Cu.import("resource://gre/modules/Services.jsm"); | 23 Cu.import("resource://gre/modules/Services.jsm"); |
24 | 24 |
25 let {FilterStorage} = require("filterStorage"); | 25 let {FilterStorage} = require("filterStorage"); |
26 let {FilterNotifier} = require("filterNotifier"); | 26 let {FilterNotifier} = require("filterNotifier"); |
27 let {ElemHide} = require("elemHide"); | 27 let {ElemHide} = require("elemHide"); |
28 let {CSSRules} = require("cssRules"); | 28 let {CSSRules} = require("cssRules"); |
29 let {defaultMatcher} = require("matcher"); | 29 let {defaultMatcher} = require("matcher"); |
30 let {ActiveFilter, RegExpFilter, ElemHideBase, CSSPropertyFilter} = | 30 let {ActiveFilter, RegExpFilter, ElemHideBase, CSSPropertyFilter} = |
31 require("filterClasses"); | 31 require("filterClasses"); |
32 let {Prefs} = require("prefs"); | 32 let {Prefs} = require("prefs"); |
| 33 let FilterHits = null; |
| 34 try |
| 35 { |
| 36 ({FilterHits} = require("filterHits")); |
| 37 } |
| 38 catch (e) {} |
33 | 39 |
34 /** | 40 /** |
35 * Value of the FilterListener.batchMode property. | 41 * Value of the FilterListener.batchMode property. |
36 * @type Boolean | 42 * @type Boolean |
37 */ | 43 */ |
38 let batchMode = false; | 44 let batchMode = false; |
39 | 45 |
40 /** | 46 /** |
41 * Increases on filter changes, filters will be saved if it exceeds 1. | 47 * Increases on filter changes, filters will be saved if it exceeds 1. |
42 * @type Integer | 48 * @type Integer |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 * @class | 94 * @class |
89 */ | 95 */ |
90 let HistoryPurgeObserver = | 96 let HistoryPurgeObserver = |
91 { | 97 { |
92 observe: function(subject, topic, data) | 98 observe: function(subject, topic, data) |
93 { | 99 { |
94 if (topic == "browser:purge-session-history" && Prefs.clearStatsOnHistoryPur
ge) | 100 if (topic == "browser:purge-session-history" && Prefs.clearStatsOnHistoryPur
ge) |
95 { | 101 { |
96 FilterStorage.resetHitCounts(); | 102 FilterStorage.resetHitCounts(); |
97 FilterListener.setDirty(0); // Force saving to disk | 103 FilterListener.setDirty(0); // Force saving to disk |
| 104 if (FilterHits) |
| 105 FilterHits.resetFilterHits(); |
98 | 106 |
99 Prefs.recentReports = []; | 107 Prefs.recentReports = []; |
100 } | 108 } |
101 }, | 109 }, |
102 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) | 110 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) |
103 }; | 111 }; |
104 | 112 |
105 /** | 113 /** |
106 * Initializes filter listener on startup, registers the necessary hooks. | 114 * Initializes filter listener on startup, registers the necessary hooks. |
107 */ | 115 */ |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 ElemHide.clear(); | 289 ElemHide.clear(); |
282 CSSRules.clear(); | 290 CSSRules.clear(); |
283 for (let subscription of FilterStorage.subscriptions) | 291 for (let subscription of FilterStorage.subscriptions) |
284 if (!subscription.disabled) | 292 if (!subscription.disabled) |
285 subscription.filters.forEach(addFilter); | 293 subscription.filters.forEach(addFilter); |
286 flushElemHide(); | 294 flushElemHide(); |
287 } | 295 } |
288 else if (action == "save") | 296 else if (action == "save") |
289 isDirty = 0; | 297 isDirty = 0; |
290 } | 298 } |
OLD | NEW |