1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-02 23:57:10 +02:00

AMO review: keep dev console clean

This commit is contained in:
gorhill 2016-03-27 09:24:57 -04:00
parent db09f83e2f
commit 6095a1db0f

View File

@ -372,21 +372,17 @@ FilterParser.prototype.parse = function(raw) {
switch ( matches[1] ) {
case 'contains':
this.suffix = 'script?';
// Plain string- or regex-based?
if ( token.startsWith('/') === false || token.endsWith('/') === false ) {
this.suffix += token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
token = token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
} else {
this.suffix += token.slice(1, -1);
if ( isBadRegex(this.suffix) ) {
console.error(
"uBlock Origin> discarding bad regular expression-based cosmetic filter '%s': '%s'",
raw,
isBadRegex.message
);
token = token.slice(1, -1);
if ( isBadRegex(token) ) {
µb.logger.writeOne('', 'error', 'Cosmetic filtering bad regular expression: ' + raw + ' (' + isBadRegex.message + ')');
this.invalid = true;
}
}
this.suffix = 'script?' + token;
break;
case 'inject':
this.suffix = 'script+' + token;
@ -706,7 +702,7 @@ FilterContainer.prototype.isValidSelector = (function() {
return true;
}
}
console.error('uBlock> invalid cosmetic filter:', s);
µb.logger.writeOne('', 'error', 'Cosmetic filtering invalid filter: ' + s);
return false;
};
})();