Left: | ||
Right: |
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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 "use strict"; | 18 "use strict"; |
19 | 19 |
20 const {textToRegExp, filterToRegExp, splitSelector} = require("../common"); | 20 const {textToRegExp, filterToRegExp, splitSelector} = require("../common"); |
21 | 21 |
22 let MIN_INVOCATION_INTERVAL = 3000; | 22 let MIN_INVOCATION_INTERVAL = 3000; |
23 const MAX_SYNCHRONOUS_PROCESSING_TIME = 50; | 23 const MAX_SYNCHRONOUS_PROCESSING_TIME = 50; |
24 const abpSelectorRegexp = /:-abp-([\w-]+)\(/i; | 24 const abpSelectorRegexp = /:-abp-([\w-]+)\(/i; |
25 | 25 |
26 function getCachedPropertyValue(object, name, defaultValueFunc = () => {}) | 26 function getCachedPropertyValue(object, name, defaultValueFunc = () => {}) |
27 { | 27 { |
28 let value = object[name]; | 28 let value = object[name]; |
29 if (value === undefined) | 29 if (typeof value == "undefined") |
hub
2018/03/14 13:04:03
there is the argument of value === undefined vs ty
Manish Jethani
2018/03/14 14:54:53
Oh yeah, for the sake of consistency though I've m
| |
30 Object.defineProperty(object, name, {value: value = defaultValueFunc()}); | 30 Object.defineProperty(object, name, {value: value = defaultValueFunc()}); |
31 return value; | 31 return value; |
32 } | 32 } |
33 | 33 |
34 /** Return position of node from parent. | 34 /** Return position of node from parent. |
35 * @param {Node} node the node to find the position of. | 35 * @param {Node} node the node to find the position of. |
36 * @return {number} One-based index like for :nth-child(), or 0 on error. | 36 * @return {number} One-based index like for :nth-child(), or 0 on error. |
37 */ | 37 */ |
38 function positionInParent(node) | 38 function positionInParent(node) |
39 { | 39 { |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
627 let generator = null; | 627 let generator = null; |
628 | 628 |
629 let processPatterns = () => | 629 let processPatterns = () => |
630 { | 630 { |
631 let cycleStart = performance.now(); | 631 let cycleStart = performance.now(); |
632 | 632 |
633 if (!pattern) | 633 if (!pattern) |
634 { | 634 { |
635 if (!patterns.length) | 635 if (!patterns.length) |
636 { | 636 { |
637 if (selectors.length > 0) | 637 if (selectors.length > 0) |
Manish Jethani
2018/03/08 21:08:15
We need to do this because of an existing bug, whi
Manish Jethani
2018/03/08 21:28:34
Sorry, I just checked, there is no bug. In any cas
| |
638 this.addSelectorsFunc(selectors, selectorFilters); | 638 this.addSelectorsFunc(selectors, selectorFilters); |
639 if (elements.length > 0) | 639 if (elements.length > 0) |
640 this.hideElemsFunc(elements, elementFilters); | 640 this.hideElemsFunc(elements, elementFilters); |
641 if (typeof done == "function") | 641 if (typeof done == "function") |
642 done(); | 642 done(); |
643 return; | 643 return; |
644 } | 644 } |
645 | 645 |
646 pattern = patterns.shift(); | 646 pattern = patterns.shift(); |
647 | 647 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
809 characterData: shouldObserveCharacterData(this.patterns), | 809 characterData: shouldObserveCharacterData(this.patterns), |
810 subtree: true | 810 subtree: true |
811 } | 811 } |
812 ); | 812 ); |
813 this.document.addEventListener("load", this.onLoad.bind(this), true); | 813 this.document.addEventListener("load", this.onLoad.bind(this), true); |
814 } | 814 } |
815 } | 815 } |
816 }; | 816 }; |
817 | 817 |
818 exports.ElemHideEmulation = ElemHideEmulation; | 818 exports.ElemHideEmulation = ElemHideEmulation; |
LEFT | RIGHT |