mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 17:17:57 +01:00
code review: be sure all invalid cosmetic filters are reported in logger
This commit is contained in:
parent
c6dbdbd23b
commit
38a5f5751b
1 changed files with 9 additions and 10 deletions
|
@ -754,14 +754,15 @@ FilterContainer.prototype.compileSelector = (function() {
|
||||||
var matches;
|
var matches;
|
||||||
|
|
||||||
// `:style` selector?
|
// `:style` selector?
|
||||||
if ( (matches = reStyleSelector.exec(raw)) !== null ) {
|
if (
|
||||||
if ( isValidCSSSelector(matches[1]) && isValidStyleProperty(matches[2]) ) {
|
(matches = reStyleSelector.exec(raw)) !== null &&
|
||||||
return JSON.stringify({
|
isValidCSSSelector(matches[1]) &&
|
||||||
raw: raw,
|
isValidStyleProperty(matches[2])
|
||||||
style: [ matches[1], '{' + matches[2] + '}' ]
|
) {
|
||||||
});
|
return JSON.stringify({
|
||||||
}
|
raw: raw,
|
||||||
return;
|
style: [ matches[1], '{' + matches[2] + '}' ]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// `script:` filter?
|
// `script:` filter?
|
||||||
|
@ -774,7 +775,6 @@ FilterContainer.prototype.compileSelector = (function() {
|
||||||
if ( reIsRegexLiteral.test(matches[2]) === false || isBadRegex(matches[2].slice(1, -1)) === false ) {
|
if ( reIsRegexLiteral.test(matches[2]) === false || isBadRegex(matches[2].slice(1, -1)) === false ) {
|
||||||
return raw;
|
return raw;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Procedural selector?
|
// Procedural selector?
|
||||||
|
@ -784,7 +784,6 @@ FilterContainer.prototype.compileSelector = (function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
µb.logger.writeOne('', 'error', 'Cosmetic filtering – invalid filter: ' + raw);
|
µb.logger.writeOne('', 'error', 'Cosmetic filtering – invalid filter: ' + raw);
|
||||||
return;
|
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue