Fixed Sites.domainImplies() misplaced optimization.

This commit is contained in:
hackademix 2018-08-24 02:58:46 +02:00
parent 21c91ece08
commit caed2cfa1e
1 changed files with 1 additions and 2 deletions

View File

@ -29,12 +29,11 @@ var {Permissions, Policy, Sites} = (() => {
} }
static domainImplies(domainKey, site, protocol ="https?") { static domainImplies(domainKey, site, protocol ="https?") {
if (!site.includes(domainKey)) return false;
if (Sites.isSecureDomainKey(domainKey)) { if (Sites.isSecureDomainKey(domainKey)) {
protocol = "https"; protocol = "https";
domainKey = Sites.toggleSecureDomainKey(domainKey, false); domainKey = Sites.toggleSecureDomainKey(domainKey, false);
} }
if (!site.includes(domainKey)) return false;
try { try {
return new RegExp(`^${protocol}://([^/?#:]+\\.)?${rxQuote(domainKey)}(?:[:/]|$)`) return new RegExp(`^${protocol}://([^/?#:]+\\.)?${rxQuote(domainKey)}(?:[:/]|$)`)
.test(site); .test(site);