android-components / mozilla.components.concept.engine.webextension / WebExtensionRuntime / installWebExtension

installWebExtension

open fun installWebExtension(id: String, url: String, allowContentMessaging: Boolean = true, supportActions: Boolean = false, onSuccess: (WebExtension) -> Unit = { }, onError: (String, Throwable) -> Unit = { _, _ -> }): Unit (source)

Installs the provided extension in this engine.

Parameters

id - the unique ID of the extension.

url - the url pointing to either a resources path for locating the extension within the APK file (e.g. resource://android/assets/extensions/my_web_ext) or to a local (e.g. resource://android/assets/extensions/my_web_ext.xpi) or remote (e.g. https://addons.mozilla.org/firefox/downloads/file/123/some_web_ext.xpi) XPI file.

allowContentMessaging - whether or not the web extension is allowed to send messages from content scripts, defaults to true.

supportActions - whether or not browser and page actions are handled when received from the web extension, defaults to false.

onSuccess - (optional) callback invoked if the extension was installed successfully, providing access to the WebExtension object for bi-directional messaging.

onError - (optional) callback invoked if there was an error installing the extension. This callback is invoked with an UnsupportedOperationException in case the engine doesn’t have web extension support.