Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/filterListener.js

Issue 29868577: Issue 6891 - Rename FilterNotifier to filterNotifier (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Aug. 29, 2018, 2 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/filterClasses.js ('k') | lib/filterNotifier.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 "use strict"; 18 "use strict";
19 19
20 /** 20 /**
21 * @fileOverview Component synchronizing filter storage with Matcher 21 * @fileOverview Component synchronizing filter storage with Matcher
22 * instances and ElemHide. 22 * instances and ElemHide.
23 */ 23 */
24 24
25 const {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); 25 const {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
26 const {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {}); 26 const {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
27 27
28 const {FilterStorage} = require("./filterStorage"); 28 const {FilterStorage} = require("./filterStorage");
29 const {FilterNotifier} = require("./filterNotifier"); 29 const {filterNotifier} = require("./filterNotifier");
30 const {ElemHide} = require("./elemHide"); 30 const {ElemHide} = require("./elemHide");
31 const {ElemHideEmulation} = require("./elemHideEmulation"); 31 const {ElemHideEmulation} = require("./elemHideEmulation");
32 const {ElemHideExceptions} = require("./elemHideExceptions"); 32 const {ElemHideExceptions} = require("./elemHideExceptions");
33 const {Snippets} = require("./snippets"); 33 const {Snippets} = require("./snippets");
34 const {defaultMatcher} = require("./matcher"); 34 const {defaultMatcher} = require("./matcher");
35 const {ActiveFilter, RegExpFilter, 35 const {ActiveFilter, RegExpFilter,
36 ElemHideBase, ElemHideFilter, ElemHideEmulationFilter, 36 ElemHideBase, ElemHideFilter, ElemHideEmulationFilter,
37 SnippetFilter} = require("./filterClasses"); 37 SnippetFilter} = require("./filterClasses");
38 const {SpecialSubscription} = require("./subscriptionClasses"); 38 const {SpecialSubscription} = require("./subscriptionClasses");
39 const {Prefs} = require("prefs"); 39 const {Prefs} = require("prefs");
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 QueryInterface: XPCOMUtils.generateQI( 90 QueryInterface: XPCOMUtils.generateQI(
91 [Ci.nsISupportsWeakReference, Ci.nsIObserver] 91 [Ci.nsISupportsWeakReference, Ci.nsIObserver]
92 ) 92 )
93 }; 93 };
94 94
95 /** 95 /**
96 * Initializes filter listener on startup, registers the necessary hooks. 96 * Initializes filter listener on startup, registers the necessary hooks.
97 */ 97 */
98 function init() 98 function init()
99 { 99 {
100 FilterNotifier.on("filter.hitCount", onFilterHitCount); 100 filterNotifier.on("filter.hitCount", onFilterHitCount);
101 FilterNotifier.on("filter.lastHit", onFilterLastHit); 101 filterNotifier.on("filter.lastHit", onFilterLastHit);
102 FilterNotifier.on("filter.added", onFilterAdded); 102 filterNotifier.on("filter.added", onFilterAdded);
103 FilterNotifier.on("filter.removed", onFilterRemoved); 103 filterNotifier.on("filter.removed", onFilterRemoved);
104 FilterNotifier.on("filter.disabled", onFilterDisabled); 104 filterNotifier.on("filter.disabled", onFilterDisabled);
105 FilterNotifier.on("filter.moved", onGenericChange); 105 filterNotifier.on("filter.moved", onGenericChange);
106 106
107 FilterNotifier.on("subscription.added", onSubscriptionAdded); 107 filterNotifier.on("subscription.added", onSubscriptionAdded);
108 FilterNotifier.on("subscription.removed", onSubscriptionRemoved); 108 filterNotifier.on("subscription.removed", onSubscriptionRemoved);
109 FilterNotifier.on("subscription.disabled", onSubscriptionDisabled); 109 filterNotifier.on("subscription.disabled", onSubscriptionDisabled);
110 FilterNotifier.on("subscription.updated", onSubscriptionUpdated); 110 filterNotifier.on("subscription.updated", onSubscriptionUpdated);
111 FilterNotifier.on("subscription.moved", onGenericChange); 111 filterNotifier.on("subscription.moved", onGenericChange);
112 FilterNotifier.on("subscription.title", onGenericChange); 112 filterNotifier.on("subscription.title", onGenericChange);
113 FilterNotifier.on("subscription.fixedTitle", onGenericChange); 113 filterNotifier.on("subscription.fixedTitle", onGenericChange);
114 FilterNotifier.on("subscription.homepage", onGenericChange); 114 filterNotifier.on("subscription.homepage", onGenericChange);
115 FilterNotifier.on("subscription.downloadStatus", onGenericChange); 115 filterNotifier.on("subscription.downloadStatus", onGenericChange);
116 FilterNotifier.on("subscription.lastCheck", onGenericChange); 116 filterNotifier.on("subscription.lastCheck", onGenericChange);
117 FilterNotifier.on("subscription.errors", onGenericChange); 117 filterNotifier.on("subscription.errors", onGenericChange);
118 118
119 FilterNotifier.on("load", onLoad); 119 filterNotifier.on("load", onLoad);
120 FilterNotifier.on("save", onSave); 120 filterNotifier.on("save", onSave);
121 121
122 FilterStorage.loadFromDisk(); 122 FilterStorage.loadFromDisk();
123 123
124 Services.obs.addObserver(HistoryPurgeObserver, 124 Services.obs.addObserver(HistoryPurgeObserver,
125 "browser:purge-session-history", true); 125 "browser:purge-session-history", true);
126 onShutdown.add(() => 126 onShutdown.add(() =>
127 { 127 {
128 Services.obs.removeObserver(HistoryPurgeObserver, 128 Services.obs.removeObserver(HistoryPurgeObserver,
129 "browser:purge-session-history"); 129 "browser:purge-session-history");
130 }); 130 });
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 { 340 {
341 if (!subscription.disabled) 341 if (!subscription.disabled)
342 addFilters(subscription.filters); 342 addFilters(subscription.filters);
343 } 343 }
344 } 344 }
345 345
346 function onSave() 346 function onSave()
347 { 347 {
348 isDirty = 0; 348 isDirty = 0;
349 } 349 }
OLDNEW
« no previous file with comments | « lib/filterClasses.js ('k') | lib/filterNotifier.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld