Index: lib/matcher.js |
=================================================================== |
--- a/lib/matcher.js |
+++ b/lib/matcher.js |
@@ -18,17 +18,17 @@ |
"use strict"; |
/** |
* @fileOverview Matcher class implementing matching addresses against |
* a list of filters. |
*/ |
const {RegExpFilter, WhitelistFilter} = require("./filterClasses"); |
-const {suffixes} = require("./domain"); |
+const {normalizeHostname, suffixes} = require("./domain"); |
/** |
* Regular expression for matching a keyword in a filter. |
* @type {RegExp} |
*/ |
const keywordRegExp = /[^a-z0-9%*][a-z0-9%]{3,}(?=[^a-z0-9%*])/; |
/** |
@@ -422,27 +422,20 @@ |
sitekey, specificOnly, collection) |
{ |
let filtersByDomain = this._filterDomainMapsByKeyword.get(keyword); |
if (filtersByDomain) |
{ |
// The code in this block is similar to the generateStyleSheetForDomain |
// function in lib/elemHide.js. |
- if (docDomain) |
- { |
- if (docDomain[docDomain.length - 1] == ".") |
- docDomain = docDomain.replace(/\.+$/, ""); |
- |
- docDomain = docDomain.toLowerCase(); |
- } |
- |
let excluded = new Set(); |
- for (let suffix of suffixes(docDomain || "", !specificOnly)) |
+ for (let suffix of suffixes(docDomain ? normalizeHostname(docDomain) : "", |
+ !specificOnly)) |
{ |
let filters = filtersByDomain.get(suffix); |
if (filters) |
{ |
for (let [filter, include] of filters.entries()) |
{ |
if (!include) |
{ |