OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 /** | 384 /** |
385 * Retrieves an element hiding filter by the corresponding protocol key | 385 * Retrieves an element hiding filter by the corresponding protocol key |
386 */ | 386 */ |
387 getFilterByKey: function(/**String*/ key) /**Filter*/ | 387 getFilterByKey: function(/**String*/ key) /**Filter*/ |
388 { | 388 { |
389 return (key in filterByKey ? filterByKey[key] : null); | 389 return (key in filterByKey ? filterByKey[key] : null); |
390 }, | 390 }, |
391 | 391 |
392 /** | 392 /** |
393 * Returns a list of all selectors active on a particular domain (currently | 393 * Returns a list of all selectors active on a particular domain (currently |
394 * used only in Chrome). | 394 * used only in Chrome, Opera and Safari). |
395 */ | 395 */ |
396 getSelectorsForDomain: function(/**String*/ domain, /**Boolean*/ specificOnly) | 396 getSelectorsForDomain: function(/**String*/ domain, /**Boolean*/ specificOnly) |
397 { | 397 { |
398 let result = []; | 398 let result = []; |
399 for (let key in filterByKey) | 399 for (let key in filterByKey) |
400 { | 400 { |
401 let filter = filterByKey[key]; | 401 let filter = filterByKey[key]; |
402 if (specificOnly && (!filter.domains || filter.domains[""])) | 402 |
| 403 // it is important to always access filter.domains |
| 404 // here, even if it isn't used, in order to |
| 405 // workaround WebKit bug 132872, also see #419 |
| 406 let domains = filter.domains; |
| 407 |
| 408 if (specificOnly && (!domains || domains[""])) |
403 continue; | 409 continue; |
404 | 410 |
405 if (filter.isActiveOnDomain(domain) && !this.getException(filter, domain)) | 411 if (filter.isActiveOnDomain(domain) && !this.getException(filter, domain)) |
406 result.push(filter.selector); | 412 result.push(filter.selector); |
407 } | 413 } |
408 return result; | 414 return result; |
409 } | 415 } |
410 }; | 416 }; |
OLD | NEW |