LEFT | RIGHT |
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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 return patterns.some(pattern => pattern.maybeDependsOnAttributes); | 598 return patterns.some(pattern => pattern.maybeDependsOnAttributes); |
599 } | 599 } |
600 | 600 |
601 function shouldObserveCharacterData(patterns) | 601 function shouldObserveCharacterData(patterns) |
602 { | 602 { |
603 return patterns.some(pattern => pattern.dependsOnCharacterData); | 603 return patterns.some(pattern => pattern.dependsOnCharacterData); |
604 } | 604 } |
605 | 605 |
606 class ElemHideEmulation | 606 class ElemHideEmulation |
607 { | 607 { |
608 constructor(addSelectorsFunc, hideElemsFunc) | 608 constructor(hideElemsFunc) |
609 { | 609 { |
610 // Note: The first parameter to this constructor was previously used for | |
611 // injecting style sheets into the document for :-abp-properties() but this | |
612 // code has since moved on to use inline styles for all types of emulation | |
613 // filters (#6610). Nevertheless, there is a plan to go back to using style | |
614 // sheets on platforms that support the tabs.removeCSS API (#6504); hence | |
615 // this first parameter remains for now. | |
616 | |
617 this._filteringInProgress = false; | 610 this._filteringInProgress = false; |
618 this._lastInvocation = -MIN_INVOCATION_INTERVAL; | 611 this._lastInvocation = -MIN_INVOCATION_INTERVAL; |
619 this._scheduledProcessing = null; | 612 this._scheduledProcessing = null; |
620 | 613 |
621 this.document = document; | 614 this.document = document; |
622 this.hideElemsFunc = hideElemsFunc; | 615 this.hideElemsFunc = hideElemsFunc; |
623 this.observer = new MutationObserver(this.observe.bind(this)); | 616 this.observer = new MutationObserver(this.observe.bind(this)); |
624 } | 617 } |
625 | 618 |
626 isSameOrigin(stylesheet) | 619 isSameOrigin(stylesheet) |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 characterData: shouldObserveCharacterData(this.patterns), | 965 characterData: shouldObserveCharacterData(this.patterns), |
973 subtree: true | 966 subtree: true |
974 } | 967 } |
975 ); | 968 ); |
976 this.document.addEventListener("load", this.onLoad.bind(this), true); | 969 this.document.addEventListener("load", this.onLoad.bind(this), true); |
977 } | 970 } |
978 } | 971 } |
979 } | 972 } |
980 | 973 |
981 exports.ElemHideEmulation = ElemHideEmulation; | 974 exports.ElemHideEmulation = ElemHideEmulation; |
LEFT | RIGHT |