pub struct Blocker { /* private fields */ }
Expand description
Stores network filters for efficient querying.
Implementations§
source§impl Blocker
impl Blocker
sourcepub fn check(
&self,
request: &Request,
resources: &ResourceStorage,
) -> BlockerResult
pub fn check( &self, request: &Request, resources: &ResourceStorage, ) -> BlockerResult
Decide if a network request (usually from WebRequest API) should be blocked, redirected or allowed.
pub fn check_generic_hide(&self, hostname_request: &Request) -> bool
pub fn check_parameterised( &self, request: &Request, resources: &ResourceStorage, matched_rule: bool, force_check_exceptions: bool, ) -> BlockerResult
sourcepub fn get_csp_directives(&self, request: &Request) -> Option<String>
pub fn get_csp_directives(&self, request: &Request) -> Option<String>
Given a “main_frame” or “subdocument” request, check if some content security policies should be injected in the page.
pub fn new( network_filters: Vec<NetworkFilter>, options: &BlockerOptions, ) -> Blocker
sourcepub fn optimize(&mut self)
pub fn optimize(&mut self)
If optimizations are enabled, the Blocker
will be configured to automatically optimize
its filters after batch updates. However, even if they are disabled, it is possible to
manually call optimize()
. It may be useful to have finer-grained control over
optimization scheduling when frequently updating filters.
sourcepub fn filter_exists(&self, filter: &NetworkFilter) -> bool
pub fn filter_exists(&self, filter: &NetworkFilter) -> bool
Has this exact filter already been added? Note that this is a best-effort method and may miss some filters, especially if optimizations are enabled.
sourcepub fn add_filter(&mut self, filter: NetworkFilter) -> Result<(), BlockerError>
pub fn add_filter(&mut self, filter: NetworkFilter) -> Result<(), BlockerError>
Add a single filter to this Blocker
.
Filter optimization is skipped when using this method.