Skip to content

Commit e9299eb

Browse files
authored
Fix no hostname case (#562)
1 parent 2e8522e commit e9299eb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/filters/network_matchers.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,9 @@ pub fn check_included_domains_mapped(
446446
}) {
447447
return false;
448448
}
449+
} else {
450+
// If there are domain restrictions but no source hostname, we can't apply the rule
451+
return false;
449452
}
450453
}
451454
true
@@ -485,6 +488,10 @@ pub fn check_excluded_domains_mapped(
485488
}) {
486489
return false;
487490
}
491+
} else {
492+
// If there are domain restrictions but no source hostname
493+
// (i.e. about:blank), apply the rule anyway.
494+
return true;
488495
}
489496
}
490497

tests/matching.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,5 +199,5 @@ fn check_rule_matching_browserlike() {
199199
let (blocked, passes) = bench_rule_matching_browserlike(&engine, &requests);
200200
let msg = "The number of blocked/passed requests has changed. ".to_string()
201201
+ "If this is expected, update the expected values in the test.";
202-
assert_eq!((blocked, passes), (101701, 141244), "{msg}");
202+
assert_eq!((blocked, passes), (106860, 136085), "{msg}");
203203
}

0 commit comments

Comments
 (0)