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: Rebase, add tests Created Aug. 15, 2018, 10:13 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 | test/elemHide.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
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 unconditionalSelectors = null; 166 unconditionalSelectors = null;
167 } 167 }
168 // Conditionally applied element hiding filters 168 // Conditionally applied element hiding filters
169 else 169 else
170 { 170 {
171 let domains = filter.domains || defaultDomains; 171 let domains = filter.domains || defaultDomains;
172 for (let domain of domains.keys()) 172 for (let domain of domains.keys())
173 { 173 {
174 let filters = filtersByDomain.get(domain); 174 let filters = filtersByDomain.get(domain);
175 if (filters) 175 if (filters)
176 {
176 filters.delete(filter); 177 filters.delete(filter);
178
179 if (filters.size == 0)
180 filtersByDomain.delete(domain);
181 }
177 } 182 }
178 } 183 }
179 184
180 knownFilters.delete(filter); 185 knownFilters.delete(filter);
181 FilterNotifier.emit("elemhideupdate"); 186 FilterNotifier.emit("elemhideupdate");
182 }, 187 },
183 188
184 /** 189 /**
185 * Determines from the current filter list which selectors should be applied 190 * Determines from the current filter list which selectors should be applied
186 * on a particular host name. 191 * on a particular host name.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 let nextDot = currentDomain.indexOf("."); 234 let nextDot = currentDomain.indexOf(".");
230 currentDomain = nextDot == -1 ? "" : currentDomain.substr(nextDot + 1); 235 currentDomain = nextDot == -1 ? "" : currentDomain.substr(nextDot + 1);
231 } 236 }
232 237
233 if (!specificOnly) 238 if (!specificOnly)
234 selectors = getUnconditionalSelectors().concat(selectors); 239 selectors = getUnconditionalSelectors().concat(selectors);
235 240
236 return selectors; 241 return selectors;
237 } 242 }
238 }; 243 };
OLDNEW
« no previous file with comments | « no previous file | test/elemHide.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld