content_scripts[].matches use the URL without hash part

This commit is contained in:
Alexandre Lachèze 2017-07-07 04:14:36 +02:00
parent 8a62d81fc5
commit 73e8769b1f

View file

@ -5,9 +5,9 @@ const {runInThisContext} = require('vm')
// https://developer.chrome.com/extensions/match_patterns
const matchesPattern = function (pattern) {
if (pattern === '<all_urls>') return true
const regexp = new RegExp('^' + pattern.replace(/\*/g, '.*') + '$')
return location.href.match(regexp)
const url = location.protocol + '//' + location.host + location.pathname
return url.match(regexp)
}
// Run the code with chrome API integrated.