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: Created May 20, 2016, 11:12 a.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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 } 204 }
205
206 if (usingFiltersByDomain)
207 {
208 let domains = Object.keys(filter.domains || defaultDomains);
Sebastian Noack 2016/05/20 12:20:44 So in the case here for..in would be actually slow
kzar 2016/05/20 12:49:29 Well I didn't think about it either way to be hone
kzar 2016/05/20 13:13:38 As we discussed in IRC I did a quick test of this
209 for (let domain of domains)
210 {
211 let filters = filtersByDomain[domain];
212 if (filters)
213 delete filters[filter.text];
kzar 2016/05/20 11:36:12 Note: There is a memory leak here. I don't delete
Wladimir Palant 2016/05/20 12:17:51 I don't think that this is a big deal. All filters
Sebastian Noack 2016/05/20 12:20:44 How did you try to delete filtersByDomain[domain]?
Sebastian Noack 2016/05/20 12:29:24 What if an element hiding filter is given in two s
Wladimir Palant 2016/05/20 12:40:05 Frankly, I don't care. No matter how you do it, it
Wladimir Palant 2016/05/20 12:40:05 That case is being handled elsewhere (FilterListen
kzar 2016/05/20 12:49:29 Whoops sorry, I moved this at the last minute and
kzar 2016/05/20 12:49:29 I didn't consider that. I'm not sure how we can ha
kzar 2016/05/20 12:49:29 Well I tried those ideas already except using .get
214 }
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))
214 return null; 225 return null;
(...skipping 225 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