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 |
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 /** | 20 /** |
21 * @fileOverview Definition of Filter class and its subclasses. | 21 * @fileOverview Definition of Filter class and its subclasses. |
22 */ | 22 */ |
23 | 23 |
24 const {extend} = require("./coreUtils"); | 24 const {extend} = require("./coreUtils"); |
25 const {filterToRegExp} = require("./common"); | 25 const {filterToRegExp} = require("./common"); |
26 const {normalizeHostname, suffixes} = require("./domain"); | 26 const {normalizeHostname, domainSuffixes} = require("./url"); |
27 const {filterNotifier} = require("./filterNotifier"); | 27 const {filterNotifier} = require("./filterNotifier"); |
28 | 28 |
29 const resources = require("../data/resources.json"); | 29 const resources = require("../data/resources.json"); |
30 | 30 |
31 /** | 31 /** |
32 * Map of internal resources for URL rewriting. | 32 * Map of internal resources for URL rewriting. |
33 * @type {Map.<string,string>} | 33 * @type {Map.<string,string>} |
34 */ | 34 */ |
35 let resourceMap = new Map( | 35 let resourceMap = new Map( |
36 Object.keys(resources).map(key => [key, resources[key]]) | 36 Object.keys(resources).map(key => [key, resources[key]]) |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 | 599 |
600 // If no domains are set the rule matches everywhere | 600 // If no domains are set the rule matches everywhere |
601 if (!domains) | 601 if (!domains) |
602 return true; | 602 return true; |
603 | 603 |
604 // If the document has no host name, match only if the filter | 604 // If the document has no host name, match only if the filter |
605 // isn't restricted to specific domains | 605 // isn't restricted to specific domains |
606 if (!docDomain) | 606 if (!docDomain) |
607 return domains.get(""); | 607 return domains.get(""); |
608 | 608 |
609 for (docDomain of suffixes(normalizeHostname(docDomain))) | 609 for (docDomain of domainSuffixes(normalizeHostname(docDomain))) |
610 { | 610 { |
611 let isDomainIncluded = domains.get(docDomain); | 611 let isDomainIncluded = domains.get(docDomain); |
612 if (typeof isDomainIncluded != "undefined") | 612 if (typeof isDomainIncluded != "undefined") |
613 return isDomainIncluded; | 613 return isDomainIncluded; |
614 } | 614 } |
615 | 615 |
616 return domains.get(""); | 616 return domains.get(""); |
617 }, | 617 }, |
618 | 618 |
619 /** | 619 /** |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 | 1438 |
1439 /** | 1439 /** |
1440 * Script that should be executed | 1440 * Script that should be executed |
1441 * @type {string} | 1441 * @type {string} |
1442 */ | 1442 */ |
1443 get script() | 1443 get script() |
1444 { | 1444 { |
1445 return this.body; | 1445 return this.body; |
1446 } | 1446 } |
1447 }); | 1447 }); |
OLD | NEW |