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

Side by Side Diff: lib/elemHide.js

Issue 29853558: Noissue - Delete element hiding domain entry once all filters removed (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Aug. 11, 2018, 1:04 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 | « no previous file | no next file » | 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
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 unconditionalSelectors = null; 188 unconditionalSelectors = null;
189 } 189 }
190 // Conditionally applied element hiding filters 190 // Conditionally applied element hiding filters
191 else 191 else
192 { 192 {
193 let domains = filter.domains || defaultDomains; 193 let domains = filter.domains || defaultDomains;
194 for (let domain of domains.keys()) 194 for (let domain of domains.keys())
195 { 195 {
196 let filters = filtersByDomain.get(domain); 196 let filters = filtersByDomain.get(domain);
197 if (filters) 197 if (filters)
198 {
198 filters.delete(filter); 199 filters.delete(filter);
200
201 if (filters.size == 0)
202 filtersByDomain.delete(domain);
203 }
199 } 204 }
200 } 205 }
201 206
202 knownFilters.delete(filter); 207 knownFilters.delete(filter);
203 FilterNotifier.emit("elemhideupdate"); 208 FilterNotifier.emit("elemhideupdate");
204 }, 209 },
205 210
206 /** 211 /**
207 * Checks whether an exception rule is registered for a selector on a 212 * Checks whether an exception rule is registered for a selector on a
208 * particular domain. 213 * particular domain.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 let nextDot = currentDomain.indexOf("."); 278 let nextDot = currentDomain.indexOf(".");
274 currentDomain = nextDot == -1 ? "" : currentDomain.substr(nextDot + 1); 279 currentDomain = nextDot == -1 ? "" : currentDomain.substr(nextDot + 1);
275 } 280 }
276 281
277 if (!specificOnly) 282 if (!specificOnly)
278 selectors = getUnconditionalSelectors().concat(selectors); 283 selectors = getUnconditionalSelectors().concat(selectors);
279 284
280 return selectors; 285 return selectors;
281 } 286 }
282 }; 287 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld