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

Side by Side Diff: lib/elemHide.js

Issue 29342837: Issue 4054 - Remove filters from filtersByDomain (Closed)
Patch Set: Corrected mistake in code ordering Created May 20, 2016, 12:48 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-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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 194 }
195 else 195 else
196 { 196 {
197 if (!(filter.text in keyByFilter)) 197 if (!(filter.text in keyByFilter))
198 return; 198 return;
199 199
200 let key = keyByFilter[filter.text]; 200 let key = keyByFilter[filter.text];
201 delete filterByKey[key]; 201 delete filterByKey[key];
202 delete keyByFilter[filter.text]; 202 delete keyByFilter[filter.text];
203 ElemHide.isDirty = true; 203 ElemHide.isDirty = true;
204
205 if (usingFiltersByDomain)
206 {
207 let domains = Object.keys(filter.domains || defaultDomains);
208 for (let domain of domains)
Wladimir Palant 2016/05/20 13:12:34 So how about making this code consistent to the on
kzar 2016/05/20 13:14:25 Done.
209 {
210 let filters = filtersByDomain[domain];
211 if (filters)
212 delete filters[filter.text];
213 }
214 }
204 } 215 }
205 }, 216 },
206 217
207 /** 218 /**
208 * Checks whether an exception rule is registered for a filter on a particular 219 * Checks whether an exception rule is registered for a filter on a particular
209 * domain. 220 * domain.
210 */ 221 */
211 getException: function(/**Filter*/ filter, /**String*/ docDomain) /**ElemHideE xception*/ 222 getException: function(/**Filter*/ filter, /**String*/ docDomain) /**ElemHideE xception*/
212 { 223 {
213 if (!(filter.selector in exceptions)) 224 if (!(filter.selector in exceptions))
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 if (currentDomain == "") 451 if (currentDomain == "")
441 break; 452 break;
442 453
443 let nextDot = currentDomain.indexOf("."); 454 let nextDot = currentDomain.indexOf(".");
444 currentDomain = nextDot == -1 ? "" : currentDomain.substr(nextDot + 1); 455 currentDomain = nextDot == -1 ? "" : currentDomain.substr(nextDot + 1);
445 } 456 }
446 457
447 return selectors; 458 return selectors;
448 } 459 }
449 }; 460 };
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