WebExtension API Documentation for Thunderbird 143.0.1

Manifest V2

Introduction

  • Getting started
    • Guides Overview
    • Where to get help and more information

WebExtension API reference

  • accounts API
    • Permissions
    • Functions
      • get(accountId, [includeSubFolders])
      • getDefault([includeSubFolders])
      • getDefaultIdentity(accountId)
      • list([includeSubFolders])
      • setDefaultIdentity(accountId, identityId)
    • Events
      • onCreated
      • onDeleted
      • onUpdated
    • Types
      • ExtensionMailAccountType
      • MailAccount
      • MailAccountId
      • NativeMailAccountType
  • addressBooks API
    • Permissions
    • Functions
      • closeUI()
      • create(properties)
      • delete(id)
      • get(id, [complete])
      • list([complete])
      • openUI()
      • update(id, properties)
    • Events
      • onCreated
      • onDeleted
      • onUpdated
    • Types
      • AddressBookNode
      • NodeType
  • addressBooks.provider API
    • Permissions
    • Events
      • onSearchRequest
  • alarms API
    • Permissions
    • Functions
      • clear([name])
      • clearAll()
      • create([name], alarmInfo)
      • get([name])
      • getAll()
    • Events
      • onAlarm
    • Types
      • Alarm
  • browserAction API
    • Manifest file properties
    • Permissions
    • Functions
      • disable([tabId])
      • enable([tabId])
      • getBadgeBackgroundColor(details)
      • getBadgeText(details)
      • getBadgeTextColor(details)
      • getLabel(details)
      • getPopup(details)
      • getTitle(details)
      • isEnabled(details)
      • openPopup([options])
      • setBadgeBackgroundColor(details)
      • setBadgeText(details)
      • setBadgeTextColor(details)
      • setIcon(details)
      • setLabel(details)
      • setPopup(details)
      • setTitle(details)
    • Events
      • onClicked
    • Types
      • ColorArray
      • ExtensionFileUrl
      • ExtensionURL
      • IconPath
      • ImageDataDictionary
      • ImageDataType
      • OnClickData
      • ThemeIcons
  • browserSettings API
    • Permissions
    • Types
      • ColorManagementMode
      • ContextMenuMouseEvent
      • ImageAnimationBehavior
    • Properties
      • allowPopupsForUserEvents
      • cacheEnabled
      • contextMenuShowEvent
      • ftpProtocolEnabled
      • imageAnimationBehavior
      • overrideContentColorScheme
      • overrideDocumentColors
      • useDocumentFonts
      • verticalTabs
      • webNotificationsDisabled
      • zoomFullPage
  • browserSettings.colorManagement API
    • Permissions
    • Properties
      • mode
      • useNativeSRGB
      • useWebRenderCompositor
  • browsingData API
    • Permissions
    • Functions
      • remove(options, dataToRemove)
      • removeAppcache(options)
      • removeCache(options)
      • removeCookies(options)
      • removeDownloads(options)
      • removeFileSystems(options)
      • removeFormData(options)
      • removeHistory(options)
      • removeIndexedDB(options)
      • removeLocalStorage(options)
      • removePasswords(options)
      • removePluginData(options)
      • removeWebSQL(options)
      • settings()
    • Types
      • DataTypeSet
      • RemovalOptions
  • clipboard API
    • Permissions
    • Functions
      • setImageData(imageData, imageType)
  • cloudFile API
    • Manifest file properties
    • Permissions
    • Functions
      • getAccount(accountId)
      • getAllAccounts()
      • updateAccount(accountId, updateProperties)
    • Events
      • onAccountAdded
      • onAccountDeleted
      • onFileDeleted
      • onFileRename
      • onFileUpload
      • onFileUploadAbort
    • Types
      • CloudFile
      • CloudFileAccount
      • CloudFileTemplateInfo
      • RelatedCloudFile
  • commands API
    • Manifest file properties
    • Permissions
    • Functions
      • getAll()
      • openShortcutSettings()
      • reset(name)
      • update(detail)
    • Events
      • onChanged
      • onCommand
    • Types
      • Command
      • CommandsShortcut
      • KeyName
  • compose API
    • Permissions
    • Functions
      • addAttachment(tabId, attachment)
      • beginForward(messageId, [forwardType], [details])
      • beginNew([messageId], [details])
      • beginReply(messageId, [replyType], [details])
      • getActiveDictionaries(tabId)
      • getAttachmentFile(id)
      • getComposeDetails(tabId)
      • getComposeState(tabId)
      • listAttachments(tabId)
      • removeAttachment(tabId, attachmentId)
      • saveMessage(tabId, [options])
      • sendMessage(tabId, [options])
      • setActiveDictionaries(tabId, activeDictionaries)
      • setComposeDetails(tabId, details)
      • updateAttachment(tabId, attachmentId, attachment)
    • Events
      • onActiveDictionariesChanged
      • onAfterSave
      • onAfterSend
      • onAttachmentAdded
      • onAttachmentRemoved
      • onBeforeSend
      • onComposeStateChanged
      • onIdentityChanged
    • Types
      • ComposeAttachment
      • ComposeDetails
      • ComposeDictionaries
      • ComposeRecipient
      • ComposeRecipientList
      • ComposeState
      • CustomHeader
      • EncryptionPropertiesOpenPGP
      • EncryptionPropertiesSMIME
      • FileAttachment
  • composeAction API
    • Manifest file properties
    • Permissions
    • Functions
      • disable([tabId])
      • enable([tabId])
      • getBadgeBackgroundColor(details)
      • getBadgeText(details)
      • getBadgeTextColor(details)
      • getLabel(details)
      • getPopup(details)
      • getTitle(details)
      • isEnabled(details)
      • openPopup([options])
      • setBadgeBackgroundColor(details)
      • setBadgeText(details)
      • setBadgeTextColor(details)
      • setIcon(details)
      • setLabel(details)
      • setPopup(details)
      • setTitle(details)
    • Events
      • onClicked
    • Types
      • ColorArray
      • ExtensionFileUrl
      • ExtensionURL
      • IconPath
      • ImageDataDictionary
      • ImageDataType
      • OnClickData
      • ThemeIcons
  • composeScripts API
    • Permissions
    • Functions
      • register(composeScriptOptions)
    • Types
      • ExtensionFileOrCode
      • ExtensionURL
      • RegisteredComposeScript
      • RegisteredComposeScriptOptions
  • contacts API
    • Permissions
    • Functions
      • create(parentId, [id], properties)
      • delete(id)
      • get(id)
      • getPhoto(id)
      • list(parentId)
      • quickSearch([parentId], queryInfo)
      • setPhoto(id, file)
      • update(id, properties)
    • Events
      • onCreated
      • onDeleted
      • onUpdated
    • Types
      • ContactNode
      • ContactProperties
      • PropertyChange
      • QueryInfo
  • contentScripts API
    • Functions
      • register(contentScriptOptions)
    • Types
      • ExecutionWorld
      • ExtensionFileOrCode
      • ExtensionURL
      • MatchPattern
      • MatchPatternRestricted
      • MatchPatternUnestricted
      • RegisteredContentScript
      • RegisteredContentScriptOptions
      • RunAt
  • contextualIdentities API
    • Permissions
    • Functions
      • create(details)
      • get(cookieStoreId)
      • move(cookieStoreIds, position)
      • query(details)
      • remove(cookieStoreId)
      • update(cookieStoreId, details)
    • Events
      • onCreated
      • onRemoved
      • onUpdated
    • Types
      • ContextualIdentity
  • cookies API
    • Permissions
    • Functions
      • get(details)
      • getAll(details)
      • getAllCookieStores()
      • remove(details)
      • set(details)
    • Events
      • onChanged
    • Types
      • Cookie
      • CookieStore
      • OnChangedCause
      • PartitionKey
      • SameSiteStatus
  • declarativeNetRequest API
    • Manifest file properties
    • Permissions
    • Functions
      • getAvailableStaticRuleCount()
      • getDisabledRuleIds(options)
      • getDynamicRules([filter])
      • getEnabledRulesets()
      • getSessionRules([filter])
      • isRegexSupported(regexOptions)
      • testMatchOutcome(request, [options])
      • updateDynamicRules(options)
      • updateEnabledRulesets(updateRulesetOptions)
      • updateSessionRules(options)
      • updateStaticRules(options)
    • Types
      • GetRulesFilter
      • MatchedRule
      • ResourceType
      • Rule
      • UnsupportedRegexReason
      • URLTransform
    • Properties
      • DYNAMIC_RULESET_ID
      • GUARANTEED_MINIMUM_STATIC_RULES
      • MAX_NUMBER_OF_DISABLED_STATIC_RULES
      • MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES
      • MAX_NUMBER_OF_DYNAMIC_RULES
      • MAX_NUMBER_OF_ENABLED_STATIC_RULESETS
      • MAX_NUMBER_OF_REGEX_RULES
      • MAX_NUMBER_OF_SESSION_RULES
      • MAX_NUMBER_OF_STATIC_RULESETS
      • SESSION_RULESET_ID
  • dns API
    • Permissions
    • Functions
      • resolve(hostname, [flags])
    • Types
      • DNSRecord
      • ResolveFlags
  • downloads API
    • Permissions
    • Functions
      • cancel(downloadId)
      • download(options)
      • drag(downloadId)
      • erase(query)
      • getFileIcon(downloadId, [options])
      • open(downloadId)
      • pause(downloadId)
      • removeFile(downloadId)
      • resume(downloadId)
      • search(query)
      • show(downloadId)
      • showDefaultFolder()
    • Events
      • onChanged
      • onCreated
      • onErased
    • Types
      • BooleanDelta
      • DangerType
      • DoubleDelta
      • DownloadItem
      • DownloadQuery
      • DownloadTime
      • FilenameConflictAction
      • InterruptReason
      • State
      • StringDelta
  • extension API
    • Functions
      • getBackgroundPage()
      • getURL(path)
      • getViews([fetchProperties])
      • isAllowedFileSchemeAccess()
      • isAllowedIncognitoAccess()
    • Types
      • ViewType
    • Properties
      • inIncognitoContext
      • lastError
  • folders API
    • Permissions
    • Functions
      • copy(source, destination)
      • create(destination, childName)
      • delete(folder)
      • get(folderId, [includeSubFolders])
      • getFolderCapabilities(folder)
      • getFolderInfo(folder)
      • getParentFolders(folder, [includeSubFolders])
      • getSubFolders(folder, [includeSubFolders])
      • getTagFolder(key)
      • getUnifiedFolder(type, [includeSubFolders])
      • markAsRead(folder)
      • move(source, destination)
      • query([queryInfo])
      • rename(folder, newName)
      • update(folder, updateProperties)
    • Events
      • onCopied
      • onCreated
      • onDeleted
      • onFolderInfoChanged
      • onMoved
      • onRenamed
      • onUpdated
    • Types
      • MailFolder
      • MailFolderCapabilities
      • MailFolderId
      • MailFolderInfo
      • MailFolderQuota
      • MailFolderSpecialUse
      • QueryDateRange
      • QueryRange
      • RegularExpression
    • Properties
      • DEFAULT_MOST_RECENT_LIMIT
  • i18n API
    • Manifest file properties
    • Functions
      • detectLanguage(text)
      • getAcceptLanguages()
      • getMessage(messageName, [substitutions])
      • getPreferredSystemLanguages()
      • getUILanguage()
    • Types
      • LanguageCode
  • identities API
    • Permissions
    • Functions
      • create(accountId, details)
      • delete(identityId)
      • get(identityId)
      • getDefault(accountId)
      • list([accountId])
      • setDefault(accountId, identityId)
      • update(identityId, details)
    • Events
      • onCreated
      • onDeleted
      • onUpdated
    • Types
      • EncryptionCapabilities
      • MailIdentity
  • identity API
    • Permissions
    • Functions
      • getAccounts()
      • getAuthToken([details])
      • getProfileUserInfo()
      • getRedirectURL([path])
      • launchWebAuthFlow(details)
      • removeCachedAuthToken(details)
    • Events
      • onSignInChanged
    • Types
      • AccountInfo
      • HttpURL
  • idle API
    • Permissions
    • Functions
      • queryState(detectionIntervalInSeconds)
      • setDetectionInterval(intervalInSeconds)
    • Events
      • onStateChanged
    • Types
      • IdleState
  • mailTabs API
    • Permissions
    • Functions
      • create([createProperties])
      • get(tabId)
      • getCurrent()
      • getListedMessages([tabId])
      • getSelectedFolders([tabId])
      • getSelectedMessages([tabId])
      • query([queryInfo])
      • setQuickFilter([tabId], properties)
      • setSelectedMessages([tabId], messageIds)
      • update([tabId], updateProperties)
    • Events
      • onDisplayedFolderChanged
      • onSelectedMessagesChanged
    • Types
      • FolderMode
      • MailTab
      • MailTabProperties
      • QuickFilterTextDetail
  • mailingLists API
    • Permissions
    • Functions
      • addMember(id, contactId)
      • create(parentId, properties)
      • delete(id)
      • get(id)
      • list(parentId)
      • listMembers(id)
      • removeMember(id, contactId)
      • update(id, properties)
    • Events
      • onCreated
      • onDeleted
      • onMemberAdded
      • onMemberRemoved
      • onUpdated
    • Types
      • MailingListNode
  • management API
    • Permissions
    • Functions
      • get(id)
      • getAll()
      • getSelf()
      • install(options)
      • setEnabled(id, enabled)
      • uninstallSelf([options])
    • Events
      • onDisabled
      • onEnabled
      • onInstalled
      • onUninstalled
    • Types
      • ExtensionDisabledReason
      • ExtensionID
      • ExtensionInfo
      • ExtensionInstallType
      • ExtensionType
      • HttpURL
      • IconInfo
  • menus API
    • Permissions
    • Functions
      • create(createProperties, [callback])
      • getTargetElement(targetElementId)
      • overrideContext(contextOptions)
      • refresh()
      • remove(menuItemId)
      • removeAll()
      • update(id, updateProperties)
    • Events
      • onClicked
      • onHidden
      • onShown
    • Types
      • ContextType
      • ItemType
      • MenuActionCommand
      • MenuIconDictionary
      • MenuIconPath
      • OnClickData
      • OnShowData
    • Properties
      • ACTION_MENU_TOP_LEVEL_LIMIT
  • messageDisplay API
    • Permissions
    • Functions
      • getDisplayedMessage([tabId])
      • getDisplayedMessages([tabId])
      • open(openProperties)
    • Events
      • onMessageDisplayed
      • onMessagesDisplayed
  • messageDisplayAction API
    • Manifest file properties
    • Permissions
    • Functions
      • disable([tabId])
      • enable([tabId])
      • getBadgeBackgroundColor(details)
      • getBadgeText(details)
      • getBadgeTextColor(details)
      • getLabel(details)
      • getPopup(details)
      • getTitle(details)
      • isEnabled(details)
      • openPopup([options])
      • setBadgeBackgroundColor(details)
      • setBadgeText(details)
      • setBadgeTextColor(details)
      • setIcon(details)
      • setLabel(details)
      • setPopup(details)
      • setTitle(details)
    • Events
      • onClicked
    • Types
      • ColorArray
      • ExtensionFileUrl
      • ExtensionURL
      • IconPath
      • ImageDataDictionary
      • ImageDataType
      • OnClickData
      • ThemeIcons
  • messageDisplayScripts API
    • Permissions
    • Functions
      • register(messageDisplayScriptOptions)
    • Types
      • ExtensionFileOrCode
      • ExtensionURL
      • RegisteredMessageDisplayScript
      • RegisteredMessageDisplayScriptOptions
  • messages API
    • Permissions
    • Functions
      • abortList(messageListId)
      • archive(messageIds)
      • continueList(messageListId)
      • copy(messageIds, destination, [options])
      • createTag(key, tag, color)
      • delete(messageIds, [options])
      • deleteAttachments(messageId, partNames)
      • deleteTag(key)
      • get(messageId)
      • getAttachmentFile(messageId, partName)
      • getFull(messageId, [options])
      • getRaw(message, [options])
      • import(file, destination, [properties])
      • list(folder)
      • listAttachments(messageId)
      • listInlineTextParts(messageId)
      • listTags()
      • move(messageIds, destination, [options])
      • openAttachment(messageId, partName, tabId)
      • query([queryInfo])
      • update(messageId, newProperties)
      • updateTag(key, updateProperties)
    • Events
      • onCopied
      • onDeleted
      • onMoved
      • onNewMailReceived
      • onUpdated
    • Types
      • InlineTextPart
      • MailBoxHeaderString
      • MessageAttachment
      • MessageHeader
      • MessageId
      • MessageList
      • MessagePart
      • MessageProperties
      • QueryRange
  • messages.tags API
    • Permissions
    • Functions
      • create([key], tag, color, [callback])
      • delete(key)
      • list()
      • update(key, updateProperties)
    • Events
      • onCreated
      • onDeleted
      • onUpdated
    • Types
      • MessageTag
      • MessageTagProperties
      • TagsDetail
  • messengerSettings API
    • Permissions
    • Properties
      • messageLineLengthLimit
      • messagePlainTextFlowedOutputEnabled
  • messengerUtilities API
    • Functions
      • convertToPlainText(body, [options])
      • decodeMimeHeader(headerName, headerValue, [isMailBoxHeader])
      • encodeMimeHeader(headerName, headerValue, [isMailBoxHeader])
      • formatFileSize(sizeInBytes)
      • parseMailboxString(mailboxString, [preserveGroups])
    • Types
      • MailboxHeaders
      • ParsedMailbox
  • notifications API
    • Permissions
    • Functions
      • clear(notificationId)
      • create([notificationId], options)
      • getAll()
      • getPermissionLevel()
    • Events
      • onClicked
      • onClosed
      • onPermissionLevelChanged
      • onShown
      • onShowSettings
    • Types
      • CreateNotificationOptions
      • NotificationItem
      • PermissionLevel
      • TemplateType
      • UpdateNotificationOptions
  • permissions API
    • Functions
      • contains(permissions)
      • getAll()
      • remove(permissions)
      • request(permissions)
    • Events
      • onAdded
      • onRemoved
    • Types
      • AnyPermissions
      • CommonDataCollectionPermission
      • MatchPattern
      • MatchPatternRestricted
      • MatchPatternUnestricted
      • OptionalDataCollectionPermission
      • OptionalOnlyPermission
      • OptionalPermission
      • OptionalPermissionNoPrompt
      • Permission
      • PermissionNoPrompt
      • PermissionPrivileged
      • Permissions
  • pkcs11 API
    • Permissions
    • Functions
      • getModuleSlots(name)
      • installModule(name, [flags])
      • isModuleInstalled(name)
      • uninstallModule(name)
  • privacy API
    • Permissions
  • privacy.network API
    • Permissions
    • Types
      • HTTPSOnlyModeOption
      • IPHandlingPolicy
      • tlsVersionRestrictionConfig
    • Properties
      • globalPrivacyControl
      • httpsOnlyMode
      • networkPredictionEnabled
      • peerConnectionEnabled
      • tlsVersionRestriction
      • webRTCIPHandlingPolicy
  • privacy.services API
    • Permissions
    • Properties
      • passwordSavingEnabled
  • privacy.websites API
    • Permissions
    • Types
      • CookieConfig
      • TrackingProtectionModeOption
    • Properties
      • cookieConfig
      • firstPartyIsolate
      • hyperlinkAuditingEnabled
      • referrersEnabled
      • resistFingerprinting
      • trackingProtectionMode
  • runtime API
    • Permissions
    • Functions
      • connect([extensionId], [connectInfo])
      • connectNative(application)
      • getBackgroundPage()
      • getBrowserInfo()
      • getContexts(filter)
      • getFrameId(target)
      • getManifest()
      • getPlatformInfo()
      • getURL(path)
      • openOptionsPage()
      • reload()
      • restart()
      • sendMessage([extensionId], message, [options])
      • sendNativeMessage(application, message)
      • setUninstallURL([url])
    • Events
      • onConnect
      • onConnectExternal
      • onInstalled
      • onMessage
      • onMessageExternal
      • onPerformanceWarning
      • onStartup
      • onSuspend
      • onSuspendCanceled
      • onUpdateAvailable
      • onUserScriptConnect
      • onUserScriptMessage
    • Types
      • BrowserInfo
      • ContextType
      • Event
      • ExtensionContext
      • MessageSender
      • OnInstalledReason
      • OnPerformanceWarningCategory
      • OnPerformanceWarningSeverity
      • OnRestartRequiredReason
      • PlatformArch
      • PlatformInfo
      • PlatformOs
      • Port
      • RequestUpdateCheckStatus
    • Properties
      • id
      • lastError
  • scripting API
    • Permissions
    • Functions
      • executeScript(injection)
      • getRegisteredContentScripts([filter])
      • insertCSS(injection)
      • registerContentScripts(scripts)
      • removeCSS(injection)
      • unregisterContentScripts([filter])
      • updateContentScripts(scripts)
    • Types
      • ContentScriptFilter
      • CSSInjection
      • ExecutionWorld
      • ExtensionURL
      • InjectionResult
      • InjectionTarget
      • RegisteredContentScript
      • RunAt
      • ScriptInjection
  • scripting.compose API
    • Permissions
    • Functions
      • getRegisteredScripts([filter])
      • registerScripts(scripts)
      • unregisterScripts([filter])
    • Types
      • ComposeScriptDetails
      • ComposeScriptFilter
      • ExtensionURL
      • RunAt
  • scripting.messageDisplay API
    • Permissions
    • Functions
      • getRegisteredScripts([filter])
      • registerScripts(scripts)
      • unregisterScripts([filter])
    • Types
      • ExtensionURL
      • MessageDisplayScriptDetails
      • MessageDisplayScriptFilter
      • RunAt
  • sessions API
    • Functions
      • getTabValue(tabId, key)
      • removeTabValue(tabId, key)
      • setTabValue(tabId, key, value)
  • spaces API
    • Permissions
    • Functions
      • create(name, tabProperties, [buttonProperties])
      • get(spaceId)
      • open(spaceId, [windowId])
      • query([queryInfo])
      • remove(spaceId)
      • update(spaceId, tabProperties, [buttonProperties])
    • Types
      • ColorArray
      • ExtensionFileUrl
      • ExtensionURL
      • IconPath
      • Space
      • SpaceButtonProperties
      • SpaceTabProperties
      • ThemeIcons
  • spacesToolbar API
    • Functions
      • addButton(id, properties)
      • clickButton(id, [windowId])
      • removeButton(id)
      • updateButton(id, properties)
    • Types
      • ButtonProperties
      • ColorArray
      • ExtensionFileUrl
      • ExtensionURL
      • IconPath
      • ThemeIcons
  • storage API
    • Permissions
    • Events
      • onChanged
    • Types
      • StorageArea
      • StorageAreaWithUsage
      • StorageChange
    • Properties
      • local
      • managed
      • session
      • sync
  • tabs API
    • Permissions
    • Functions
      • connect(tabId, [connectInfo])
      • create(createProperties)
      • duplicate(tabId)
      • executeScript([tabId], details)
      • get(tabId)
      • getCurrent()
      • insertCSS([tabId], details)
      • move(tabIds, moveProperties)
      • query([queryInfo])
      • reload([tabId], [reloadProperties])
      • remove(tabIds)
      • removeCSS([tabId], details)
      • sendMessage(tabId, message, [options])
      • update([tabId], updateProperties)
    • Events
      • onActivated
      • onAttached
      • onCreated
      • onDetached
      • onMoved
      • onRemoved
      • onUpdated
    • Types
      • CSSOrigin
      • InjectDetails
      • RunAt
      • Tab
      • TabStatus
      • TabType
      • UpdateFilter
      • UpdatePropertyName
      • WindowType
    • Properties
      • TAB_ID_NONE
  • theme API
    • Manifest file properties
    • Permissions
    • Functions
      • getCurrent([windowId])
      • reset([windowId])
      • update([windowId], details)
    • Events
      • onUpdated
    • Types
      • ExtensionURL
      • ImageDataOrExtensionURL
      • ThemeColor
      • ThemeExperiment
      • ThemeManifest
      • ThemeType
      • ThemeUpdateInfo
  • userScripts API
    • Manifest file properties
    • Permissions
    • Functions
      • register(userScriptOptions)
    • Events
      • onBeforeScript
    • Types
      • ExtensionFileOrCode
      • ExtensionURL
      • MatchPattern
      • MatchPatternRestricted
      • MatchPatternUnestricted
      • PlainJSONValue
      • RunAt
      • UserScriptOptions
  • webNavigation API
    • Permissions
    • Functions
      • getAllFrames(details)
      • getFrame(details)
    • Events
      • onBeforeNavigate
      • onCommitted
      • onCompleted
      • onCreatedNavigationTarget
      • onDOMContentLoaded
      • onErrorOccurred
      • onHistoryStateUpdated
      • onReferenceFragmentUpdated
      • onTabReplaced
    • Types
      • EventUrlFilters
      • TransitionQualifier
      • TransitionType
      • UrlFilter
  • webRequest API
    • Permissions
    • Functions
      • filterResponseData(requestId)
      • getSecurityInfo(requestId, [options])
      • handlerBehaviorChanged()
    • Events
      • onAuthRequired
      • onBeforeRedirect
      • onBeforeRequest
      • onBeforeSendHeaders
      • onCompleted
      • onErrorOccurred
      • onHeadersReceived
      • onResponseStarted
      • onSendHeaders
    • Types
      • BlockingResponse
      • CertificateInfo
      • CertificateTransparencyStatus
      • HttpHeaders
      • OnAuthRequiredOptions
      • OnBeforeRedirectOptions
      • OnBeforeRequestOptions
      • OnBeforeSendHeadersOptions
      • OnCompletedOptions
      • OnHeadersReceivedOptions
      • OnResponseStartedOptions
      • OnSendHeadersOptions
      • RequestFilter
      • ResourceType
      • SecurityInfo
      • TransportWeaknessReasons
      • UploadData
      • UrlClassification
      • UrlClassificationFlags
      • UrlClassificationParty
    • Properties
      • MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES
  • windows API
    • Permissions
    • Functions
      • create([createData])
      • get(windowId, [getInfo])
      • getAll([getInfo])
      • getCurrent([getInfo])
      • getLastFocused([getInfo])
      • openDefaultBrowser(url)
      • remove(windowId)
      • update(windowId, updateInfo)
    • Events
      • onCreated
      • onFocusChanged
      • onRemoved
    • Types
      • CreateType
      • GetInfo
      • Window
      • WindowState
      • WindowType
    • Properties
      • WINDOW_ID_CURRENT
      • WINDOW_ID_NONE

Guides

  • Working with WebExtension events
    • Events with additional parameters
  • Working with message lists
    • Working with queries
  • Working with vCard contacts
    • Updating legacy properties
    • Updating the vCard property
  • Working with WebExtension Experiments
    • Introduction to Experiment APIs
      • Extension manifest
      • Schema
      • Implementing functions
      • Implementing events
    • Using folder and message types
    • Using tabs and windows
WebExtension API Documentation for Thunderbird 143.0.1

Manifest V2
  • menus API

≡ menus API

  • Permissions

  • Functions

  • Events

  • Types

  • Properties

≡ Add-on developer resources

  • Introduction to add-on development

  • "Hello world" extension tutorial

  • Developer community

  • Sample extensions (Github)

  • Using Promises

  • Additional resources on DTN

≡ Guides

  • Working with WebExtension events

  • Working with message lists

  • Working with vCard contacts

menus API

The part of the menus API that is available in all extension contexts, including content scripts.

Thunderbird’s menus API is similar to the Firefox menus API, but has been adapted to better suit Thunderbird’s specific needs.

Permissions

The following permissions influence the behavior of the API. Depending on which permissions are requested, additional methods might be available, or certain data may be included in responses.

Hint

Request permissions only when needed. Unnecessary requests may result in rejection during ATN review.

accountsRead

accountsRead



See your mail accounts, their identities and their folders.

activeTab

activeTab



Grant host permission to the currently active tab, allowing to read title, url and favIconUrl properties, or to inject content scripts.

compose

compose



Read and modify your email messages as you compose and send them.

menus

menus



Grant access to some or all methods of the menus API.

menus.overrideContext

menus.overrideContext



Grant access to the menus.overrideContext() method, hiding all default context menu entries and overriding the entire context menu.

messagesRead

messagesRead



Read your email messages.

tabs

tabs



Grant host permission to all active and inactive tabs, allowing to read title, url and favIconUrl properties, or to inject content scripts.

Note

The permission menus is required to use messenger.menus.*.

Functions

create(createProperties, [callback])

– [Added in TB 66]

Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation callback fires (the details will be in runtime.lastError).

Parameters

createProperties

createProperties

(object)



checked

[checked]

(boolean, optional)



The initial state of a checkbox or radio item: true for selected and false for unselected. Only one radio item can be selected at a time in a given group of radio items.

command

[command]

(string or MenuActionCommand, optional)



Specifies a command to issue for the context click. Can either be a user defined command, or one of the predefined action commands.

contexts

[contexts]

(array of ContextType, optional)



List of contexts this menu item will appear in. Defaults to [‘page’] if not specified.

documentUrlPatterns

[documentUrlPatterns]

(array of string, optional)



Lets you restrict the item to apply only to documents whose URL matches one of the given patterns. (This applies to frames as well.) For details on the format of a pattern, see Match Patterns.

enabled

[enabled]

(boolean, optional)



Whether this context menu item is enabled or disabled. Defaults to true.

icons

[icons]

(MenuIconPath or MenuIconDictionary, optional)



Custom icons to display next to the menu item. Custom icons can only be set for items appearing in submenus.

id

[id]

(string, optional)



The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension.

onclick

[onclick]

(function, optional)



A function that will be called back when the menu item is clicked. Event pages cannot use this.

parentId

[parentId]

(integer or string, optional)



The ID of a parent menu item; this makes the item a child of a previously added item.

targetUrlPatterns

[targetUrlPatterns]

(array of string, optional)



Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags.

title

[title]

(string, optional)



The text to be displayed in the item; this is required unless type is separator. When the context is selection, you can use %s within the string to show the selected text. For example, if this parameter’s value is Translate ‘%s’ to Latin and the user selects the word cool, the context menu item for the selection is Translate ‘cool’ to Latin. To specify an access key for the new menu entry, include a & before the desired letter in the title. For example &Help.

type

[type]

(ItemType, optional)



The type of menu item. Defaults to normal if not specified.

viewTypes

[viewTypes]

(array of ViewType, optional)



List of view types where the menu item will be shown. Defaults to any view, including those without a viewType.

visible

[visible]

(boolean, optional)



Whether the item is visible in the menu.

callback

[callback]

(function, optional)



Called when the item has been created in the browser. If there were any problems creating the item, details will be available in runtime.lastError.

Return type (Promise)

_returns

integer or string



The ID of the newly created item.

Required permissions

  • menus

getTargetElement(targetElementId)

– [Added in TB 66]

Retrieve the element that was associated with a recent contextmenu event.

Parameters

targetElementId

targetElementId

(integer)



The identifier of the clicked element, available as info.targetElementId in the onShown and onClicked events.

Return type (Promise)

_returns

Element



Required permissions

  • menus

overrideContext(contextOptions)

– [Added in TB 66]

Show the matching menu items from this extension instead of the default menu. This should be called during a contextmenu event handler, and only applies to the menu that opens after this event.

Parameters

contextOptions

contextOptions

(object)



context

[context]

(string, optional)



ContextType to override, to allow menu items from other extensions in the menu. Currently only tab is supported. contextOptions.showDefaults cannot be used with this option.

Supported values:

tab

tab



showDefaults

[showDefaults]

(boolean, optional)



Whether to also include default menu items in the menu.

tabId

[tabId]

(integer, optional)



Required when context is tab. Requires the tabs permission.

Required permissions

  • menus

  • menus.overrideContext

refresh()

– [Added in TB 66]

Updates the extension items in the shown menu, including changes that have been made since the menu was shown. Has no effect if the menu is hidden. Rebuilding a shown menu is an expensive operation, only invoke this method when necessary.

Required permissions

  • menus

remove(menuItemId)

– [Added in TB 66]

Removes a context menu item.

Parameters

menuItemId

menuItemId

(integer or string)



The ID of the context menu item to remove.

Required permissions

  • menus

removeAll()

– [Added in TB 66]

Removes all context menu items added by this extension.

Required permissions

  • menus

update(id, updateProperties)

– [Added in TB 66]

Updates a previously created context menu item.

Parameters

id

id

(integer or string)



The ID of the item to update.

updateProperties

updateProperties

(object)



The properties to update. Accepts the same values as the create function.

checked

[checked]

(boolean, optional)



contexts

[contexts]

(array of ContextType, optional)



documentUrlPatterns

[documentUrlPatterns]

(array of string, optional)



enabled

[enabled]

(boolean, optional)



icons

[icons]

(MenuIconPath or MenuIconDictionary, optional)



onclick

[onclick]

(function, optional)



parentId

[parentId]

(integer or string, optional)



The hierarchical parent of the element. Updating an element to become a child of its own descendants is not supported.

targetUrlPatterns

[targetUrlPatterns]

(array of string, optional)



title

[title]

(string, optional)



type

[type]

(ItemType, optional)



viewTypes

[viewTypes]

(array of ViewType, optional)



visible

[visible]

(boolean, optional)



Whether the item is visible in the menu.

Required permissions

  • menus

Events

onClicked

– [Added in TB 66]

Fired when a context menu item is clicked. This is a user input event handler. For asynchronous listeners some restrictions apply.

Parameters for onClicked.addListener(listener)

listener(info, tab)

listener(info, tab)



A function that will be called when this event occurs.

Parameters passed to the listener function

info

info

(OnClickData)



Information about the item clicked and the context where the click happened.

tab

[tab]

(Tab, optional)



The details of the tab where the click took place. If the click did not take place in a tab, this parameter will be missing.

Required permissions

  • menus

onHidden

– [Added in TB 66]

Fired when a menu is hidden. This event is only fired if onShown has fired before.

Parameters for onHidden.addListener(listener)

listener()

listener()



A function that will be called when this event occurs.

Required permissions

  • menus

onShown

– [Added in TB 66]

Fired when a menu is shown. The extension can add, modify or remove menu items and call refresh() to update the menu.

Parameters for onShown.addListener(listener)

listener(info, tab)

listener(info, tab)



A function that will be called when this event occurs.

Parameters passed to the listener function

info

info

(OnShowData)



Information about the context of the menu action and the created menu items.

tab

tab

(Tab)



The details of the tab where the menu was opened.

Required permissions

  • menus

Types

ContextType

– [Added in TB 66]

The different contexts a menu can appear in. Specifying all is equivalent to the combination of all other contexts excluding tab and tools_menu. More information about each context can be found in the Supported UI Elements article on developer.thunderbird.net.

string

Supported values:

all

all



Equivalent to the combination of all other contexts except for tab and tools_menu.

all_message_attachments

all_message_attachments

– [Added in TB 98]



Applies when the user context-clicks the summary of the message attachments of a displayed message with more than one attachment.

audio

audio



Applies when the user context-clicks an audio element.

browser_action

browser_action



Applies when the user context-clicks a browserAction button.

browser_action_menu

browser_action_menu

– [Added in TB 90]



Applies when the user opened a browserAction button of type menu.

compose_action

compose_action

– [Added in TB 89]



Applies when the user context-clicks a composeAction button.

compose_action_menu

compose_action_menu

– [Added in TB 90]



Applies when the user opened a composeAction button of type menu.

compose_attachments

compose_attachments

– [Added in TB 83]



Applies when the user context-clicks an attachment in the compose window.

compose_body

compose_body

– [Added in TB 111]



Applies when the user context-clicks in the compose editor.

editable

editable



Applies when the user context-clicks an editable element, like a textarea.

folder_pane

folder_pane



Applies when the user context-clicks in the folder pane of the main Thunderbird window.

frame

frame



Applies when the user context-clicks in a nested iframe.

header_pane_link

header_pane_link

– [Added in TB 137]



image

image



Applies when the user context-clicks an image.

link

link



Applies when the user context-clicks on a link.

message_attachments

message_attachments

– [Added in TB 98]



Applies when the user context-clicks a single attachment of a displayed message.

message_display_action

message_display_action

– [Added in TB 89]



Applies when the user context-clicks a messageDisplayAction button.

message_display_action_menu

message_display_action_menu

– [Added in TB 90]



Applies when the user opened a messageDisplayAction button of type menu.

message_list

message_list



Applies when the user context-clicks in the message list (a.k.a. thread pane) of the main Thunderbird window.

page

page



Applies when the user context-clicks in the page, but none of the other page contexts apply (for example, the click is not on an image or a nested iframe or a link).

password

password



Applies when the user context-clicks on a password input element.

selection

selection



Applies when part of the page is selected.

tab

tab



Applies when the user context-clicks on a tab (specifically, this refers to the tab-strip or other user interface element enabling the user to switch from one tab to another, not to the page itself).

tools_menu

tools_menu

– [Added in TB 88]



Applies when the user opens the Tools menu of Thunderbird’s main menu.

video

video



Applies when the user context-clicks a video element.

ItemType

– [Added in TB 66]

The type of menu item.

string

Supported values:

checkbox

checkbox



normal

normal



radio

radio



separator

separator



MenuActionCommand

– [Added in TB 131]

A predefined command to open an action popup.

string

Supported values:

_execute_browser_action

_execute_browser_action



_execute_compose_action

_execute_compose_action



_execute_message_display_action

_execute_message_display_action



MenuIconDictionary

– [Added in TB 124]

A dictionary object to specify paths for multiple icons in different sizes, so the best matching icon can be used, instead of scaling a standard icon to fit the pixel density of the user’s display. Each entry is a name-value pair, with name being a size and value being a MenuIconPath.

Example:

{
  "16": "icon16.png",
  "32": "icon32.png"
}

See the MDN documentation about choosing icon sizes for more information on this topic.

object

MenuIconPath

– [Added in TB 122]

The path for a menu icon may be a relative path to an icon file, a moz-extension: URL, an image data: URL, a blob: URL, or a remote http(s): URL.

string

or

string

OnClickData

– [Added in TB 66]

Information sent when a context menu item is clicked.

object

editable

editable

(boolean)



A flag indicating whether the element is editable (text input, textarea, etc.).

menuItemId

menuItemId

(integer or string)



The ID of the menu item that was clicked.

modifiers

modifiers

(array of string)



An array of keyboard modifiers that were held while the menu item was clicked.

Supported values:

Alt

Command

Ctrl

MacCtrl

Shift

attachments

[attachments]

(array of ComposeAttachment or MessageAttachment, optional)

– [Added in TB 83]



The selected attachments. The compose permission is required to return attachments of a message being composed. The messagesRead permission is required to return attachments of displayed messages.

button

[button]

(integer, optional)



An integer value of button by which menu item was clicked.

checked

[checked]

(boolean, optional)



A flag indicating the state of a checkbox or radio item after it is clicked.

displayedFolder

[displayedFolder]

(MailFolder, optional)



The displayed folder. Only available for the message_list context. The accountsRead permission is required.

fieldId

[fieldId]

(string, optional)

– [Added in TB 89]



An identifier of the clicked Thunderbird UI element, if any.

Supported values:

composeBcc

composeBcc

– [Added in TB 90]



composeCc

composeCc

– [Added in TB 90]



composeNewsgroupTo

composeNewsgroupTo

– [Added in TB 90]



composeReplyTo

composeReplyTo

– [Added in TB 90]



composeSubject

composeSubject

– [Added in TB 90]



composeTo

composeTo

– [Added in TB 90]



frameId

[frameId]

(integer, optional)



The id of the frame of the element where the context menu was clicked.

frameUrl

[frameUrl]

(string, optional)



The URL of the frame of the element where the context menu was clicked, if it was in a frame.

linkText

[linkText]

(string, optional)



If the element is a link, the text of that link.

linkUrl

[linkUrl]

(string, optional)



If the element is a link, the URL it points to.

mediaType

[mediaType]

(string, optional)



One of image, video, or audio if the context menu was activated on one of these types of elements.

pageUrl

[pageUrl]

(string, optional)



The URL of the page where the menu item was clicked. This property is not set if the click occurred in a context where there is no current page, such as in a launcher context menu.

parentMenuItemId

[parentMenuItemId]

(integer or string, optional)



The parent ID, if any, for the item clicked.

selectedAccount

[selectedAccount]

(MailAccount, optional) Deprecated.

– [Added in TB 88]



The selected account in the folder pane, if the context menu was opened on an account entry. Only available for the folder_pane context. The accountsRead permission is required.

selectedFolder

[selectedFolder]

(MailFolder, optional) Deprecated.



The selected folder in the folder pane (where the context menu was opened). Only available for the folder_pane context. The accountsRead permission is required.

selectedFolders

[selectedFolders]

(array of MailFolder, optional)

– [Added in TB 128]



The selected folders in the folder pane. Only available for the folder_pane context. The accountsRead permission is required. The returned selection includes the folders which would be affected by a context action through Thunderbirds UI, which may not be the actuall selected folders. For example, if the user has multiple folders selected and opens the context menu for a folder outside that selection, only the folder for which the context menu was opened, is returned.

selectedMessages

[selectedMessages]

(MessageList, optional)



The selected message(s) in the message list (a.k.a. the thread pane). Only available for the message_list context. The messagesRead permission is required. The returned selection includes the messages which would be affected by a context action through Thunderbirds UI, which may not be the actuall selected messages. For example, if the user has multiple messages selected and opens the context menu for a message outside that selection, only the message for which the context menu was opened, is returned.

selectionText

[selectionText]

(string, optional)



The text for the context selection, if any.

srcUrl

[srcUrl]

(string, optional)



Will be present for elements with a src URL.

targetElementId

[targetElementId]

(integer, optional)



An identifier of the clicked content element, if any. Use getTargetElement(targetElementId) in the page to find the corresponding element.

viewType

[viewType]

(ViewType, optional)



The type of view where the menu is clicked. May be unset if the menu is not associated with a view.

wasChecked

[wasChecked]

(boolean, optional)



A flag indicating the state of a checkbox or radio item before it was clicked.

OnShowData

– [Added in TB 88]

Information sent when a context menu is being shown. Some properties are only included if the extension has host permission for the given context, for example activeTab for content tabs, compose for compose tabs and messagesRead for message display tabs.

object

contexts

contexts

(array of ContextType)



A list of all contexts that apply to the menu.

editable

editable

(boolean)



A flag indicating whether the element is editable (text input, textarea, etc.).

menuIds

menuIds

(array of integer or string)



A list of IDs of the menu items that were shown.

attachments

[attachments]

(array of ComposeAttachment or MessageAttachment, optional)



The selected attachments. The compose permission is required to return attachments of a message being composed. The messagesRead permission is required to return attachments of displayed messages.

displayedFolder

[displayedFolder]

(MailFolder, optional)



The displayed folder. Only available for the message_list context. The accountsRead permission is required.

fieldId

[fieldId]

(string, optional)

– [Added in TB 89]



An identifier of the clicked Thunderbird UI element, if any.

Supported values:

composeBcc

composeBcc

– [Added in TB 98]



composeCc

composeCc

– [Added in TB 98]



composeNewsgroupTo

composeNewsgroupTo

– [Added in TB 98]



composeReplyTo

composeReplyTo

– [Added in TB 98]



composeSubject

composeSubject

– [Added in TB 98]



composeTo

composeTo

– [Added in TB 98]



frameUrl

[frameUrl]

(string, optional)



The URL of the frame of the element where the context menu was clicked, if it was in a frame.

Note

Host permission is required.

linkText

[linkText]

(string, optional)



If the element is a link, the text of that link.

Note

Host permission is required.

linkUrl

[linkUrl]

(string, optional)



If the element is a link, the URL it points to.

Note

Host permission is required.

mediaType

[mediaType]

(string, optional)



One of image, video, or audio if the context menu was activated on one of these types of elements.

pageUrl

[pageUrl]

(string, optional)



The URL of the page where the menu item was clicked. This property is not set if the click occurred in a context where there is no current page, such as in a launcher context menu.

Note

Host permission is required.

selectedAccount

[selectedAccount]

(MailAccount, optional) Deprecated.



The selected account in the folder pane, if the context menu was opened on an account entry. Only available for the folder_pane context. The accountsRead permission is required.

selectedFolder

[selectedFolder]

(MailFolder, optional) Deprecated.



The selected folder in the folder pane (where the context menu was opened). Only available for the folder_pane context. The accountsRead permission is required.

selectedFolders

[selectedFolders]

(array of MailFolder, optional)

– [Added in TB 128]



The selected folders in the folder pane. Only available for the folder_pane context. The accountsRead permission is required. The returned selection includes the folders which would be affected by a context action through Thunderbirds UI, which may not be the actuall selected folders. For example, if the user has multiple folders selected and opens the context menu for a folder outside that selection, only the folder for which the context menu was opened, is returned.

selectedMessages

[selectedMessages]

(MessageList, optional)



The selected message(s) in the message list (a.k.a. the thread pane). Only available for the message_list context. The messagesRead permission is required. The returned selection includes the messages which would be affected by a context action through Thunderbirds UI, which may not be the actuall selected messages. For example, if the user has multiple messages selected and opens the context menu for a message outside that selection, only the message for which the context menu was opened, is returned.

selectionText

[selectionText]

(string, optional)



The text for the context selection, if any.

Note

Host permission is required.

srcUrl

[srcUrl]

(string, optional)



Will be present for elements with a src URL.

Note

Host permission is required.

targetElementId

[targetElementId]

(integer, optional)



An identifier of the clicked content element, if any. Use getTargetElement(targetElementId) in the page to find the corresponding element.

viewType

[viewType]

(ViewType, optional)



The type of view where the menu is shown. May be unset if the menu is not associated with a view.

Properties

ACTION_MENU_TOP_LEVEL_LIMIT

The maximum number of top level extension items that can be added to an extension action context menu. Any items beyond this limit will be ignored.


© Copyright .

Built with Sphinx using a theme provided by Read the Docs.