Merge pull request #9953 from alexstrat/fix-content-scripts-url-used-in-match
Fix page's URL used to test against content_scripts[].matches
This commit is contained in:
commit
03c8943997
1 changed files with 2 additions and 2 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue