scripting.messageDisplay API

Permissions

sensitiveDataUpload

Transfer sensitive user data (if access has been granted) to a remote server for further processing

Note

The permission messagesRead is required to use messenger.scripting.messageDisplay.*.

Functions

getRegisteredScripts([filter])

Returns all registered message display scripts for this extension that match the given filter.

Parameters

[filter]

An object to filter the extension’s registered message display scripts.

Return type (Promise)

Required permissions

  • messagesRead

registerScripts(scripts)

Registers one or more message display scripts for this extension, which should be injected into displayed messages. Note: Registered scripts will only be applied to newly opened messages. To apply the script to already open messages, manually inject your script by calling executeScript(injection) for each of the open messageDisplay tabs.

Parameters

scripts

Contains a list of message display 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

  • messagesRead

unregisterScripts([filter])

Unregisters one or more message display scripts for this extension.

Parameters

[filter]

If specified, only unregisters message display scripts which match the filter. Otherwise, all of the extension’s message display scripts are unregistered.

Required permissions

  • messagesRead

Types

MessageDisplayScriptDetails

object

id

(string)

The id of the message display script, specified in the API call.

[css]

(array of ExtensionURL, optional)

The list of CSS files to be injected. These are injected in the order they appear in this array.

[js]

(array of ExtensionURL, optional)

The list of JavaScript files to be injected. These are injected in the order they appear in this array.

[runAt]

(RunAt, optional)

Specifies when JavaScript files are injected. The preferred and default value is document_idle.

MessageDisplayScriptFilter

object

[ids]

(array of string, optional)

The IDs of specific message display 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