ad-block
Advanced tools
Comparing version 4.1.2 to 4.1.3
{ | ||
"name": "ad-block", | ||
"main": "./build/Release/ad-block", | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"description": "Ad block engine used in the Brave browser for ABP filter syntax based lists like EasyList.", | ||
@@ -6,0 +6,0 @@ "directories": { |
@@ -157,3 +157,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
it('exception rule returned', function () { | ||
const queryResult = this.client.findMatchingFilters('https://www.scrumpoker.online/js/angular-google-analytics.js', FilterOptions.script, 'www.brianbondy.com') | ||
const queryResult = this.client.findMatchingFilters('https://www.scrumpoker.online/js/angular-google-analytics.js', FilterOptions.script, 'www.scrumpoker.online') | ||
assert.equal(queryResult.matchingExceptionOrigRule, '@@||www.scrumpoker.online^$~third-party') | ||
@@ -305,2 +305,156 @@ }) | ||
}) | ||
describe('domain filtered rules', function () { | ||
describe('All exclude domain rules', function() { | ||
before(function () { | ||
this.client = new AdBlockClient() | ||
this.client.parse('wp-content/$domain=~aaaaa.com|~bbbbb.com|~ccccc.com') | ||
}) | ||
it('filter has all anti domains but with different input domain should block', function () { | ||
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'www.brianbondy.com')) | ||
}) | ||
it('filter has all anti domains and with a same input domain should not block', function () { | ||
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'aaaaa.com')) | ||
}) | ||
}) | ||
describe('All include domain rules', function() { | ||
before(function () { | ||
this.client = new AdBlockClient() | ||
this.client.parse('wp-content/$domain=aaaaa.com|bbbbb.com|ccccc.com') | ||
}) | ||
it('filter has all anti=false domains but with different input domain should not block', function () { | ||
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'www.brianbondy.com')) | ||
}) | ||
it('filter has all anti=false domains and with a same domain should not block', function () { | ||
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'aaaaa.com')) | ||
}) | ||
}) | ||
describe('Rule with blocking parent domain and subdomain which is allowed', function() { | ||
before(function () { | ||
this.client = new AdBlockClient() | ||
this.client.parse('wp-content/$domain=example.com|~foo.example.com|x.com|y.com|z.com') | ||
}) | ||
it('for test URL of unrelated domain should not match', function () { | ||
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'brianbondy.com')) | ||
}) | ||
it('for test URL of parent should block', function () { | ||
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'example.com')) | ||
}) | ||
it('for test URL of subdomain should allow', function () { | ||
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'foo.example.com')) | ||
}) | ||
it('for test URL of deeper subdomain should allow', function () { | ||
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'boo.foo.example.com')) | ||
}) | ||
it('for test URL of subdomain of top level rule should block', function () { | ||
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'boo.example.com')) | ||
}) | ||
}) | ||
describe('Rule with anti-block parent domain and subdomain which is blocked', function() { | ||
before(function () { | ||
this.client = new AdBlockClient() | ||
this.client.parse('wp-content/$domain=~example.com|foo.example.com|x.com|z.com|y.com') | ||
}) | ||
it('for test URL of unrelated domain should not match', function () { | ||
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'brianbondy.com')) | ||
}) | ||
it('for test URL of parent should not block', function () { | ||
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'example.com')) | ||
}) | ||
it('for test URL of subdomain should block', function () { | ||
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'foo.example.com')) | ||
}) | ||
it('for test URL of deeper subdomain should block', function () { | ||
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'boo.foo.example.com')) | ||
}) | ||
it('for test URL of subdomain of top level rule should allow', function () { | ||
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'boo.example.com')) | ||
}) | ||
}) | ||
describe('Three level deep rules', function() { | ||
before(function () { | ||
this.client = new AdBlockClient() | ||
this.client.parse('wp-content/$domain=example.com|~brave.example.com|foo.brave.example.com') | ||
}) | ||
it('for test URL of unrelated domain should not match', function () { | ||
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'brianbondy.com')) | ||
}) | ||
it('for test URL of parent should block', function () { | ||
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'example.com')) | ||
}) | ||
it('for test URL of exception subdomain should allow', function () { | ||
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'brave.example.com')) | ||
}) | ||
it('for test URL of deeper subdomain should block', function () { | ||
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'foo.brave.example.com')) | ||
}) | ||
}) | ||
describe('Three level deep rules reversed', function() { | ||
before(function () { | ||
this.client = new AdBlockClient() | ||
this.client.parse('wp-content/$domain=~example.com|brave.example.com|~foo.brave.example.com') | ||
}) | ||
it('for test URL of unrelated domain should not match since there is a blocking domain', function () { | ||
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'brianbondy.com')) | ||
}) | ||
it('for test URL of parent should allow', function () { | ||
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'example.com')) | ||
}) | ||
it('for test URL of exception subdomain should block', function () { | ||
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'brave.example.com')) | ||
}) | ||
it('for test URL of deeper subdomain should allow', function () { | ||
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins', | ||
FilterOptions.image, 'foo.brave.example.com')) | ||
}) | ||
}) | ||
describe('first-party host', function() { | ||
before(function () { | ||
this.client = new AdBlockClient() | ||
this.client.parse('analytics.brave.com^\n@@https://analytics.*/piwik.$~third-party') | ||
}) | ||
it('for same host finds exception', function () { | ||
assert(!this.client.matches('https://analytics.brave.com/piwik.js', | ||
FilterOptions.image, 'analytics.brave.com')) | ||
}) | ||
it('for same diff host does not find exception', function () { | ||
assert(this.client.matches('https://analytics.brave.com/piwik.js', | ||
FilterOptions.image, 'batcommunity.org')) | ||
}) | ||
it('findMatchingFilters for same host finds exception', function () { | ||
const queryResult = this.client.findMatchingFilters('https://analytics.brave.com/piwik.js', FilterOptions.script, 'analytics.brave.com') | ||
assert.equal(queryResult.matches, false) | ||
assert.equal(queryResult.matchingFilter, 'analytics.brave.com^') | ||
assert.equal(queryResult.matchingExceptionFilter, 'https://analytics.*/piwik.') | ||
}) | ||
it('findMatchingFilters for same diff host does not find exception', function () { | ||
const queryResult = this.client.findMatchingFilters('https://analytics.brave.com/piwik.js', FilterOptions.script, 'batcommunity.org') | ||
assert.equal(queryResult.matches, true) | ||
assert.equal(queryResult.matchingFilter, 'analytics.brave.com^') | ||
}) | ||
}) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Copyleft License
License(Experimental) Copyleft license information was found
Found 1 instance in 1 package
spdx disjunction for an artifact's license information
Licensespdx disjunction for an artifact's license information
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license
Found 3 instances in 1 package
Copyleft License
License(Experimental) Copyleft license information was found
Found 1 instance in 1 package
spdx disjunction for an artifact's license information
Licensespdx disjunction for an artifact's license information
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found
Found 1 instance in 1 package
17437854
928
3321
7