diff --git a/src/filters/network_matchers.rs b/src/filters/network_matchers.rs index 476cc0df..62fe7cf6 100644 --- a/src/filters/network_matchers.rs +++ b/src/filters/network_matchers.rs @@ -446,6 +446,9 @@ pub fn check_included_domains_mapped( }) { return false; } + } else { + // If there are domain restrictions but no source hostname, we can't apply the rule + return false; } } true @@ -485,6 +488,10 @@ pub fn check_excluded_domains_mapped( }) { return false; } + } else { + // If there are domain restrictions but no source hostname + // (i.e. about:blank), apply the rule anyway. + return true; } } diff --git a/tests/matching.rs b/tests/matching.rs index a1a478d7..d4f26934 100644 --- a/tests/matching.rs +++ b/tests/matching.rs @@ -199,5 +199,5 @@ fn check_rule_matching_browserlike() { let (blocked, passes) = bench_rule_matching_browserlike(&engine, &requests); let msg = "The number of blocked/passed requests has changed. ".to_string() + "If this is expected, update the expected values in the test."; - assert_eq!((blocked, passes), (101701, 141244), "{msg}"); + assert_eq!((blocked, passes), (106860, 136085), "{msg}"); }