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

Side by Side Diff: lib/elemHide.js

Issue 29800595: Issue 6735 - Store domains in lower case (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Disallow missing values in domain, sitekey, and rewrite Created June 8, 2018, 2:16 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | lib/filterClasses.js » ('j') | lib/filterClasses.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 * on a particular host name. 227 * on a particular host name.
228 * @param {string} domain 228 * @param {string} domain
229 * @param {boolean} [specificOnly] true if generic filters should not apply. 229 * @param {boolean} [specificOnly] true if generic filters should not apply.
230 * @returns {string[]} List of selectors. 230 * @returns {string[]} List of selectors.
231 */ 231 */
232 getSelectorsForDomain(domain, specificOnly = false) 232 getSelectorsForDomain(domain, specificOnly = false)
233 { 233 {
234 let selectors = []; 234 let selectors = [];
235 235
236 let excluded = new Set(); 236 let excluded = new Set();
237 let currentDomain = domain ? domain.replace(/\.+$/, "").toUpperCase() : ""; 237 let currentDomain = domain ? domain.replace(/\.+$/, "").toLowerCase() : "";
238 238
239 // This code is a performance hot-spot, which is why we've made certain 239 // This code is a performance hot-spot, which is why we've made certain
240 // micro-optimisations. Please be careful before making changes. 240 // micro-optimisations. Please be careful before making changes.
241 while (true) 241 while (true)
242 { 242 {
243 if (specificOnly && currentDomain == "") 243 if (specificOnly && currentDomain == "")
244 break; 244 break;
245 245
246 let filters = filtersByDomain.get(currentDomain); 246 let filters = filtersByDomain.get(currentDomain);
247 if (filters) 247 if (filters)
(...skipping 18 matching lines...) Expand all
266 let nextDot = currentDomain.indexOf("."); 266 let nextDot = currentDomain.indexOf(".");
267 currentDomain = nextDot == -1 ? "" : currentDomain.substr(nextDot + 1); 267 currentDomain = nextDot == -1 ? "" : currentDomain.substr(nextDot + 1);
268 } 268 }
269 269
270 if (!specificOnly) 270 if (!specificOnly)
271 selectors = getUnconditionalSelectors().concat(selectors); 271 selectors = getUnconditionalSelectors().concat(selectors);
272 272
273 return selectors; 273 return selectors;
274 } 274 }
275 }; 275 };
OLDNEW
« no previous file with comments | « no previous file | lib/filterClasses.js » ('j') | lib/filterClasses.js » ('J')

Powered by Google App Engine
This is Rietveld