:right-sidebar: True WebExtensionMatchPattern =================================================================== .. currentmodule:: gi.repository.WebKit .. versionadded:: 2.48 .. class:: WebExtensionMatchPattern(*args, **kwargs) :no-contents-entry: Represents a way to specify a group of URLs for use in WebExtensions. All match patterns are specified as strings. Apart from the special ```` pattern, match patterns consist of three parts: scheme, host, and path. Generally, match patterns are returned from a ``WebKitWebExtension``. Constructors ------------ .. rst-class:: interim-class .. class:: WebExtensionMatchPattern :no-index: .. classmethod:: new_all_hosts_and_schemes() -> ~gi.repository.WebKit.WebExtensionMatchPattern Returns a new :obj:`~gi.repository.WebKit.WebExtensionMatchPattern` that has ``*`` for scheme, host, and path. .. versionadded:: 2.48 .. classmethod:: new_all_urls() -> ~gi.repository.WebKit.WebExtensionMatchPattern Returns a new :obj:`~gi.repository.WebKit.WebExtensionMatchPattern` for ````\. .. versionadded:: 2.48 .. classmethod:: new_with_scheme(scheme: str, host: str, path: str) -> ~gi.repository.WebKit.WebExtensionMatchPattern | None Returns a new :obj:`~gi.repository.WebKit.WebExtensionMatchPattern` for the specified ``scheme``\, ``host``\, and ``path`` strings. .. versionadded:: 2.48 :param scheme: A pattern URL scheme :param host: A pattern URL host :param path: A pattern URL path .. classmethod:: new_with_string(string: str) -> ~gi.repository.WebKit.WebExtensionMatchPattern | None Returns a new :obj:`~gi.repository.WebKit.WebExtensionMatchPattern` for the specified ``string``\. .. versionadded:: 2.48 :param string: A pattern string Methods ------- .. rst-class:: interim-class .. class:: WebExtensionMatchPattern :no-index: .. method:: get_host() -> str Gets the host part of the pattern string, unless ``webkit_web_extension_match_pattern_get_matches_all_urls`` is :const:`True`. .. versionadded:: 2.48 .. method:: get_matches_all_hosts() -> bool Gets whether the match pattern matches all host. This happens when the pattern is ````\, or if ``*`` is set as the host string. .. versionadded:: 2.48 .. method:: get_matches_all_urls() -> bool Gets whether the match pattern matches all URLs, in other words, whether the pattern is ````\. .. versionadded:: 2.48 .. method:: get_path() -> str Gets the path part of the pattern string, unless :obj:`~gi.repository.WebExtensionMatchPattern.get_matches_all_urls` is :const:`True`. .. versionadded:: 2.48 .. method:: get_scheme() -> str Gets the scheme part of the pattern string, unless ``webkit_web_extension_match_pattern_get_matches_all_urls`` is :const:`True`. .. versionadded:: 2.48 .. method:: get_string() -> str Gets the original pattern string. .. versionadded:: 2.48 .. method:: matches_pattern(pattern: ~gi.repository.WebKit.WebExtensionMatchPattern, options: ~gi.repository.WebKit.WebExtensionMatchPatternOptions) -> bool Matches the ``matchPattern`` against the specified ``pattern`` with options. .. versionadded:: 2.48 :param pattern: The :obj:`~gi.repository.WebKit.WebExtensionMatchPattern` to match with ``matchPattern``\. :param options: The :obj:`~gi.repository.WebKit.WebExtensionMatchPatternOptions` use while matching. .. method:: matches_url(url: str, options: ~gi.repository.WebKit.WebExtensionMatchPatternOptions) -> bool Matches the ``matchPattern`` against the specified URL with options. .. versionadded:: 2.48 :param url: The URL to match against the pattern. :param options: The :obj:`~gi.repository.WebKit.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 ````\. .. versionadded:: 2.48