eric6.WebBrowser.AdBlock.AdBlockRule
Module implementing the AdBlock rule class.
Global Attributes
Classes
Functions
AdBlockRule
    Class implementing the AdBlock rule.
Derived from
object
Class Attributes
Class Methods
Methods
| AdBlockRule | Constructor | 
| __convertPatternToRegExp | Private method to convert a wildcard pattern to a regular expression. | 
| __parseDomains | Private method to parse a string with a domain list. | 
| __parseFilter | Private method to parse the filter pattern. | 
| __stringMatch | Private method to match a domain string. | 
| cssSelector | Public method to get the CSS selector of the rule. | 
| filter | Public method to get the rule filter string. | 
| isCSSRule | Public method to check, if the rule is a CSS rule. | 
| isComment | Public method to check, if this is a comment. | 
| isDocument | Public method to check, if this is a document rule. | 
| isDomainRestricted | Public method to check, if this rule is restricted by domain. | 
| isElementHiding | Public method to check, if this is an element hiding rule. | 
| isEnabled | Public method to check, if the rule is enabled. | 
| isException | Public method to check, if the rule defines an exception. | 
| isHeader | Public method to check, if this is a header. | 
| isInternalDisabled | Public method to check, if this rule was disabled internally. | 
| isSlow | Public method to check, if this is a slow rule. | 
| matchDomain | Public method to match a domain. | 
| matchImage | Public slot to match an Image rule. | 
| matchObject | Public slot to match an object rule. | 
| matchObjectSubrequest | Public slot to match an Object Subrequest rule. | 
| matchScript | Public slot to match a Script rule. | 
| matchStyleSheet | Public slot to match a StyleSheet rule. | 
| matchSubdocument | Public slot to match a sub-document rule. | 
| matchThirdParty | Public slot to match a third-party rule. | 
| matchXmlHttpRequest | Public slot to match a XmlHttpRequest rule. | 
| networkMatch | Public method to check the rule for a match. | 
| setEnabled | Public method to set the rule's enabled state. | 
| setException | Public method to set the rule's exception flag. | 
| setFilter | Public method to set the rule filter string. | 
| subscription | Public method to get the subscription this rule belongs to. | 
| urlMatch | Public method to check an URL against the rule. | 
Static Methods
AdBlockRule (Constructor)
AdBlockRule(filterRule="", subscription=None)
        Constructor
- filterRule
- 
filter string of the rule (string)
- subscription
- 
reference to the subscription object
            (AdBlockSubscription)
AdBlockRule.__convertPatternToRegExp
__convertPatternToRegExp(wildcardPattern)
        Private method to convert a wildcard pattern to a regular expression.
- wildcardPattern
- 
string containing the wildcard pattern (string)
- Returns:
- 
string containing a regular expression (string)
AdBlockRule.__parseDomains
__parseDomains(domains, separator)
        Private method to parse a string with a domain list.
- domains
- 
list of domains (string)
- separator
- 
separator character used by the list (string)
AdBlockRule.__parseFilter
__parseFilter()
        Private method to parse the filter pattern.
AdBlockRule.__stringMatch
__stringMatch(domain, encodedUrl)
        Private method to match a domain string.
- domain (str)
- 
domain to match
- encodedUrl (str)
- 
URL in encoded form
- Returns:
- 
flag indicating a match
- Return Type:
- 
bool
AdBlockRule.cssSelector
cssSelector()
        Public method to get the CSS selector of the rule.
- Returns:
- 
CSS selector (string)
AdBlockRule.filter
filter()
        Public method to get the rule filter string.
- Returns:
- 
rule filter string (string)
AdBlockRule.isCSSRule
isCSSRule()
        Public method to check, if the rule is a CSS rule.
- Returns:
- 
flag indicating a CSS rule (boolean)
AdBlockRule.isComment
isComment()
        Public method to check, if this is a comment.
- Returns:
- 
flag indicating a comment (boolean)
AdBlockRule.isDocument
isDocument()
        Public method to check, if this is a document rule.
- Returns:
- 
flag indicating a document rule (boolean)
AdBlockRule.isDomainRestricted
isDomainRestricted()
        Public method to check, if this rule is restricted by domain.
- Returns:
- 
flag indicating a domain restriction (boolean)
AdBlockRule.isElementHiding
isElementHiding()
        Public method to check, if this is an element hiding rule.
- Returns:
- 
flag indicating an element hiding rule (boolean)
AdBlockRule.isEnabled
isEnabled()
        Public method to check, if the rule is enabled.
- Returns:
- 
flag indicating enabled state (boolean)
AdBlockRule.isException
isException()
        Public method to check, if the rule defines an exception.
- Returns:
- 
flag indicating an exception (boolean)
AdBlockRule.isHeader
isHeader()
        Public method to check, if this is a header.
- Returns:
- 
flag indicating a header (boolean)
AdBlockRule.isInternalDisabled
isInternalDisabled()
        Public method to check, if this rule was disabled internally.
- Returns:
- 
flag indicating an internally disabled rule (boolean)
AdBlockRule.isSlow
isSlow()
        Public method to check, if this is a slow rule.
- Returns:
- 
flag indicating a slow rule (boolean)
AdBlockRule.matchDomain
matchDomain(domain)
        Public method to match a domain.
- domain
- 
domain name to check (string)
- Returns:
- 
flag indicating a match (boolean)
AdBlockRule.matchImage
matchImage(req)
        Public slot to match an Image rule.
- req
- 
request object to check (QWebEngineUrlRequestInfo)
- Returns:
- 
flag indicating a match (boolean)
AdBlockRule.matchObject
matchObject(req)
        Public slot to match an object rule.
- req
- 
request object to check (QWebEngineUrlRequestInfo)
- Returns:
- 
flag indicating a match (boolean)
AdBlockRule.matchObjectSubrequest
matchObjectSubrequest(req)
        Public slot to match an Object Subrequest rule.
- req
- 
request object to check (QWebEngineUrlRequestInfo)
- Returns:
- 
flag indicating a match (boolean)
AdBlockRule.matchScript
matchScript(req)
        Public slot to match a Script rule.
- req
- 
request object to check (QWebEngineUrlRequestInfo)
- Returns:
- 
flag indicating a match (boolean)
AdBlockRule.matchStyleSheet
matchStyleSheet(req)
        Public slot to match a StyleSheet rule.
- req
- 
request object to check (QWebEngineUrlRequestInfo)
- Returns:
- 
flag indicating a match (boolean)
AdBlockRule.matchSubdocument
matchSubdocument(req)
        Public slot to match a sub-document rule.
- req
- 
request object to check (QWebEngineUrlRequestInfo)
- Returns:
- 
flag indicating a match (boolean)
AdBlockRule.matchThirdParty
matchThirdParty(req)
        Public slot to match a third-party rule.
- req
- 
request object to check (QWebEngineUrlRequestInfo)
- Returns:
- 
flag indicating a match (boolean)
AdBlockRule.matchXmlHttpRequest
matchXmlHttpRequest(req)
        Public slot to match a XmlHttpRequest rule.
- req
- 
request object to check (QWebEngineUrlRequestInfo)
- Returns:
- 
flag indicating a match (boolean)
AdBlockRule.networkMatch
networkMatch(request, domain, encodedUrl)
        Public method to check the rule for a match.
- request (QWebEngineUrlRequestInfo)
- 
reference to the network request
- domain (str)
- 
domain name
- encodedUrl (str)
- 
string encoded URL to be checked
- Returns:
- 
flag indicating a match
- Return Type:
- 
bool
AdBlockRule.setEnabled
setEnabled(enabled)
        Public method to set the rule's enabled state.
- enabled
- 
flag indicating the new enabled state (boolean)
AdBlockRule.setException
setException(exception)
        Public method to set the rule's exception flag.
- exception
- 
flag indicating an exception rule (boolean)
AdBlockRule.setFilter
setFilter(filterRule)
        Public method to set the rule filter string.
- filterRule
- 
rule filter string (string)
AdBlockRule.subscription
subscription()
        Public method to get the subscription this rule belongs to.
- Returns:
- 
subscription of the rule (AdBlockSubscription)
AdBlockRule.urlMatch
urlMatch(url)
        Public method to check an URL against the rule.
- url
- 
URL to check (QUrl)
- Returns:
- 
flag indicating a match (boolean)
toSecondLevelDomain
toSecondLevelDomain(url)
    Module function to get a second level domain from the given URL.
- url
- 
URL to extract domain from (QUrl)
- Returns:
- 
name of second level domain (string)