diff options
Diffstat (limited to 'ext/bg')
-rw-r--r-- | ext/bg/js/profile-conditions.js | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/ext/bg/js/profile-conditions.js b/ext/bg/js/profile-conditions.js index 97e09f1c..f3a85cb1 100644 --- a/ext/bg/js/profile-conditions.js +++ b/ext/bg/js/profile-conditions.js @@ -19,29 +19,29 @@ * Environment */ -function _profileConditionTestDomain(urlDomain, domain) { - return ( - urlDomain.endsWith(domain) && - ( - domain.length === urlDomain.length || - urlDomain[urlDomain.length - domain.length - 1] === '.' - ) - ); -} +let profileConditionsDescriptor = null; -function _profileConditionTestDomainList(url, domainList) { - const urlDomain = new URL(url).hostname.toLowerCase(); - for (const domain of domainList) { - if (_profileConditionTestDomain(urlDomain, domain)) { - return true; - } +const profileConditionsDescriptorPromise = (async () => { + function profileConditionTestDomain(urlDomain, domain) { + return ( + urlDomain.endsWith(domain) && + ( + domain.length === urlDomain.length || + urlDomain[urlDomain.length - domain.length - 1] === '.' + ) + ); } - return false; -} -let profileConditionsDescriptor = null; + function profileConditionTestDomainList(url, domainList) { + const urlDomain = new URL(url).hostname.toLowerCase(); + for (const domain of domainList) { + if (profileConditionTestDomain(urlDomain, domain)) { + return true; + } + } + return false; + } -const profileConditionsDescriptorPromise = (async () => { const environment = new Environment(); await environment.prepare(); @@ -111,7 +111,7 @@ const profileConditionsDescriptorPromise = (async () => { transform: (optionValue) => optionValue.split(/[,;\s]+/).map((v) => v.trim().toLowerCase()).filter((v) => v.length > 0), transformReverse: (transformedOptionValue) => transformedOptionValue.join(', '), validateTransformed: (transformedOptionValue) => (transformedOptionValue.length > 0), - test: ({url}, transformedOptionValue) => _profileConditionTestDomainList(url, transformedOptionValue) + test: ({url}, transformedOptionValue) => profileConditionTestDomainList(url, transformedOptionValue) }, matchRegExp: { name: 'Matches RegExp', |