scripting.compose API
Permissions
Transfer sensitive user data (if access has been granted) to a remote server for further processing
Functions
getRegisteredScripts([filter])
Returns all registered compose scripts for this extension that match the given filter.
Parameters
An object to filter the extension’s registered compose scripts.
Return type (Promise)
array of ComposeScriptDetails
Required permissions
registerScripts(scripts)
Registers one or more compose scripts for this extension, which should be injected into the message compose editor. Note: Registered scripts will only be applied to newly opened message compose tabs. To apply the script to already open message compose tabs, manually inject your script by calling executeScript(injection) for each of the open messageCompose tabs.
Parameters
Contains a list of compose scripts to be registered. If there are errors during script parsing/file validation, or if the IDs specified already exist, then no scripts are registered.
Required permissions
unregisterScripts([filter])
Unregisters one or more compose scripts for this extension.
Parameters
If specified, only unregisters compose scripts which match the filter. Otherwise, all of the extension’s compose scripts are unregistered.
Required permissions
Types
ComposeScriptDetails
object
id
(string)
The id of the compose script, specified in the API call.
The list of CSS files to be injected. These are injected in the order they appear in this array.
The list of JavaScript files to be injected. These are injected in the order they appear in this array.
Specifies when JavaScript files are injected. The preferred and default value is document_idle.
ComposeScriptFilter
object
[ids
]
(array of string, optional)
The IDs of specific compose scripts to retrieve with getRegisteredScripts() or to unregister with unregisterScripts().
External Types
The following types are not defined by this API, but by the underlying Mozilla WebExtension code base. They are included here, because there is no other public documentation available.
ExtensionURL
A path relative to the root of the extension.
string