Class: Matcher

Matcher()

Blacklist/whitelist filter matching

Constructor

new Matcher()

Source:

Members

(private) _compiledPatternsByKeyword :Map.<string, ?CompiledPatterns>

Lookup table of compiled patterns for simple filters by their associated keyword
Type:
Source:

(private) _complexFiltersByKeyword :Map.<string, (RegExpFilter|Set.<RegExpFilter>)>

Lookup table for complex filters by their associated keyword
Type:
Source:

(private) _filterDomainMapsByKeyword :Map.<string, Map.<string, (RegExpFilter|Map.<RegExpFilter, boolean>)>>

Lookup table of domain maps for complex filters by their associated keyword
Type:
Source:

(private) _filterMapsByType :Map.<string, Map.<string, (RegExpFilter|Set.<RegExpFilter>)>>

Lookup table of type-specific lookup tables for complex filters by their associated keyword
Type:
Source:

(private) _keywordByFilter :Map.<RegExpFilter, string>

Lookup table for keywords by their associated filter
Type:
Source:

(private) _simpleFiltersByKeyword :Map.<string, (RegExpFilter|Set.<RegExpFilter>)>

Lookup table for simple filters by their associated keyword
Type:
Source:

Methods

add(filter)

Adds a filter to the matcher
Parameters:
Name Type Description
filter RegExpFilter
Source:

(protected) checkEntryMatch(keyword, request, typeMask, sitekeyopt, nullable, specificOnlyopt, collectionopt, nullable) → (nullable) {Filter}

Checks whether the entries for a particular keyword match a URL
Parameters:
Name Type Attributes Description
keyword string
request URLRequest
typeMask number
sitekey string <optional>
<nullable>
specificOnly boolean <optional>
collection Array.<Filter> <optional>
<nullable>
An optional list of filters to which to append any results. If specified, the function adds all matching filters to the list; if omitted, the function directly returns the first matching filter.
Source:
Returns:
Type
Filter

clear()

Removes all known filters
Source:

(protected) findKeyword(filter) → {string}

Chooses a keyword to be associated with the filter
Parameters:
Name Type Description
filter Filter
Source:
Returns:
keyword or an empty string if no keyword could be found
Type
string

matchesAny(url, typeMask, docDomainopt, nullable, sitekeyopt, nullable, specificOnlyopt) → (nullable) {RegExpFilter}

Tests whether the URL matches any of the known filters
Parameters:
Name Type Attributes Description
url URL | URLInfo URL to be tested
typeMask number bitmask of content / request types to match
docDomain string <optional>
<nullable>
domain name of the document that loads the URL
sitekey string <optional>
<nullable>
public key provided by the document
specificOnly boolean <optional>
should be true if generic matches should be ignored
Source:
Returns:
matching filter or null
Type
RegExpFilter

remove(filter)

Removes a filter from the matcher
Parameters:
Name Type Description
filter RegExpFilter
Source: