WebKit.WebExtensionMatchPattern

Fields

None

Methods

class

new_all_hosts_and_schemes ()

class

new_all_urls ()

class

new_with_scheme (scheme, host, path)

class

new_with_string (string)

class

register_custom_URL_scheme (urlScheme)

get_host ()

get_matches_all_hosts ()

get_matches_all_urls ()

get_path ()

get_scheme ()

get_string ()

matches_pattern (pattern, options)

matches_url (url, options)

ref ()

unref ()

Details

class WebKit.WebExtensionMatchPattern

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.

New in version 2.48.

classmethod new_all_hosts_and_schemes()
Returns:

a newly created WebKit.WebExtensionMatchPattern

Return type:

WebKit.WebExtensionMatchPattern

Returns a new WebKit.WebExtensionMatchPattern that has * for scheme, host, and path.

New in version 2.48.

classmethod new_all_urls()
Returns:

a newly created WebKit.WebExtensionMatchPattern

Return type:

WebKit.WebExtensionMatchPattern

Returns a new WebKit.WebExtensionMatchPattern for <all_urls>.

New in version 2.48.

classmethod new_with_scheme(scheme, host, path)
Parameters:
  • scheme (str) – A pattern URL scheme

  • host (str) – A pattern URL host

  • path (str) – A pattern URL path

Raises:

GLib.Error

Returns:

a newly created WebKit.WebExtensionMatchPattern, or None if any of the pattern strings are invalid.

Return type:

WebKit.WebExtensionMatchPattern or None

Returns a new WebKit.WebExtensionMatchPattern for the specified scheme, host, and path strings.

New in version 2.48.

classmethod new_with_string(string)
Parameters:

string (str) – A pattern string

Raises:

GLib.Error

Returns:

a newly created WebKit.WebExtensionMatchPattern, or None if the pattern string is invalid.

Return type:

WebKit.WebExtensionMatchPattern or None

Returns a new WebKit.WebExtensionMatchPattern for the specified string.

New in version 2.48.

classmethod register_custom_URL_scheme(urlScheme)
Parameters:

urlScheme (str) – The custom URL scheme to register

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>.

New in version 2.48.

get_host()
Returns:

The host string.

Return type:

str

Gets the host part of the pattern string, unless webkit_web_extension_match_pattern_get_matches_all_urls is True.

New in version 2.48.

get_matches_all_hosts()
Returns:

Whether this match pattern matches all hosts.

Return type:

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.

New in version 2.48.

get_matches_all_urls()
Returns:

Whether this match pattern matches all URLs.

Return type:

bool

Gets whether the match pattern matches all URLs, in other words, whether the pattern is <all_urls>.

New in version 2.48.

get_path()
Returns:

The path string.

Return type:

str

Gets the path part of the pattern string, unless [method`WebExtensionMatchPattern`.get_matches_all_urls] is True.

New in version 2.48.

get_scheme()
Returns:

The scheme string.

Return type:

str

Gets the scheme part of the pattern string, unless webkit_web_extension_match_pattern_get_matches_all_urls is True.

New in version 2.48.

get_string()
Returns:

The original pattern string.

Return type:

str

Gets the original pattern string.

New in version 2.48.

matches_pattern(pattern, options)
Parameters:
Returns:

Whether the pattern matches the specified pattern.

Return type:

bool

Matches the self against the specified pattern with options.

New in version 2.48.

matches_url(url, options)
Parameters:
Returns:

Whether the pattern matches the specified URL.

Return type:

bool

Matches the self against the specified URL with options.

New in version 2.48.

ref()
Returns:

The same self with an additional reference.

Return type:

WebKit.WebExtensionMatchPattern

Atomically acquires a reference on the given self.

This function is MT-safe and may be called from any thread.

New in version 2.48.

unref()

Atomically releases a reference on the given self.

If the reference was the last, the resources associated to the self are freed. This function is MT-safe and may be called from any thread.

New in version 2.48.