mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-18 17:02:27 +02:00
Exception script tag filter makes no sense: reject such filters
This commit is contained in:
parent
a56dfe1858
commit
6b9848cf0d
@ -267,6 +267,7 @@ FilterParser.prototype.parse = function(s) {
|
|||||||
// Remember original string
|
// Remember original string
|
||||||
this.prefix = matches[1];
|
this.prefix = matches[1];
|
||||||
this.suffix = matches[3];
|
this.suffix = matches[3];
|
||||||
|
this.unhide = matches[2].charAt(1) === '@' ? 1 : 0;
|
||||||
|
|
||||||
// 2014-05-23:
|
// 2014-05-23:
|
||||||
// https://github.com/gorhill/httpswitchboard/issues/260
|
// https://github.com/gorhill/httpswitchboard/issues/260
|
||||||
@ -288,8 +289,9 @@ FilterParser.prototype.parse = function(s) {
|
|||||||
// overhead in the content script.
|
// overhead in the content script.
|
||||||
// Example: focus.de##script:contains(/uabInject/)
|
// Example: focus.de##script:contains(/uabInject/)
|
||||||
if ( this.suffix.charAt(0) === 's' && this.reScriptContains.test(this.suffix) ) {
|
if ( this.suffix.charAt(0) === 's' && this.reScriptContains.test(this.suffix) ) {
|
||||||
// Currently supported only as non-generic selector.
|
// Currently supported only as non-generic selector. Also, exception
|
||||||
if ( this.prefix.length === 0 ) {
|
// script tag filter makes no sense, ignore.
|
||||||
|
if ( this.prefix.length === 0 || this.unhide === 1 ) {
|
||||||
this.invalid = true;
|
this.invalid = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -302,7 +304,6 @@ FilterParser.prototype.parse = function(s) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.unhide = matches[2].charAt(1) === '@' ? 1 : 0;
|
|
||||||
if ( this.prefix !== '' ) {
|
if ( this.prefix !== '' ) {
|
||||||
this.hostnames = this.prefix.split(/\s*,\s*/);
|
this.hostnames = this.prefix.split(/\s*,\s*/);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user