OLD | NEW |
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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 404 |
405 let elements = []; | 405 let elements = []; |
406 let elementFilters = []; | 406 let elementFilters = []; |
407 | 407 |
408 let cssStyles = []; | 408 let cssStyles = []; |
409 | 409 |
410 let stylesheetOnlyChange = !!stylesheets; | 410 let stylesheetOnlyChange = !!stylesheets; |
411 if (!stylesheets) | 411 if (!stylesheets) |
412 stylesheets = this.document.styleSheets; | 412 stylesheets = this.document.styleSheets; |
413 | 413 |
414 // Chrome < 51 doesn't have an iterable StyleSheetList | 414 for (let stylesheet of stylesheets) |
415 // https://issues.adblockplus.org/ticket/5381 | |
416 for (let i = 0; i < stylesheets.length; i++) | |
417 { | 415 { |
418 let stylesheet = stylesheets[i]; | |
419 // Explicitly ignore third-party stylesheets to ensure consistent behavior | 416 // Explicitly ignore third-party stylesheets to ensure consistent behavior |
420 // between Firefox and Chrome. | 417 // between Firefox and Chrome. |
421 if (!this.isSameOrigin(stylesheet)) | 418 if (!this.isSameOrigin(stylesheet)) |
422 continue; | 419 continue; |
423 | 420 |
424 let rules = stylesheet.cssRules; | 421 let rules = stylesheet.cssRules; |
425 if (!rules) | 422 if (!rules) |
426 continue; | 423 continue; |
427 | 424 |
428 // Chrome < 51 doesn't have an iterable CSSRuleList | 425 for (let rule of rules) |
429 // https://issues.adblockplus.org/ticket/5773 | |
430 for (let j = 0; j < rules.length; j++) | |
431 { | 426 { |
432 let rule = rules[j]; | |
433 if (rule.type != rule.STYLE_RULE) | 427 if (rule.type != rule.STYLE_RULE) |
434 continue; | 428 continue; |
435 | 429 |
436 cssStyles.push(stringifyStyle(rule)); | 430 cssStyles.push(stringifyStyle(rule)); |
437 } | 431 } |
438 } | 432 } |
439 | 433 |
440 let patterns = this.patterns.slice(); | 434 let patterns = this.patterns.slice(); |
441 let pattern = null; | 435 let pattern = null; |
442 let generator = null; | 436 let generator = null; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 characterData: true, | 591 characterData: true, |
598 subtree: true | 592 subtree: true |
599 } | 593 } |
600 ); | 594 ); |
601 this.document.addEventListener("load", this.onLoad.bind(this), true); | 595 this.document.addEventListener("load", this.onLoad.bind(this), true); |
602 } | 596 } |
603 } | 597 } |
604 }; | 598 }; |
605 | 599 |
606 exports.ElemHideEmulation = ElemHideEmulation; | 600 exports.ElemHideEmulation = ElemHideEmulation; |
OLD | NEW |