mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-20 01:12:38 +01:00
AMO review: keep dev console clean
This commit is contained in:
parent
db09f83e2f
commit
6095a1db0f
@ -372,21 +372,17 @@ FilterParser.prototype.parse = function(raw) {
|
|||||||
|
|
||||||
switch ( matches[1] ) {
|
switch ( matches[1] ) {
|
||||||
case 'contains':
|
case 'contains':
|
||||||
this.suffix = 'script?';
|
|
||||||
// Plain string- or regex-based?
|
// Plain string- or regex-based?
|
||||||
if ( token.startsWith('/') === false || token.endsWith('/') === false ) {
|
if ( token.startsWith('/') === false || token.endsWith('/') === false ) {
|
||||||
this.suffix += token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
token = token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||||
} else {
|
} else {
|
||||||
this.suffix += token.slice(1, -1);
|
token = token.slice(1, -1);
|
||||||
if ( isBadRegex(this.suffix) ) {
|
if ( isBadRegex(token) ) {
|
||||||
console.error(
|
µb.logger.writeOne('', 'error', 'Cosmetic filtering – bad regular expression: ' + raw + ' (' + isBadRegex.message + ')');
|
||||||
"uBlock Origin> discarding bad regular expression-based cosmetic filter '%s': '%s'",
|
|
||||||
raw,
|
|
||||||
isBadRegex.message
|
|
||||||
);
|
|
||||||
this.invalid = true;
|
this.invalid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.suffix = 'script?' + token;
|
||||||
break;
|
break;
|
||||||
case 'inject':
|
case 'inject':
|
||||||
this.suffix = 'script+' + token;
|
this.suffix = 'script+' + token;
|
||||||
@ -706,7 +702,7 @@ FilterContainer.prototype.isValidSelector = (function() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.error('uBlock> invalid cosmetic filter:', s);
|
µb.logger.writeOne('', 'error', 'Cosmetic filtering – invalid filter: ' + s);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user