Left: | ||
Right: |
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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
601 if (mutations && patterns.some(pattern => pattern.dependsOnStylesAndDOM)) | 601 if (mutations && patterns.some(pattern => pattern.dependsOnStylesAndDOM)) |
602 stylesheets = this.document.styleSheets; | 602 stylesheets = this.document.styleSheets; |
603 | 603 |
604 for (let stylesheet of stylesheets || []) | 604 for (let stylesheet of stylesheets || []) |
605 { | 605 { |
606 // Explicitly ignore third-party stylesheets to ensure consistent behavior | 606 // Explicitly ignore third-party stylesheets to ensure consistent behavior |
607 // between Firefox and Chrome. | 607 // between Firefox and Chrome. |
608 if (!this.isSameOrigin(stylesheet)) | 608 if (!this.isSameOrigin(stylesheet)) |
609 continue; | 609 continue; |
610 | 610 |
611 let rules = stylesheet.cssRules; | 611 let rules; |
612 try | |
613 { | |
614 rules = stylesheet.cssRules; | |
615 } | |
616 catch (e) | |
617 { | |
618 // On Firefox, there is a chance that an InvalidAccessError | |
619 // get thrown when accessing cssRules. Just skip the stylesheet | |
620 // in that case. | |
621 // See https://issues.adblockplus.org/ticket/6382 | |
622 continue; | |
kzar
2018/04/18 16:12:30
I wonder if we should check that the exception rea
hub
2018/04/18 18:48:23
The intent here is to catch the exception to not i
kzar
2018/04/19 07:29:29
Acknowledged.
| |
623 } | |
624 | |
612 if (!rules) | 625 if (!rules) |
613 continue; | 626 continue; |
614 | 627 |
615 for (let rule of rules) | 628 for (let rule of rules) |
616 { | 629 { |
617 if (rule.type != rule.STYLE_RULE) | 630 if (rule.type != rule.STYLE_RULE) |
618 continue; | 631 continue; |
619 | 632 |
620 cssStyles.push(stringifyStyle(rule)); | 633 cssStyles.push(stringifyStyle(rule)); |
621 } | 634 } |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
808 characterData: shouldObserveCharacterData(this.patterns), | 821 characterData: shouldObserveCharacterData(this.patterns), |
809 subtree: true | 822 subtree: true |
810 } | 823 } |
811 ); | 824 ); |
812 this.document.addEventListener("load", this.onLoad.bind(this), true); | 825 this.document.addEventListener("load", this.onLoad.bind(this), true); |
813 } | 826 } |
814 } | 827 } |
815 }; | 828 }; |
816 | 829 |
817 exports.ElemHideEmulation = ElemHideEmulation; | 830 exports.ElemHideEmulation = ElemHideEmulation; |
OLD | NEW |