WebExtensionMatchPattern#
Added in version 2.48.
- class WebExtensionMatchPattern(*args, **kwargs)#
Represents a way to specify a group of URLs for use in WebExtensions.
All match patterns are specified as strings. Apart from the special <all_urls>
pattern, match patterns
consist of three parts: scheme, host, and path.
Generally, match patterns are returned from a WebKitWebExtension
.
Constructors#
- class WebExtensionMatchPattern
- classmethod new_all_hosts_and_schemes() WebExtensionMatchPattern #
Returns a new
WebExtensionMatchPattern
that has*
for scheme, host, and path.Added in version 2.48.
- classmethod new_all_urls() WebExtensionMatchPattern #
Returns a new
WebExtensionMatchPattern
for<all_urls>
.Added in version 2.48.
- classmethod new_with_scheme(scheme: str, host: str, path: str) WebExtensionMatchPattern | None #
Returns a new
WebExtensionMatchPattern
for the specifiedscheme
,host
, andpath
strings.Added in version 2.48.
- Parameters:
scheme – A pattern URL scheme
host – A pattern URL host
path – A pattern URL path
- classmethod new_with_string(string: str) WebExtensionMatchPattern | None #
Returns a new
WebExtensionMatchPattern
for the specifiedstring
.Added in version 2.48.
- Parameters:
string – A pattern string
Methods#
- class WebExtensionMatchPattern
- get_host() str #
Gets the host part of the pattern string, unless
webkit_web_extension_match_pattern_get_matches_all_urls
isTrue
.Added in version 2.48.
- get_matches_all_hosts() bool #
Gets whether the match pattern matches all host. This happens when the pattern is
<all_urls>
, or if*
is set as the host string.Added in version 2.48.
- get_matches_all_urls() bool #
Gets whether the match pattern matches all URLs, in other words, whether the pattern is
<all_urls>
.Added in version 2.48.
- get_path() str #
Gets the path part of the pattern string, unless
get_matches_all_urls
isTrue
.Added in version 2.48.
- get_scheme() str #
Gets the scheme part of the pattern string, unless
webkit_web_extension_match_pattern_get_matches_all_urls
isTrue
.Added in version 2.48.
- matches_pattern(pattern: WebExtensionMatchPattern, options: WebExtensionMatchPatternOptions) bool #
Matches the
matchPattern
against the specifiedpattern
with options.Added in version 2.48.
- Parameters:
pattern – The
WebExtensionMatchPattern
to match withmatchPattern
.options – The
WebExtensionMatchPatternOptions
use while matching.
- matches_url(url: str, options: WebExtensionMatchPatternOptions) bool #
Matches the
matchPattern
against the specified URL with options.Added in version 2.48.
- Parameters:
url – The URL to match against the pattern.
options – The
WebExtensionMatchPatternOptions
use while matching.
- classmethod register_custom_URL_scheme() None #
Registers a custom URL scheme that can be used in match patterns.
This method should be used to register any custom URL schemes used by the app for the extension base URLs, other than
webkit-extension
, or if extensions should have access to other supported URL schemes when using<all_urls>
.Added in version 2.48.