LEFT | RIGHT |
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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 Cu.reportError(e); | 372 Cu.reportError(e); |
373 } | 373 } |
374 ElemHide.applied = false; | 374 ElemHide.applied = false; |
375 } | 375 } |
376 }, | 376 }, |
377 | 377 |
378 /** | 378 /** |
379 * Retrieves the currently applied stylesheet URL | 379 * Retrieves the currently applied stylesheet URL |
380 * @type String | 380 * @type String |
381 */ | 381 */ |
382 get styleURL() { | 382 get styleURL() |
| 383 { |
383 return ElemHide.applied ? styleURL.spec : null; | 384 return ElemHide.applied ? styleURL.spec : null; |
384 }, | 385 }, |
385 | 386 |
386 /** | 387 /** |
387 * Retrieves an element hiding filter by the corresponding protocol key | 388 * Retrieves an element hiding filter by the corresponding protocol key |
388 */ | 389 */ |
389 getFilterByKey: function(/**String*/ key) /**Filter*/ | 390 getFilterByKey: function(/**String*/ key) /**Filter*/ |
390 { | 391 { |
391 return (key in filterByKey ? filterByKey[key] : null); | 392 return (key in filterByKey ? filterByKey[key] : null); |
392 }, | 393 }, |
393 | 394 |
394 /** | 395 /** |
395 * Returns a list of all selectors active on a particular domain (currently | 396 * Returns a list of all selectors active on a particular domain (currently |
396 * used only in Chrome). | 397 * used only in Chrome, Opera and Safari). |
397 */ | 398 */ |
398 getSelectorsForDomain: function(/**String*/ domain, /**Boolean*/ specificOnly) | 399 getSelectorsForDomain: function(/**String*/ domain, /**Boolean*/ specificOnly) |
399 { | 400 { |
400 let result = []; | 401 let result = []; |
401 for (let key in filterByKey) | 402 for (let key in filterByKey) |
402 { | 403 { |
403 let filter = filterByKey[key]; | 404 let filter = filterByKey[key]; |
404 if (specificOnly && (!filter.domains || filter.domains[""])) | 405 |
| 406 // it is important to always access filter.domains |
| 407 // here, even if it isn't used, in order to |
| 408 // workaround WebKit bug 132872, also see #419 |
| 409 let domains = filter.domains; |
| 410 |
| 411 if (specificOnly && (!domains || domains[""])) |
405 continue; | 412 continue; |
406 | 413 |
407 if (filter.isActiveOnDomain(domain) && !this.getException(filter, domain)) | 414 if (filter.isActiveOnDomain(domain) && !this.getException(filter, domain)) |
408 result.push(filter.selector); | 415 result.push(filter.selector); |
409 } | 416 } |
410 return result; | 417 return result; |
411 } | 418 } |
412 }; | 419 }; |
LEFT | RIGHT |