Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cliqz-url-parser for URL processing. #410

Merged
merged 4 commits into from Jul 17, 2019
Merged
Changes from 1 commit
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Fix matcher tests.

  • Loading branch information
sammacbeth committed Jul 8, 2019
commit a64f333dfc6392edc6978f650c793bf2c0ae12b0
@@ -34,13 +34,15 @@ export function isBug(src, tab_url) {
const processedSrc = processUrl(src.toLowerCase());
let found = false;

const path = processedSrc.pathname ? processedSrc.pathname.substring(1) : '';

found =
// pattern classification 2: check host+path hash
_matchesHost(db.patterns.host_path, processedSrc.hostname, processedSrc.pathname) ||
_matchesHost(db.patterns.host_path, processedSrc.hostname, path) ||
// class 1: check host hash
_matchesHost(db.patterns.host, processedSrc.host) ||
_matchesHost(db.patterns.host, processedSrc.hostname) ||
// class 3: check path hash
_matchesPath(processedSrc.path) ||
_matchesPath(path) ||
// class 4: check regex patterns
_matchesRegex(processedSrc.host + processedSrc.pathname);

@@ -71,7 +73,7 @@ export function fuzzyUrlMatcher(url, urls) {
const parsed = processUrl(url.toLowerCase());
let tab_host = parsed.hostname;

const tab_path = parsed.pathname;
const tab_path = parsed.pathname ? parsed.pathname.substring(1) : '';

if (tab_host.startsWith('www.')) {
tab_host = tab_host.slice(4);
ProTip! Use n and p to navigate between commits in a pull request.