1.42 <WebKitWebExtension>

Class: <WebKitWebExtension>

It derives from <GObject>.

Represents a WebExtension.

A <WebKitWebExtension> object encapsulates a web extension’s resources that are defined by a ‘manifest.json‘ file.

This class handles the reading and parsing of the manifest file along with the supporting resources like icons and localizations.

Properties

Property: web-extension:default-locale self

The default locale for the <WebKitWebExtension>. See web-extension:get-default-locale for more details.

Its value is a string, or #f.

It is read only.

Property: web-extension:display-action-label self

The localized extension action label of the <WebKitWebExtension>. See web-extension:get-display-action-label for more details.

Its value is a string, or #f.

It is read only.

Property: web-extension:display-description self

The localized description of the <WebKitWebExtension>. See web-extension:get-display-description for more details.

Its value is a string, or #f.

It is read only.

Property: web-extension:display-name self

The localized name of the <WebKitWebExtension>. See web-extension:get-display-name for more details.

Its value is a string, or #f.

It is read only.

Property: web-extension:display-short-name self

The localized short name of the <WebKitWebExtension>. See web-extension:get-display-short-name for more details.

Its value is a string, or #f.

It is read only.

Property: web-extension:display-version self

The localized display version of the <WebKitWebExtension>. See web-extension:get-display-version for more details.

Its value is a string, or #f.

It is read only.

Property: web-extension:has-background-content self

Whether the <WebKitWebExtension> has background content that can run when needed. See web-extension:get-has-background-content? for more details.

Its value is a boolean.

It is read only.

Property: web-extension:has-commands self

Whether the <WebKitWebExtension> includes commands that users can invoke. See web-extension:get-has-commands? for more details.

Its value is a boolean.

It is read only.

Property: web-extension:has-content-modification-rules self

Whether the <WebKitWebExtension> includes rules used for content modification or blocking. See webkit_web_extension_get_content_modification_rules() for more details.

Its value is a boolean.

It is read only.

Property: web-extension:has-injected-content self

Whether the <WebKitWebExtension> has script or stylesheet content that can be injected into webpages. See web-extension:get-has-injected-content? for more details.

Its value is a boolean.

It is read only.

Property: web-extension:has-options-page self

Whether the <WebKitWebExtension> has an options page. See web-extension:get-has-options-page? for more details.

Its value is a boolean.

It is read only.

Property: web-extension:has-override-new-tab-page self

Whether the <WebKitWebExtension> provides an alternative to the default new tab page. See web-extension:get-has-override-new-tab-page? for more details.

Its value is a boolean.

It is read only.

Property: web-extension:has-persistent-background-content self

Whether the <WebKitWebExtension> has background content that stays in memory as long as the extension is loaded. See web-extension:get-has-persistent-background-content? for more details.

Its value is a boolean.

It is read only.

Property: web-extension:manifest-version self

The parsed manifest version of the <WebKitWebExtension>. See web-extension:get-manifest-version for more details.

Its value is a string, or #f.

It is read only.

Property: web-extension:optional-permissions self

The set of permissions that the <WebKitWebExtension> may need for optional functionality. See web-extension:get-optional-permissions for more details.

Its value is a vector, each a string, or #f.

It is read only.

Property: web-extension:path self

A string pointing to the folder containing the extension manifest and resources. See web-extension:get-path for more details.

Its value is a string, or #f.

It can only be set when the object is made, with #:path.

Property: web-extension:requested-permissions self

The set of permissions that the <WebKitWebExtension> requires for its base functionality. See web-extension:get-requested-permissions for more details.

Its value is a vector, each a string, or #f.

It is read only.

Property: web-extension:version self

The version of the <WebKitWebExtension>. See web-extension:get-version for more details.

Its value is a string, or #f.

It is read only.

Procedures

Method: web-extension:get-action-icon self width height ⇒ %return
Method: get-action-icon self width height ⇒ %return

Returns the extension’s default action icon image for the specified size. This icon serves as a default and should be used to represent the extension in contexts like action sheets or toolbars prior to the extension being loaded into an extension context. Once the extension is loaded, use the “actionForTab:“ API to get the tab-specific icon. The returned image will be the best match for the specified size that is available in the extension’s action icon set. If no matching icon is available, the method will fall back to the extension’s icon.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

width

Passed: a real number.

The width to use when looking up the icon.

height

Passed: a real number.

The height to use when looking up the icon.

%return

Returned: a <GIcon>, or #f.

the icon image, or #f if no icon could be loaded.

Method: web-extension:get-all-requested-match-patterns self ⇒ %return
Method: get-all-requested-match-patterns self ⇒ %return

Get the set of websites that the extension requires access to for injected content and for receiving messages from websites.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a vector, each a <WebKitWebExtensionMatchPattern>.

a #f-terminated array of match patterns matching all requested websites.

Method: web-extension:get-default-locale self ⇒ %return
Method: get-default-locale self ⇒ %return

Get the default locale for the extension.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a string, or #f.

the default locale, or #f if there was no default locale specified.

Method: web-extension:get-display-action-label self ⇒ %return
Method: get-display-action-label self ⇒ %return

Get the localized display action label for the extension.

This label serves as a default and should be used to represent the extension in contexts like action sheets or toolbars prior to the extension being loaded into an extension context. Once the extension is loaded, use the “actionForTab:“ API to get the tab-specific label.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a string, or #f.

the localized display action label, or #f if there was no display action label specified.

Method: web-extension:get-display-description self ⇒ %return
Method: get-display-description self ⇒ %return

Get the localized display description for the extension.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a string, or #f.

the localized display description, or #f if there was no display description specified.

Method: web-extension:get-display-name self ⇒ %return
Method: get-display-name self ⇒ %return

Get the localized name for the extension.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a string, or #f.

the localized name, or #f if there was no name specified.

Method: web-extension:get-display-short-name self ⇒ %return
Method: get-display-short-name self ⇒ %return

Get the localized short name for the extension.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a string, or #f.

the localized name, or #f if there was no short name specified.

Method: web-extension:get-display-version self ⇒ %return
Method: get-display-version self ⇒ %return

Get the localized display version for the extension.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a string, or #f.

the localized display version, or #f if there was no display version specified.

Method: web-extension:get-has-background-content? self ⇒ %return
Method: get-has-background-content? self ⇒ %return

Get whether the extension has background content that can run when needed.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a boolean.

TRUE if the extension can run in the background even when no webpages are open.

Method: web-extension:get-has-commands? self ⇒ %return
Method: get-has-commands? self ⇒ %return

Get whether the extension includes commands that users can invoke.

These commands should be accessible via keyboard shortcuts, menu items, or other user interface elements provided by the app. The list of commands can be accessed via “commands“ on an extension context, and invoked via “performCommand:“.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a boolean.

TRUE if the extension contains one or more commands that can be performed by the user.

Method: web-extension:get-has-content-modification-rules? self ⇒ %return
Method: get-has-content-modification-rules? self ⇒ %return

Get whether the extension includes rules used for content modification or blocking.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a boolean.

TRUE if the extension contains one or more rules for content modification.

Method: web-extension:get-has-injected-content? self ⇒ %return
Method: get-has-injected-content? self ⇒ %return

Get whether the extension has script or stylesheet content that can be injected into webpages.

Once the extension is loaded, use the “hasInjectedContent“ property on an extension context, as the injectable content can change after the extension is loaded.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a boolean.

TRUE if the extension has content that can be injected by matching against the extension’s requested match patterns.

Method: web-extension:get-has-options-page? self ⇒ %return
Method: get-has-options-page? self ⇒ %return

Get whether the extension has an options page.

The app should provide access to this page through a user interface element, which can be accessed via “optionsPageURL“ on an extension context.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a boolean.

TRUE if the extension includes a dedicated options page where users can customize settings.

Method: web-extension:get-has-override-new-tab-page? self ⇒ %return
Method: get-has-override-new-tab-page? self ⇒ %return

Get whether the extension provides an alternative to the default new tab page.

The app should prompt the user for permission to use the extension’s new tab page as the default, which can be accessed via “overrideNewTabPageURL“ on an extension context.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a boolean.

TRUE if the extension can specify a custom page that can be displayed when a new tab is opened in the app, instead of the default new tab page.

Method: web-extension:get-has-persistent-background-content? self ⇒ %return
Method: get-has-persistent-background-content? self ⇒ %return

Get whether the extension has background content that stays in memory as long as the extension is loaded.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a boolean.

TRUE if the extension can run in the background.

Method: web-extension:get-icon self width height ⇒ %return
Method: get-icon self width height ⇒ %return

Returns the extension’s icon image for the specified size. This icon should represent the extension in settings or other areas that show the extension. The returned image will be the best match for the specified size that is available in the extension’s icon set. If no matching icon can be found, the method will return #f.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

width

Passed: a real number.

The width to use when looking up the icon.

height

Passed: a real number.

The height to use when looking up the icon.

%return

Returned: a <GIcon>, or #f.

the icon image, or #f if no icon could be loaded.

Method: web-extension:get-manifest-version self ⇒ %return
Method: get-manifest-version self ⇒ %return

Get the parsed manifest version, or 0 if there is no version specified in the manifest.

A WebKit.WebExtensionError.UNSUPPORTED_MANIFEST_VERSION error will be reported if the manifest version isn’t specified.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a real number.

the parsed manifest version.

Method: web-extension:get-optional-permission-match-patterns self ⇒ %return
Method: get-optional-permission-match-patterns self ⇒ %return

Get the set of websites that the extension may need access to for optional functionality. These match patterns can be requested by the extension at a later time.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a vector, each a <WebKitWebExtensionMatchPattern>.

a #f-terminated array of match patterns matching the optional websites.

Method: web-extension:get-optional-permissions self ⇒ %return
Method: get-optional-permissions self ⇒ %return

Get the set of permissions that the extension may need for optional functionality. These permissions can be requested by the extension at a later time.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a vector, each a string, or #f.

a #f-terminated array of strings containing permission names, or #f otherwise. This array and its contents are owned by WebKit and should not be modified or freed.

Method: web-extension:get-path self ⇒ %return
Method: get-path self ⇒ %return

Get the path pointing to the folder containing the extension manifest and resources

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a string.

the path of the extension folder

Method: web-extension:get-requested-permission-match-patterns self ⇒ %return
Method: get-requested-permission-match-patterns self ⇒ %return

Get the set of websites that the extension requires access to for its base functionality.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a vector, each a <WebKitWebExtensionMatchPattern>.

a #f-terminated array of match patterns matching the required websites.

Method: web-extension:get-requested-permissions self ⇒ %return
Method: get-requested-permissions self ⇒ %return

Get the set of permissions that the extension requires for its base functionality.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a vector, each a string, or #f.

a #f-terminated array of strings containing permission names, or #f otherwise. This array and its contents are owned by WebKit and should not be modified or freed.

Method: web-extension:get-version self ⇒ %return
Method: get-version self ⇒ %return

Get the version for the extension.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

%return

Returned: a string, or #f.

the version, or #f if there was no version specified.

Procedure: web-extension:new extension-path ⇒ %return

Creates a new WebKitWebExtension from a folder containing the extension contents. The folder must contain a manifest.json file. If the manifest is invalid or missing, an error will be returned.

extension-path

Passed: a string.

A string pointing to the folder containing the extension manifest and resources

%return

Returned: a <WebKitWebExtension>, or #f.

the new <WebKitWebExtension>, or #f if the extension failed to be created

Method: web-extension:supports-manifest-version? self manifest-version ⇒ %return
Method: supports-manifest-version? self manifest-version ⇒ %return

Checks if a manifest version is supported by the extension.

self

Passed: a <WebKitWebExtension>.

a <WebKitWebExtension>

manifest-version

Passed: a real number.

the version number to check

%return

Returned: a boolean.

TRUE if the extension specified a manifest version that is greater than or equal to manifest-version.