Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/elemHide.js

Issue 30002580: Noissue - Abstract hostname normalization (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Add tests Created Feb. 8, 2019, 7:26 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/domain.js ('k') | lib/filterClasses.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/elemHide.js
===================================================================
--- a/lib/elemHide.js
+++ b/lib/elemHide.js
@@ -18,17 +18,17 @@
"use strict";
/**
* @fileOverview Element hiding implementation.
*/
const {ElemHideExceptions} = require("./elemHideExceptions");
const {filterNotifier} = require("./filterNotifier");
-const {suffixes} = require("./domain");
+const {normalizeHostname, suffixes} = require("./domain");
/**
* The maximum number of selectors in a CSS rule. This is used by
* <code>{@link createStyleSheet}</code> to split up a long list of selectors
* into multiple rules.
* @const {number}
* @default
*/
@@ -393,20 +393,17 @@
* list of selectors.
*/
generateStyleSheetForDomain(domain, specificOnly = false,
includeSelectors = false)
{
let code = null;
let selectors = null;
- if (domain[domain.length - 1] == ".")
- domain = domain.replace(/\.+$/, "");
-
- domain = domain.toLowerCase();
+ domain = normalizeHostname(domain);
if (specificOnly)
{
selectors = getConditionalSelectors(domain, true);
code = createStyleSheet(selectors);
}
else
{
« no previous file with comments | « lib/domain.js ('k') | lib/filterClasses.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld