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

Side by Side Diff: lib/elemHide.js

Issue 5229474392047616: Issue 2582 - Optimize loop in ElemHide.getSelectorsForDomain() for V8 (Closed)
Patch Set: Use Object.getOwnPropertyNames() Created June 3, 2015, 11:08 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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 return (key in filterByKey ? filterByKey[key] : null); 371 return (key in filterByKey ? filterByKey[key] : null);
372 }, 372 },
373 373
374 /** 374 /**
375 * Returns a list of all selectors active on a particular domain (currently 375 * Returns a list of all selectors active on a particular domain (currently
376 * used only in Chrome, Opera and Safari). 376 * used only in Chrome, Opera and Safari).
377 */ 377 */
378 getSelectorsForDomain: function(/**String*/ domain, /**Boolean*/ specificOnly) 378 getSelectorsForDomain: function(/**String*/ domain, /**Boolean*/ specificOnly)
379 { 379 {
380 let result = []; 380 let result = [];
381 for (let key in filterByKey) 381 let keys = Object.getOwnPropertyNames(filterByKey);
382 for (let key of keys)
382 { 383 {
383 let filter = filterByKey[key]; 384 let filter = filterByKey[key];
384 if (specificOnly && (!filter.domains || filter.domains[""])) 385 if (specificOnly && (!filter.domains || filter.domains[""]))
385 continue; 386 continue;
386 387
387 if (filter.isActiveOnDomain(domain) && !this.getException(filter, domain)) 388 if (filter.isActiveOnDomain(domain) && !this.getException(filter, domain))
388 result.push(filter.selector); 389 result.push(filter.selector);
389 } 390 }
390 return result; 391 return result;
391 } 392 }
392 }; 393 };
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