fix #3430 (regression)

This commit is contained in:
Raymond Hill 2018-01-12 09:33:01 -05:00
parent 0b684bd419
commit 6219866b53
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 13 additions and 3 deletions

View File

@ -398,6 +398,7 @@ var FilterContainer = function() {
'.+?:if-not', '.+?:if-not',
'.+?:matches-css(?:-before|-after)?', '.+?:matches-css(?:-before|-after)?',
'.*?:xpath', '.*?:xpath',
'.+?:style',
'.+?:-abp-contains', // ABP-specific for `:has-text` '.+?:-abp-contains', // ABP-specific for `:has-text`
'.+?:-abp-has', // ABP-specific for `:if` '.+?:-abp-has', // ABP-specific for `:if`
'.+?:contains' // Adguard-specific for `:has-text` '.+?:contains' // Adguard-specific for `:has-text`
@ -623,6 +624,8 @@ FilterContainer.prototype.compileGenericSelector = function(parsed, writer) {
/******************************************************************************/ /******************************************************************************/
FilterContainer.prototype.compileGenericHideSelector = function(parsed, writer) { FilterContainer.prototype.compileGenericHideSelector = function(parsed, writer) {
var selector = parsed.suffix;
// For some selectors, it is mandatory to have a hostname or entity: // For some selectors, it is mandatory to have a hostname or entity:
// ##.foo:-abp-contains(...) // ##.foo:-abp-contains(...)
// ##.foo:-abp-has(...) // ##.foo:-abp-has(...)
@ -635,10 +638,17 @@ FilterContainer.prototype.compileGenericHideSelector = function(parsed, writer)
// ##.foo:matches-css-after(...) // ##.foo:matches-css-after(...)
// ##.foo:matches-css-before(...) // ##.foo:matches-css-before(...)
// ##:xpath(...) // ##:xpath(...)
if ( this.reNeedHostname.test(selector) ) { return; } // ##.foo:style(...)
if ( this.reNeedHostname.test(selector) ) {
µb.logger.writeOne(
'',
'error',
'Cosmetic filtering invalid generic filter: ##' + selector
);
return;
}
var selector = parsed.suffix, var type = selector.charCodeAt(0),
type = selector.charCodeAt(0),
key; key;
if ( type === 0x23 /* '#' */ ) { if ( type === 0x23 /* '#' */ ) {