sessions API

The sessions API allows to add tab related session data to Thunderbird’s tabs, which will be restored on app restart.

Thunderbird’s sessions API is similar to the Firefox sessions API, but it doesn’t support accessing or restoring closed tabs.

Note

The Sessions API currently does not require the sessions permission, but it will soon. It’s recommended to request this permission before it becomes mandatory, to ensure your add-on continues to function properly.

Functions

getTabValue(tabId, key)

– [Added in TB 115]

Retrieve a previously stored value for a given tab, given its key. Returns undefined if the requested key does not exist for the given tabId.

Parameters

tabId

tabId

(integer)

ID of the tab whose data you are trying to retrieve. Error is thrown if ID is invalid.

key

key

(string)

Key identifying the particular value to retrieve.

Return type (Promise)

_returns

string

removeTabValue(tabId, key)

– [Added in TB 115]

Remove a key/value pair from a given tab.

Parameters

tabId

tabId

(integer)

ID of the tab whose data you are trying to remove. Error is thrown if ID is invalid.

key

key

(string)

Key identifying the particular value to remove.

setTabValue(tabId, key, value)

– [Added in TB 115]

Store a key/value pair associated with a given tab.

Parameters

tabId

tabId

(integer)

ID of the tab with which you want to associate the data. Error is thrown if ID is invalid.

key

key

(string)

Key that you can later use to retrieve this particular data value.

value

value

(string)