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 14 matching lines...) Expand all Loading... |
25 Cu.import("resource://gre/modules/Services.jsm"); | 25 Cu.import("resource://gre/modules/Services.jsm"); |
26 | 26 |
27 let {FilterStorage} = require("filterStorage"); | 27 let {FilterStorage} = require("filterStorage"); |
28 let {FilterNotifier} = require("filterNotifier"); | 28 let {FilterNotifier} = require("filterNotifier"); |
29 let {ElemHide} = require("elemHide"); | 29 let {ElemHide} = require("elemHide"); |
30 let {CSSRules} = require("cssRules"); | 30 let {CSSRules} = require("cssRules"); |
31 let {defaultMatcher} = require("matcher"); | 31 let {defaultMatcher} = require("matcher"); |
32 let {ActiveFilter, RegExpFilter, ElemHideBase, CSSPropertyFilter} = | 32 let {ActiveFilter, RegExpFilter, ElemHideBase, CSSPropertyFilter} = |
33 require("filterClasses"); | 33 require("filterClasses"); |
34 let {Prefs} = require("prefs"); | 34 let {Prefs} = require("prefs"); |
| 35 let FilterHits = null; |
| 36 try |
| 37 { |
| 38 ({FilterHits} = require("filterHits")); |
| 39 } |
| 40 catch (e) {} |
35 | 41 |
36 /** | 42 /** |
37 * Value of the FilterListener.batchMode property. | 43 * Value of the FilterListener.batchMode property. |
38 * @type Boolean | 44 * @type Boolean |
39 */ | 45 */ |
40 let batchMode = false; | 46 let batchMode = false; |
41 | 47 |
42 /** | 48 /** |
43 * Increases on filter changes, filters will be saved if it exceeds 1. | 49 * Increases on filter changes, filters will be saved if it exceeds 1. |
44 * @type Integer | 50 * @type Integer |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 * @class | 96 * @class |
91 */ | 97 */ |
92 let HistoryPurgeObserver = | 98 let HistoryPurgeObserver = |
93 { | 99 { |
94 observe: function(subject, topic, data) | 100 observe: function(subject, topic, data) |
95 { | 101 { |
96 if (topic == "browser:purge-session-history" && Prefs.clearStatsOnHistoryPur
ge) | 102 if (topic == "browser:purge-session-history" && Prefs.clearStatsOnHistoryPur
ge) |
97 { | 103 { |
98 FilterStorage.resetHitCounts(); | 104 FilterStorage.resetHitCounts(); |
99 FilterListener.setDirty(0); // Force saving to disk | 105 FilterListener.setDirty(0); // Force saving to disk |
| 106 if (FilterHits) |
| 107 FilterHits.resetFilterHits(); |
100 | 108 |
101 Prefs.recentReports = []; | 109 Prefs.recentReports = []; |
102 } | 110 } |
103 }, | 111 }, |
104 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) | 112 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) |
105 }; | 113 }; |
106 | 114 |
107 /** | 115 /** |
108 * Initializes filter listener on startup, registers the necessary hooks. | 116 * Initializes filter listener on startup, registers the necessary hooks. |
109 */ | 117 */ |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 for (let subscription of FilterStorage.subscriptions) | 332 for (let subscription of FilterStorage.subscriptions) |
325 if (!subscription.disabled) | 333 if (!subscription.disabled) |
326 subscription.filters.forEach(addFilter); | 334 subscription.filters.forEach(addFilter); |
327 flushElemHide(); | 335 flushElemHide(); |
328 } | 336 } |
329 | 337 |
330 function onSave() | 338 function onSave() |
331 { | 339 { |
332 isDirty = 0; | 340 isDirty = 0; |
333 } | 341 } |
OLD | NEW |