File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ pub enum CosmeticFilterError {
40
40
HtmlFilteringUnsupported ,
41
41
#[ error( "scriptlet args could not be parsed" ) ]
42
42
InvalidScriptletArgs ,
43
+ #[ error( "location modifiers are unsupported" ) ]
44
+ LocationModifiersUnsupported ,
43
45
}
44
46
45
47
/// Refer to <https://github.com/uBlockOrigin/uBlock-issues/wiki/Static-filter-syntax#action-operators>
@@ -179,6 +181,10 @@ impl CosmeticFilter {
179
181
let mut hostnames_vec = vec ! [ ] ;
180
182
let mut not_hostnames_vec = vec ! [ ] ;
181
183
184
+ if line. starts_with ( '[' ) {
185
+ return Err ( CosmeticFilterError :: LocationModifiersUnsupported ) ;
186
+ }
187
+
182
188
for ( location_type, location) in Self :: locations_before_sharp ( line, sharp_index) {
183
189
let mut hostname = String :: new ( ) ;
184
190
if location. is_ascii ( ) {
Original file line number Diff line number Diff line change @@ -617,6 +617,16 @@ mod tests {
617
617
let result = parse_filter ( input, true , Default :: default ( ) ) ;
618
618
assert ! ( result. is_ok( ) ) ;
619
619
}
620
+ {
621
+ let input = "[$app=org.example.app]example.com##.textad" ;
622
+ let result = parse_filter ( input, true , Default :: default ( ) ) ;
623
+ assert ! ( result. is_err( ) ) ;
624
+ }
625
+ {
626
+ let input = r#"[$domain=/^i\[a-z\]*\.strmrdr\[a-z\]+\..*/]##+js(set-constant, adscfg.enabled, false)"# ;
627
+ let result = parse_filter ( input, true , Default :: default ( ) ) ;
628
+ assert ! ( result. is_err( ) ) ;
629
+ }
620
630
}
621
631
622
632
#[ test]
You can’t perform that action at this time.
0 commit comments