| Index: lib/filterClasses.js |
| =================================================================== |
| --- a/lib/filterClasses.js |
| +++ b/lib/filterClasses.js |
| @@ -16,19 +16,21 @@ |
| */ |
| "use strict"; |
| /** |
| * @fileOverview Definition of Filter class and its subclasses. |
| */ |
| -const {filterNotifier} = require("./filterNotifier"); |
| const {extend} = require("./coreUtils"); |
| const {filterToRegExp} = require("./common"); |
| +const {suffixes} = require("./domain"); |
| +const {filterNotifier} = require("./filterNotifier"); |
| + |
| const resources = require("../data/resources.json"); |
| /** |
| * Map of internal resources for URL rewriting. |
| * @type {Map.<string,string>} |
| */ |
| let resourceMap = new Map( |
| Object.keys(resources).map(key => [key, resources[key]]) |
| @@ -604,27 +606,23 @@ |
| if (!docDomain) |
| return domains.get(""); |
| if (docDomain[docDomain.length - 1] == ".") |
| docDomain = docDomain.replace(/\.+$/, ""); |
| docDomain = docDomain.toLowerCase(); |
| - while (true) |
| + for (docDomain of suffixes(docDomain)) |
| { |
| let isDomainIncluded = domains.get(docDomain); |
| if (typeof isDomainIncluded != "undefined") |
| return isDomainIncluded; |
| + } |
| - let nextDot = docDomain.indexOf("."); |
| - if (nextDot < 0) |
| - break; |
| - docDomain = docDomain.substr(nextDot + 1); |
| - } |
| return domains.get(""); |
| }, |
| /** |
| * Checks whether this filter is active only on a domain and its subdomains. |
| * @param {string} docDomain |
| * @return {boolean} |
| */ |