/** * Thunderbird WebExtension API typings * * Generated from the annotated WebExtension schemas. Do not edit by hand. * * Thunderbird version: 160.0.1 * Manifest version: 2 * Channel: release * Schema repository: https://github.com/thunderbird/webext-annotated-schemas.git * Schema ref: release-mv2 * Schema commit: 506a7252c45f1baeeb163fca72405d58dd9059c9 * Namespaces: 68 * Generated by: webext-typings-generator 0.1.0 */ interface Window { messenger: typeof messenger; } interface WebExtEvent any> { addListener(cb: TCallback): void; removeListener(cb: TCallback): void; hasListener(cb: TCallback): boolean; } declare namespace messenger { namespace manifest { /** * Definition of a shortcut, for example `Alt+F5`. The string must match the shortcut format as defined by the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/commands#shortcut_values|MDN page of the commands API}.*/ export type KeyName = string; export interface CommandsShortcut { description?: string; suggested_key?: { /** * Default key combination.*/ default?: KeyName; /** * Key combination on Linux.*/ linux?: KeyName; /** * Key combination on Mac.*/ mac?: KeyName; /** * Key combination on Windows.*/ windows?: KeyName; } & { [key: string]: string; }; } /** * A script and/or CSS to inject into compose windows via the manifest.*/ export interface ComposeScript { /** * The list of CSS files to inject.*/ css?: ExtensionURL[]; /** * The list of JavaScript files to inject.*/ js?: ExtensionURL[]; } /** * A script and/or CSS to inject into message display pages via the manifest.*/ export interface MessageDisplayScript { /** * The list of CSS files to inject.*/ css?: ExtensionURL[]; /** * The list of JavaScript files to inject.*/ js?: ExtensionURL[]; /** * Determines when the files specified in css and js are injected. The states directly correspond to `Document.readyState`: `loading`, `interactive` and `complete`.*/ run_at?: "document_start" | "document_end" | "document_idle"; } /** * Represents a protocol handler definition.*/ export interface ProtocolHandler { /** * A user-readable title string for the protocol handler. This will be displayed to the user in interface objects as needed.*/ name: string; /** * The protocol the site wishes to handle, specified as a string. For example, you can register to handle SMS text message links by registering to handle the "sms" scheme.*/ protocol: ("bitcoin" | "dat" | "dweb" | "ftp" | "geo" | "gopher" | "im" | "ipfs" | "ipns" | "irc" | "ircs" | "magnet" | "mailto" | "matrix" | "mms" | "news" | "nntp" | "sip" | "sms" | "smsto" | "ssb" | "ssh" | "tel" | "urn" | "webcal" | "wtai" | "xmpp") | string; /** * The URL of the handler, as a string. This string should include "%s" as a placeholder which will be replaced with the escaped URL of the document to be handled. This URL might be a true URL, or it could be a phone number, email address, or so forth.*/ uriTemplate: ExtensionURL | HttpURL; } /** * Common properties for all manifest.json files*/ export interface ManifestBase { /** * The applications property is deprecated, please use 'browser_specific_settings'*/ applications?: DeprecatedApplications; author?: string; browser_specific_settings?: BrowserSpecificSettings; description?: string; developer?: { name?: string; url?: string; }; homepage_url?: string; install_origins?: string[]; manifest_version: number; /** * Name must be at least 2, and should be at most 75 characters*/ name: string; short_name?: string; version: string; } /** * Represents a WebExtension manifest.json file*/ export interface WebExtensionManifest { background?: { page?: ExtensionURL; persistent?: boolean; preferred_environment?: ("service_worker" | "document")[]; scripts?: ExtensionURL[]; service_worker?: ExtensionURL; /** * Only supported for page/scripts; not for service_worker yet, see bug 1775574*/ type?: "module" | "classic"; } & { [key: string]: UnrecognizedProperty; }; content_scripts?: ContentScript[]; content_security_policy?: string; granted_host_permissions?: boolean; hidden?: boolean; icons?: { [key: string]: any; }; /** * The 'split' value is not supported.*/ incognito?: "not_allowed" | "spanning" | "split"; minimum_chrome_version?: string; minimum_opera_version?: string; optional_permissions?: OptionalPermissionOrOrigin[]; /** * Alias property for options_ui.page, ignored when options_ui.page is set. When using this property the options page is always opened in a new tab.*/ options_page?: ExtensionURL; options_ui?: { /** * Defaults to true in Manifest V2; Deprecated in Manifest V3.*/ browser_style?: boolean; /** * chrome_style is ignored in Thunderbird. Its replacement (browser_style) has been deprecated.*/ chrome_style?: boolean; open_in_tab?: boolean; page: ExtensionURL; } & { [key: string]: UnrecognizedProperty; }; permissions?: PermissionOrOrigin[]; sandbox?: { /** * The content security policy used for sandboxed extension pages.*/ content_security_policy?: string; /** * The list of pages in the form of globs to serve as sandboxed extension pages.*/ pages: string[]; } & { [key: string]: UnrecognizedProperty; }; web_accessible_resources?: string[]; } /** * Represents a WebExtension language pack manifest.json file*/ export interface WebExtensionLangpackManifest { langpack_id: string; languages: { [key: string]: any; }; sources?: { [key: string]: any; }; } /** * Represents a WebExtension dictionary manifest.json file*/ export interface WebExtensionDictionaryManifest { dictionaries: { [key: string]: any; }; } export interface ThemeIcons { /** * The dark icon to use for light themes*/ dark: ExtensionURL; /** * A light icon to use for dark themes*/ light: ExtensionURL; /** * The size of the icons*/ size: number; } export type OptionalOnlyPermission = never; export type OptionalPermissionNoPrompt = "idle"; type OptionalPermission = OptionalPermissionNoPrompt | ("clipboardRead" | "clipboardWrite" | "geolocation" | "notifications"); type OptionalPermissionOrOrigin = OptionalPermission | OptionalOnlyPermission | MatchPattern; export type PermissionPrivileged = "mozillaAddons"; export type CommonDataCollectionPermission = "authenticationInfo" | "bookmarksInfo" | "browsingActivity" | "financialAndPaymentInfo" | "healthInfo" | "locationInfo" | "personalCommunications" | "personallyIdentifyingInfo" | "searchTerms" | "websiteActivity" | "websiteContent"; type DataCollectionPermission = CommonDataCollectionPermission | ("none"); type OptionalDataCollectionPermission = CommonDataCollectionPermission | ("technicalAndInteraction"); type PermissionNoPrompt = OptionalPermissionNoPrompt | PermissionPrivileged | ("alarms" | "storage" | "unlimitedStorage"); type Permission = PermissionNoPrompt | OptionalPermission; type PermissionOrOrigin = Permission | MatchPattern; export type HttpURL = string; export type ExtensionURL = string; export type ExtensionFileUrl = string; export type ImageDataOrExtensionURL = string; type ExtensionID = string | string; export interface FirefoxSpecificProperties { admin_install_only?: boolean; data_collection_permissions?: { has_previous_consent?: boolean; optional?: OptionalDataCollectionPermission[]; required?: DataCollectionPermission[]; } & { [key: string]: UnrecognizedProperty; }; id?: ExtensionID; strict_max_version?: string; strict_min_version?: string; update_url?: string; } export interface GeckoAndroidSpecificProperties { strict_max_version?: string; strict_min_version?: string; } export interface DeprecatedApplications { gecko?: FirefoxSpecificProperties; } export interface BrowserSpecificSettings { gecko?: FirefoxSpecificProperties; gecko_android?: GeckoAndroidSpecificProperties; } type MatchPattern = ("") | MatchPatternRestricted | MatchPatternUnestricted; /** * Same as MatchPattern above, but excludes */ type MatchPatternRestricted = string | string; /** * Mostly unrestricted match patterns for privileged add-ons. This should technically be rejected for unprivileged add-ons, but, reasons. The MatchPattern class will still refuse privileged schemes for those extensions.*/ export type MatchPatternUnestricted = string; /** * Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. Based on InjectDetails, but using underscore rather than camel case naming conventions.*/ export interface ContentScript { /** * If allFrames is `true`, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's `false` and is only injected into the top frame.*/ all_frames?: boolean; /** * The list of CSS files to inject*/ css?: ExtensionURL[]; css_origin?: extensionTypes.CSSOrigin; exclude_globs?: string[]; exclude_matches?: MatchPattern[]; include_globs?: string[]; /** * The list of JS files to inject*/ js?: ExtensionURL[]; /** * If match_about_blank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Ignored if match_origin_as_fallback is specified. By default it is `false`.*/ match_about_blank?: boolean; /** * If match_origin_as_fallback is true, then the code is also injected in about:, data:, blob: when their origin matches the pattern in 'matches', even if the actual document origin is opaque (due to the use of CSP sandbox or iframe sandbox). Match patterns in 'matches' must specify a wildcard path glob. By default it is `false`.*/ match_origin_as_fallback?: boolean; matches: MatchPattern[]; /** * The soonest that the JavaScript or CSS will be injected into the tab. Defaults to "document_idle".*/ run_at?: extensionTypes.RunAt; /** * The JavaScript world for a script to execute within. Defaults to "ISOLATED".*/ world?: extensionTypes.ExecutionWorld; } type IconPath = { [key: string]: any; } | ExtensionFileUrl; type IconImageData = { [key: string]: any; } | ImageData; /** * @deprecated An unexpected property was found in the WebExtension manifest.*/ type UnrecognizedProperty = any; /** * Defines a color value.*/ type ThemeColor = string | number[] | number[]; /** * Defines additional color, image and property keys to be used in {@link theme.ThemeType}, extending the theme-able areas of Thunderbird.*/ export interface ThemeExperiment { /** * A _dictionary object_ with one or more _key-value_ pairs to map new theme color keys to internal Thunderbird CSS color variables. The new color key is usable as a color reference in {@link theme.ThemeType}.*/ colors?: { [key: string]: string; }; /** * A _dictionary object_ with one or more _key-value_ pairs to map new theme image keys to internal Thunderbird CSS image variables. The new image key is usable as an image reference in {@link theme.ThemeType}.*/ images?: { [key: string]: string; }; /** * A _dictionary object_ with one or more _key-value_ pairs to map new theme property keys to internal Thunderbird CSS property variables. The new property key is usable as a property reference in {@link theme.ThemeType}.*/ properties?: { [key: string]: string; }; /** * URL to a stylesheet introducing additional CSS variables, extending the theme-able areas of Thunderbird.*/ stylesheet?: ExtensionURL; } /** * Contains the color, image and property settings of a theme.*/ export interface ThemeType { /** * A _dictionary object_ with one or more _key-value_ pairs to map color values to theme color keys. The following built-in theme color keys are supported:*/ colors?: { /** * @deprecated Unsupported colors property, use theme.colors.frame, this alias is ignored in Thunderbird >= 70.*/ accentcolor?: ThemeColor; /** * Not used in Thunderbird.*/ bookmark_text?: ThemeColor; /** * The color of the background of the pressed toolbar buttons.*/ button_background_active?: ThemeColor; /** * The color of the background of the toolbar buttons on hover.*/ button_background_hover?: ThemeColor; /** * The background color of the header area.*/ frame?: ThemeColor; /** * The background color of the header area when the window is inactive.*/ frame_inactive?: ThemeColor; /** * The color of the toolbar icons. Defaults to the color specified by `toolbar_text`.*/ icons?: ThemeColor; /** * The color of the toolbar icons in attention state such as the chat icon with new messages.*/ icons_attention?: ThemeColor; /** * Not used in Thunderbird.*/ ntp_background?: ThemeColor; /** * Not used in Thunderbird.*/ ntp_text?: ThemeColor; /** * The background color of popups such as the AppMenu.*/ popup?: ThemeColor; /** * The border color of popups.*/ popup_border?: ThemeColor; /** * The background color of items highlighted using the keyboard inside popups.*/ popup_highlight?: ThemeColor; /** * The text color of items highlighted using the keyboard inside popups.*/ popup_highlight_text?: ThemeColor; /** * The text color of popups.*/ popup_text?: ThemeColor; /** * The background color of the trees.*/ sidebar?: ThemeColor; /** * The border color of the trees.*/ sidebar_border?: ThemeColor; /** * The background color of highlighted rows in trees.*/ sidebar_highlight?: ThemeColor; /** * The border color of highlighted rows in trees.*/ sidebar_highlight_border?: ThemeColor; /** * The text color of highlighted rows in trees.*/ sidebar_highlight_text?: ThemeColor; /** * The text color of the trees. Needed to enable the tree theming.*/ sidebar_text?: ThemeColor; /** * The color of the vertical separator of the background tabs.*/ tab_background_separator?: ThemeColor; /** * The text color of the unselected tabs.*/ tab_background_text?: ThemeColor; /** * The color of the selected tab line.*/ tab_line?: ThemeColor; /** * The color of the tab loading indicator.*/ tab_loading?: ThemeColor; /** * Background color of the selected tab. Defaults to the color specified by `toolbar`.*/ tab_selected?: ThemeColor; /** * The text color for the selected tab. Defaults to the color specified by `toolbar_text`.*/ tab_text?: ThemeColor; /** * @deprecated Unsupported color property, use theme.colors.tab_background_text, this alias is ignored in Thunderbird >= 70.*/ textcolor?: ThemeColor; /** * The background color of the toolbars. Also used as default value for `tab_selected`.*/ toolbar?: ThemeColor; /** * The color of the line separating the bottom of the toolbar from the region below.*/ toolbar_bottom_separator?: ThemeColor; /** * The background color for fields in the toolbar, such as the search field.*/ toolbar_field?: ThemeColor; /** * The border color for fields in the toolbar.*/ toolbar_field_border?: ThemeColor; /** * The focused border color for fields in the toolbar.*/ toolbar_field_border_focus?: ThemeColor; /** * The focused background color for fields in the toolbar.*/ toolbar_field_focus?: ThemeColor; /** * The background color used to indicate the current selection of text in the search field.*/ toolbar_field_highlight?: ThemeColor; /** * The color used to draw text that's currently selected in the search field.*/ toolbar_field_highlight_text?: ThemeColor; /** * Not used in Thunderbird.* * @deprecated This color property is ignored in >= 89.*/ toolbar_field_separator?: ThemeColor; /** * The text color for fields in the toolbar.*/ toolbar_field_text?: ThemeColor; /** * The text color in the focused fields in the toolbar.*/ toolbar_field_text_focus?: ThemeColor; /** * The text color in the main Thunderbird toolbar. Also used as default value for `icons` and `tab_text`.*/ toolbar_text?: ThemeColor; /** * The color of the line separating the top of the toolbar from the region above.*/ toolbar_top_separator?: ThemeColor; /** * The color of the vertical separators on the toolbars.*/ toolbar_vertical_separator?: ThemeColor; } & { [key: string]: ThemeColor; }; /** * A _dictionary object_ with one or more _key-value_ pairs to map images to theme image keys. The following built-in theme image keys are supported:*/ images?: { /** * Additional images added to the header area and displayed behind the `theme_frame` image.*/ additional_backgrounds?: ImageDataOrExtensionURL[]; /** * @deprecated Unsupported images property, use theme.images.theme_frame, this alias is ignored in Thunderbird >= 70.*/ headerURL?: ImageDataOrExtensionURL; /** * Foreground image on the header area.*/ theme_frame?: ImageDataOrExtensionURL; } & { [key: string]: ImageDataOrExtensionURL; }; /** * A _dictionary object_ with one or more _key-value_ pairs to map property values to theme property keys. The following built-in theme property keys are supported:*/ properties?: { /** * An array of alignment values, one for each image in `additional_backgrounds`.*/ additional_backgrounds_alignment?: ("bottom" | "center" | "left" | "right" | "top" | "center bottom" | "center center" | "center top" | "left bottom" | "left center" | "left top" | "right bottom" | "right center" | "right top")[]; /** * An array of tiling values, one for each image in `additional_backgrounds`.*/ additional_backgrounds_tiling?: ("no-repeat" | "repeat" | "repeat-x" | "repeat-y")[]; /** * If set, overrides the general theme (context menus, toolbars, content area).*/ color_scheme?: "auto" | "light" | "dark" | "system"; /** * If set, overrides the color scheme for the content area.*/ content_color_scheme?: "auto" | "light" | "dark" | "system"; } & { [key: string]: string; }; } /** * Contents of manifest.json for a static theme*/ export interface ThemeManifest { /** * Fallback properties for the dark system theme in a static theme.*/ dark_theme?: ThemeType; default_locale?: string; /** * Icons shown in the Add-ons Manager.*/ icons?: { [key: string]: any; }; /** * Properties for a static theme. A static theme must not contain any other WebExtension logic. If additional logic is required, request the theme permission and load/update the theme dynamically. More information about themes can be found in the {@link https://developer.thunderbird.net/add-ons/web-extension-themes|theme guide}*/ theme: ThemeType; /** * CSS file with additional styles.*/ theme_experiment?: ThemeExperiment; } } namespace accounts { /** * An object describing a mail account, as returned for example by the {@link accounts.list} and {@link accounts.get} methods.*/ export interface MailAccount { /** * The folders for this account. The property may be `null`, if inclusion of folders had not been requested.*/ folders: folders.MailFolder[] | null; /** * A unique identifier for this account.*/ id: MailAccountId; /** * The identities associated with this account. The default identity is listed first, others in no particular order.*/ identities: identities.MailIdentity[]; /** * The human-friendly name of this account.*/ name: string; /** * The root folder associated with this account.*/ rootFolder: folders.MailFolder; /** * What sort of account this is. Either one of the natively supported account types, or an account type added by an extension.*/ type: accounts.NativeMailAccountType | accounts.ExtensionMailAccountType; } /** * A unique id representing a {@link accounts.MailAccount}.*/ export type MailAccountId = string; /** * The type of an account natively supported by Thunderbird.*/ export type NativeMailAccountType = "ews" | "imap" | "nntp" | "none" | "pop3" | "rss"; /** * The type of an account which was added by an extension. For the time being there is no guarantee for account types added by extensions to always work as expected.*/ export type ExtensionMailAccountType = string; /** * Returns all mail accounts. They will be returned in the same order as used in Thunderbird's folder pane.*/ export function list(/** * Specifies whether the {@link folders.MailFolder} in the `rootFolder` property of each found {@link accounts.MailAccount} should populate its `subFolders` property, and include all (nested!) subfolders. This also affects the deprecated `folders` property of each found {@link accounts.MailAccount}. Defaults to `true`.*/ includeSubFolders?: boolean): Promise; /** * Returns details of the requested account, or `null` if it doesn't exist.*/ export function get(accountId: MailAccountId, /** * Specifies whether the {@link folders.MailFolder} in the `rootFolder` property of the returned {@link accounts.MailAccount} should populate its `subFolders` property, and include all (nested!) subfolders. This also affects the deprecated `folders` property of the returned {@link accounts.MailAccount}. Defaults to `true`.*/ includeSubFolders?: boolean): Promise; /** * Returns the default account, or `null` if it is not defined.*/ export function getDefault(/** * Specifies whether the {@link folders.MailFolder} in the `rootFolder` property of the default {@link accounts.MailAccount} should populate its `subFolders` property, and include all (nested!) subfolders. This also affects the deprecated `folders` property of the default {@link accounts.MailAccount}. Defaults to `true`*/ includeSubFolders?: boolean): Promise; /** * Sets the default identity for an account.* * @deprecated Deprecated since Thunderbird 91 and removed in Manifest V3: accounts.setDefaultIdentity() is now available as identities.setDefault.*/ export function setDefaultIdentity(accountId: MailAccountId, identityId: string): Promise; /** * Returns the default identity for an account, or `null` if it is not defined.* * @deprecated Deprecated since Thunderbird 91 and removed in Manifest V3: accounts.getDefaultIdentity() is now available as identities.getDefault.*/ export function getDefaultIdentity(accountId: MailAccountId): Promise; /** * Fired when a new account has been created.*/ export const onCreated: WebExtEvent<(accountId: MailAccountId, account: MailAccount) => void>; /** * Fired when an account has been removed.*/ export const onDeleted: WebExtEvent<(accountId: MailAccountId) => void>; /** * Fired when a property of an account has been modified. Folders and identities of accounts are not monitored by this event, use the dedicated folder and identity events instead. A changed `defaultIdentity` is reported only after a different identity has been assigned as default identity, but not after a property of the default identity has been changed.*/ export const onUpdated: WebExtEvent<(accountId: MailAccountId, changedValues: { /** * The default identity of this account.*/ defaultIdentity: identities.MailIdentity; /** * The human-friendly name of this account.*/ name: string; }) => void>; } namespace addressBooks { /** * Indicates the type of a Node.*/ export type NodeType = "addressBook" | "contact" | "mailingList"; /** * A node representing an address book.*/ export interface AddressBookNode { /** * A list of contacts held by this node's address book or mailing list.*/ contacts?: contacts.ContactNode[]; /** * The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the program is restarted.*/ id: string; /** * A list of mailingLists in this node's address book.*/ mailingLists?: mailingLists.MailingListNode[]; name: string; /** * The `id` of the parent object.*/ parentId?: string; /** * Indicates if the object is read-only.*/ readOnly?: boolean; /** * Indicates if the address book is accessed via remote look-up.*/ remote?: boolean; /** * Always set to `addressBook`.*/ type: NodeType; } /** * Opens the address book user interface.*/ export function openUI(): Promise; /** * Closes the address book user interface.*/ export function closeUI(): Promise; /** * Gets a list of the user's address books, optionally including all contacts and mailing lists.*/ export function list(/** * If set to true, results will include contacts and mailing lists for each address book.*/ complete?: boolean): Promise; /** * Gets a single address book, optionally including all contacts and mailing lists.*/ export function get(id: string, /** * If set to true, results will include contacts and mailing lists for this address book.*/ complete?: boolean): Promise; export interface CreateProperties { name: string; } /** * Creates a new, empty address book.*/ export function create(properties: CreateProperties): Promise; export interface UpdateProperties { name: string; } /** * Renames an address book.*/ export function update(id: string, properties: UpdateProperties): Promise; /** * Removes an address book, and all associated contacts and mailing lists.*/ function __delete(id: string): Promise; export { __delete as delete }; /** * Fired when an address book is created.*/ export const onCreated: WebExtEvent<(node: AddressBookNode) => void>; /** * Fired when an address book is renamed.*/ export const onUpdated: WebExtEvent<(node: AddressBookNode) => void>; /** * Fired when an addressBook is deleted.*/ export const onDeleted: WebExtEvent<(id: string) => void>; } namespace addressBooks.provider { /** * Registering this listener will create a read-only address book, similar to an LDAP address book. When selecting this address book, users will first see no contacts, but they can search for contacts, which will fire this event. Contacts returned by the listener callback will be displayed as contact cards in the address book. Several listeners can be registered, to create multiple address books.*/ export const onSearchRequest: { addListener: (callback: (node: addressBooks.AddressBookNode, /** * The search text that the user entered. Not available when invoked from the advanced address book search dialog.*/ searchString?: string, /** * The boolean query expression corresponding to the search.*/ query?: string) => { isCompleteResult: boolean; results: contacts.ContactProperties[]; }, parameters: { /** * The name of the created address book. If not provided, the name of the extension is used.*/ addressBookName?: string; /** * The unique identifier of the created address book. If not provided, a unique identifier will be generated for you.*/ id?: string; /** * Whether the address book search queries are using encrypted protocols like HTTPS.*/ isSecure?: boolean; }) => void; removeListener: (callback: (node: addressBooks.AddressBookNode, /** * The search text that the user entered. Not available when invoked from the advanced address book search dialog.*/ searchString?: string, /** * The boolean query expression corresponding to the search.*/ query?: string) => { isCompleteResult: boolean; results: contacts.ContactProperties[]; }) => void; hasListener: (callback: (node: addressBooks.AddressBookNode, /** * The search text that the user entered. Not available when invoked from the advanced address book search dialog.*/ searchString?: string, /** * The boolean query expression corresponding to the search.*/ query?: string) => { isCompleteResult: boolean; results: contacts.ContactProperties[]; }) => boolean; }; } namespace contacts { /** * Object defining a query for {@link contacts.quickSearch}.*/ export interface QueryInfo { /** * Whether to include results from local address books. Defaults to `true`.*/ includeLocal?: boolean; /** * Whether to include results from read-only address books. Defaults to `true`.*/ includeReadOnly?: boolean; /** * Whether to include results from read-write address books. Defaults to `true`.*/ includeReadWrite?: boolean; /** * Whether to include results from remote address books. Defaults to `true`.*/ includeRemote?: boolean; /** * One or more space-separated terms to search for in predefined contact fields (defined by the preference `mail.addr_book.quicksearchquery.format`).*/ searchString?: string; } /** * A node representing a contact in an address book.*/ export interface ContactNode { /** * The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the program is restarted.*/ id: string; /** * The `id` of the parent object.*/ parentId?: string; properties: ContactProperties; /** * Indicates if the object is read-only.*/ readOnly?: boolean; /** * Indicates if the object came from a remote address book.*/ remote?: boolean; /** * Always set to `contact`.*/ type: addressBooks.NodeType; } /** * A set of individual properties for a particular contact, and its vCard string. Further information can be found in $(doc:guides/vcard).*/ export interface ContactProperties { [key: string]: (string | null); } /** * A dictionary of changed properties. Keys are the property name that changed, values are an object containing `oldValue` and `newValue`. Values can be either a string or `null`.*/ export interface PropertyChange { [key: string]: { newValue: string | null; oldValue: string | null; }; } /** * Gets all the contacts in the address book with the id `parentId`.*/ export function list(parentId: string): Promise; /** * Gets all contacts matching `queryInfo` in the address book with the id `parentId`.*/ export function quickSearch(/** * The id of the address book to search. If not specified, all address books are searched.*/ parentId: string, /** * Either a _string_ with one or more space-separated terms to search for, or a complex {@link contacts.QueryInfo} search query.*/ queryInfo: string | QueryInfo): Promise; /** * Gets all contacts matching `queryInfo` in the address book with the id `parentId`.*/ export function quickSearch(/** * Either a _string_ with one or more space-separated terms to search for, or a complex {@link contacts.QueryInfo} search query.*/ queryInfo: string | QueryInfo): Promise; /** * Gets a single contact.*/ export function get(id: string): Promise; /** * Gets the photo associated with this contact. Returns `null`, if no photo is available.*/ export function getPhoto(id: string): Promise<{ [key: string]: any; } | null>; export interface SetPhotoFile { } /** * Sets the photo associated with this contact.*/ export function setPhoto(id: string, file: SetPhotoFile): Promise; /** * Adds a new contact to the address book with the id `parentId`.*/ export function create(parentId: string, /** * Assigns the contact an id. If an existing contact has this id, an exception is thrown.* * @deprecated The card's id should be specified directly in the vCard string.*/ id: string, /** * The properties object for the new contact. If it includes a `vCard` member, all specified {@link https://searchfox.org/comm-central/rev/8a1ae67088acf237dab2fd704db18589e7bf119e/mailnews/addrbook/modules/VCardUtils.jsm#295-334|legacy properties} are ignored and the new contact will be based on the provided vCard string. If a UID is specified in the vCard string, which is already used by another contact, an exception is thrown.*/ properties: ContactProperties): Promise; /** * Adds a new contact to the address book with the id `parentId`.*/ export function create(parentId: string, /** * The properties object for the new contact. If it includes a `vCard` member, all specified {@link https://searchfox.org/comm-central/rev/8a1ae67088acf237dab2fd704db18589e7bf119e/mailnews/addrbook/modules/VCardUtils.jsm#295-334|legacy properties} are ignored and the new contact will be based on the provided vCard string. If a UID is specified in the vCard string, which is already used by another contact, an exception is thrown.*/ properties: ContactProperties): Promise; /** * Updates a contact.*/ export function update(id: string, /** * An object with properties to update the specified contact. Individual properties are removed, if they are set to `null`. If the provided object includes a `vCard` member, all specified {@link https://searchfox.org/comm-central/rev/8a1ae67088acf237dab2fd704db18589e7bf119e/mailnews/addrbook/modules/VCardUtils.jsm#295-334|legacy properties} are ignored and the details of the contact will be replaced by the provided vCard. Changes to the UID will be ignored.*/ properties: ContactProperties): Promise; /** * Removes a contact from the address book. The contact is also removed from any mailing lists it is a member of.*/ function __delete(id: string): Promise; export { __delete as delete }; /** * Fired when a contact is created.*/ export const onCreated: WebExtEvent<(node: ContactNode) => void>; /** * Fired when a large number of contacts are added. The contacts are not emitted for performance reasons. The event indicates significant changes, and consumers should rebuild any cached representation of the address book.*/ export const onManyCreated: WebExtEvent<(node: addressBooks.AddressBookNode) => void>; /** * Fired when a contact is changed.*/ export const onUpdated: WebExtEvent<(node: ContactNode, changedProperties: PropertyChange) => void>; /** * Fired when a contact is removed from an address book.*/ export const onDeleted: WebExtEvent<(parentId: string, id: string) => void>; } namespace mailingLists { /** * A node representing a mailing list.*/ export interface MailingListNode { /** * A list of contacts held by this node's address book or mailing list.*/ contacts?: contacts.ContactNode[]; description: string; /** * The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the program is restarted.*/ id: string; name: string; nickName: string; /** * The `id` of the parent object.*/ parentId?: string; /** * Indicates if the object is read-only.*/ readOnly?: boolean; /** * Indicates if the object came from a remote address book.*/ remote?: boolean; /** * Always set to `mailingList`.*/ type: addressBooks.NodeType; } /** * Gets all the mailing lists in the address book with id `parentId`.*/ export function list(parentId: string): Promise; /** * Gets a single mailing list.*/ export function get(id: string): Promise; export interface CreateProperties { description?: string; name: string; nickName?: string; } /** * Creates a new mailing list in the address book with id `parentId`.*/ export function create(parentId: string, properties: CreateProperties): Promise; export interface UpdateProperties { description?: string; name: string; nickName?: string; } /** * Edits the properties of a mailing list.*/ export function update(id: string, properties: UpdateProperties): Promise; /** * Removes the mailing list.*/ function __delete(id: string): Promise; export { __delete as delete }; /** * Adds a contact to the mailing list with id `id`. If the contact and mailing list are in different address books, the contact will also be copied to the list's address book.*/ export function addMember(id: string, contactId: string): Promise; /** * Gets all contacts that are members of the mailing list with id `id`.*/ export function listMembers(id: string): Promise; /** * Removes a contact from the mailing list with id `id`. This does not delete the contact from the address book.*/ export function removeMember(id: string, contactId: string): Promise; /** * Fired when a mailing list is created.*/ export const onCreated: WebExtEvent<(node: MailingListNode) => void>; /** * Fired when a mailing list is changed.*/ export const onUpdated: WebExtEvent<(node: MailingListNode) => void>; /** * Fired when a mailing list is deleted.*/ export const onDeleted: WebExtEvent<(parentId: string, id: string) => void>; /** * Fired when a contact is added to the mailing list.*/ export const onMemberAdded: WebExtEvent<(node: contacts.ContactNode) => void>; /** * Fired when a contact is removed from the mailing list.*/ export const onMemberRemoved: WebExtEvent<(parentId: string, id: string) => void>; } namespace alarms { export interface Alarm { /** * Name of this alarm.*/ name: string; /** * When present, signals that the alarm triggers periodically after so many minutes.*/ periodInMinutes?: number; /** * Time when the alarm is scheduled to fire, in milliseconds past the epoch.*/ scheduledTime: number; } /** * Details about the alarm. The alarm first fires either at 'when' milliseconds past the epoch (if 'when' is provided), after 'delayInMinutes' minutes from the current time (if 'delayInMinutes' is provided instead), or after 'periodInMinutes' minutes from the current time (if only 'periodInMinutes' is provided). Users should never provide both 'when' and 'delayInMinutes'. If 'periodInMinutes' is provided, then the alarm recurs repeatedly after that many minutes.*/ export interface CreateAlarmInfo { /** * Number of minutes from the current time after which the alarm should first fire.*/ delayInMinutes?: number; /** * Number of minutes after which the alarm should recur repeatedly.*/ periodInMinutes?: number; /** * Time when the alarm is scheduled to first fire, in milliseconds past the epoch.*/ when?: number; } /** * Creates an alarm. After the delay is expired, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm.*/ export function create(/** * Optional name to identify this alarm. Defaults to the empty string.*/ name: string, /** * Details about the alarm. The alarm first fires either at 'when' milliseconds past the epoch (if 'when' is provided), after 'delayInMinutes' minutes from the current time (if 'delayInMinutes' is provided instead), or after 'periodInMinutes' minutes from the current time (if only 'periodInMinutes' is provided). Users should never provide both 'when' and 'delayInMinutes'. If 'periodInMinutes' is provided, then the alarm recurs repeatedly after that many minutes.*/ alarmInfo: CreateAlarmInfo): Promise; /** * Creates an alarm. After the delay is expired, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm.*/ export function create(/** * Details about the alarm. The alarm first fires either at 'when' milliseconds past the epoch (if 'when' is provided), after 'delayInMinutes' minutes from the current time (if 'delayInMinutes' is provided instead), or after 'periodInMinutes' minutes from the current time (if only 'periodInMinutes' is provided). Users should never provide both 'when' and 'delayInMinutes'. If 'periodInMinutes' is provided, then the alarm recurs repeatedly after that many minutes.*/ alarmInfo: CreateAlarmInfo): Promise; /** * Retrieves details about the specified alarm.*/ export function get(/** * The name of the alarm to get. Defaults to the empty string.*/ name: string): Promise; /** * Retrieves details about the specified alarm.*/ export function get(): Promise; /** * Gets an array of all the alarms.*/ export function getAll(): Promise; /** * Clears the alarm with the given name.*/ export function clear(/** * The name of the alarm to clear. Defaults to the empty string.*/ name: string): Promise; /** * Clears the alarm with the given name.*/ export function clear(): Promise; /** * Clears all alarms.*/ export function clearAll(): Promise; /** * Fired when an alarm has expired. Useful for transient background pages.*/ export const onAlarm: WebExtEvent<(/** * The alarm that has expired.*/ name: Alarm) => void>; } namespace browserAction { /** * An array of four integers in the range [0,255] that make up the RGBA color. For example, opaque red is `[255, 0, 0, 255]`.*/ type ColorArray = number[]; /** * Pixel data for an image. Must be an {@link https://developer.mozilla.org/en-US/docs/Web/API/ImageData|ImageData} object (for example, from a {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/canvas|canvas} element).*/ export interface ImageDataType { } /** * A _dictionary object_ to specify multiple {@link https://developer.mozilla.org/en-US/docs/Web/API/ImageData|ImageData} objects in different sizes, so the icon does not have to be scaled for a device with a different pixel density. Each entry is a _name-value_ pair with _value_ being an {@link https://developer.mozilla.org/en-US/docs/Web/API/ImageData|ImageData} object, and _name_ its size.*/ export interface ImageDataDictionary { [key: string]: ImageDataType; } /** * Information sent when an action button is clicked.*/ export interface OnClickData { /** * An integer value of button by which menu item was clicked.*/ button?: number; /** * An array of keyboard modifiers that were held while the menu item was clicked.*/ modifiers: ("Shift" | "Alt" | "Command" | "Ctrl" | "MacCtrl")[]; } export interface SetTitleDetails { /** * Sets the title only for the given tab.*/ tabId?: number; /** * A string the action button should display as its label and when moused over. Cleared by setting it to `null` or an empty string (title defined the manifest will be used).*/ title: string | null; } /** * Sets the title of the action button. Is used as tooltip and as the label.*/ export function setTitle(details: SetTitleDetails): Promise; export interface GetTitleDetails { /** * Specifies for which tab the title should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the title of the action button.*/ export function getTitle(details: GetTitleDetails): Promise; export interface SetLabelDetails { /** * A string the action button should use as its label, overriding the defined title. Can be set to an empty string to not display any label at all. If the containing toolbar is configured to display text only, its title will be used. Cleared by setting it to `null`.*/ label: string | null; /** * Sets the label only for the given tab.*/ tabId?: number; } /** * Sets the label of the action button. Can be used to set different values for the tooltip (defined by the title) and the label. Additionally, the label can be set to an empty string, not showing any label at all.*/ export function setLabel(details: SetLabelDetails): Promise; export interface GetLabelDetails { /** * Specifies for which tab the label should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the label of the action button. Returns `null`, if no label has been set and the title is used.*/ export function getLabel(details: GetLabelDetails): Promise; export interface SetIconDetails { /** * The image data for one or more icons for the action button.*/ imageData?: ImageDataType | ImageDataDictionary; /** * The paths to one or more icons for the action button.*/ path?: manifest.IconPath; /** * Sets the icon only for the given tab.*/ tabId?: number; } /** * Sets the icon for the action button. Either the `path` or the `imageData` property must be specified.*/ export function setIcon(details: SetIconDetails): Promise; export interface SetPopupDetails { /** * The html file to show in a popup. Can be set to an empty string to not open a popup. Cleared by setting it to `null` (popup value defined the manifest will be used).*/ popup: string | null; /** * Sets the popup only for the given tab.*/ tabId?: number; } /** * Sets the html document to be opened as a popup when the user clicks on the action button.*/ export function setPopup(details: SetPopupDetails): Promise; export interface GetPopupDetails { /** * Specifies for which tab the popup document should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the html document set as the popup for this action button.*/ export function getPopup(details: GetPopupDetails): Promise; export interface SetBadgeTextDetails { /** * Sets the badge text only for the given tab.*/ tabId?: number; /** * Any number of characters can be passed, but only about four can fit in the space. Cleared by setting it to `null` or an empty string.*/ text: string | null; } /** * Sets the badge text for the action button. The badge is displayed on top of the icon.*/ export function setBadgeText(details: SetBadgeTextDetails): Promise; export interface GetBadgeTextDetails { /** * Specifies for which tab the badge text should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the badge text of the action button.*/ export function getBadgeText(details: GetBadgeTextDetails): Promise; export interface SetBadgeTextColorDetails { /** * The color to use as text color in the badge. Cleared by setting it to `null`.*/ color: string | ColorArray | null; /** * Sets the text color for the badge only for the given tab.*/ tabId?: number; } /** * Sets the text color for the badge.*/ export function setBadgeTextColor(details: SetBadgeTextColorDetails): Promise; export interface GetBadgeTextColorDetails { /** * Specifies for which tab the badge text color should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the text color of the badge.*/ export function getBadgeTextColor(details: GetBadgeTextColorDetails): Promise; export interface SetBadgeBackgroundColorDetails { /** * The color to use as background in the badge. Cleared by setting it to `null`.*/ color: string | ColorArray | null; /** * Sets the background color for the badge only for the given tab.*/ tabId?: number; } /** * Sets the background color for the badge.*/ export function setBadgeBackgroundColor(details: SetBadgeBackgroundColorDetails): Promise; export interface GetBadgeBackgroundColorDetails { /** * Specifies for which tab the badge background color should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the badge background color of the action button.*/ export function getBadgeBackgroundColor(details: GetBadgeBackgroundColorDetails): Promise; /** * Enables the action button for a specific tab (if a `tabId` is provided), or for all tabs which do not have a custom enable state. Once the enable state of a tab has been updated individually, all further changes to its state have to be done individually as well. By default, an action button is enabled.*/ export function enable(/** * The id of the tab for which you want to modify the action button.*/ tabId?: number): Promise; /** * Disables the action button for a specific tab (if a `tabId` is provided), or for all tabs which do not have a custom enable state. Once the enable state of a tab has been updated individually, all further changes to its state have to be done individually as well.*/ export function disable(/** * The id of the tab for which you want to modify the action button.*/ tabId?: number): Promise; export interface IsEnabledDetails { /** * Specifies for which tab the state should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Checks whether the action button is enabled.*/ export function isEnabled(details: IsEnabledDetails): Promise; /** * An object with information about the popup to open.*/ export interface OpenPopupOptions { /** * Defaults to the current window.*/ windowId?: number; } /** * Opens the action's popup window in the specified window. Defaults to the current window. Returns false if the popup could not be opened because the action has no popup, is of type `menu`, is disabled or has been removed from the toolbar.*/ export function openPopup(/** * An object with information about the popup to open.*/ options?: OpenPopupOptions): Promise; /** * Fired when an action button is clicked. This event will not fire if the action has a popup. This is a user input event handler. For asynchronous listeners some {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/User_actions|restrictions} apply.*/ export const onClicked: WebExtEvent<(tab: tabs.Tab, info?: OnClickData) => void>; } namespace browserSettings { /** * How images should be animated in the browser.*/ export type ImageAnimationBehavior = "normal" | "none" | "once"; /** * After which mouse event context menus should popup.*/ export type ContextMenuMouseEvent = "mouseup" | "mousedown"; /** * Color management mode.*/ export type ColorManagementMode = "off" | "full" | "tagged_only"; /** * Allows or disallows pop-up windows from opening in response to user events.*/ export const allowPopupsForUserEvents: types.Setting; /** * Enables or disables the browser cache.*/ export const cacheEnabled: types.Setting; /** * This boolean setting controls whether the selected tab can be closed with a double click.*/ export const closeTabsByDoubleClick: types.Setting; /** * Controls after which mouse event context menus popup. This setting's value is of type ContextMenuMouseEvent, which has possible values of `mouseup` and `mousedown`.*/ export const contextMenuShowEvent: types.Setting; /** * Returns whether the FTP protocol is enabled. Read-only.* * @deprecated FTP support was removed from Thunderbird in bug 1574475*/ export const ftpProtocolEnabled: types.Setting; /** * Returns the value of the overridden home page. Read-only.*/ export const homepageOverride: types.Setting; /** * Controls the behaviour of image animation in the browser. This setting's value is of type ImageAnimationBehavior, defaulting to `normal`.*/ export const imageAnimationBehavior: types.Setting; /** * Returns the value of the overridden new tab page. Read-only.*/ export const newTabPageOverride: types.Setting; /** * Controls where new tabs are opened. afterCurrent will open all new tabs next to the current tab, relatedAfterCurrent will open only related tabs next to the current tab, and atEnd will open all tabs at the end of the tab strip. The default is relatedAfterCurrent.*/ export const newTabPosition: types.Setting; /** * This boolean setting controls whether bookmarks are opened in the current tab or in a new tab.*/ export const openBookmarksInNewTabs: types.Setting; /** * This boolean setting controls whether search results are opened in the current tab or in a new tab.*/ export const openSearchResultsInNewTabs: types.Setting; /** * This boolean setting controls whether urlbar results are opened in the current tab or in a new tab.*/ export const openUrlbarResultsInNewTabs: types.Setting; /** * This setting controls whether a light or dark color scheme overrides the page's preferred color scheme.*/ export const overrideContentColorScheme: types.Setting; /** * This setting controls whether the user-chosen colors override the page's colors.*/ export const overrideDocumentColors: types.Setting; /** * This setting controls whether the document's fonts are used.*/ export const useDocumentFonts: types.Setting; /** * This boolean setting controls whether vertical tabs are enabled.*/ export const verticalTabs: types.Setting; /** * Disables webAPI notifications.*/ export const webNotificationsDisabled: types.Setting; /** * This boolean setting controls whether zoom is applied to the full page or to text only.*/ export const zoomFullPage: types.Setting; /** * This boolean setting controls whether zoom is applied on a per-site basis or to the current tab only. If privacy.resistFingerprinting is true, this setting has no effect and zoom is applied to the current tab only.*/ export const zoomSiteSpecific: types.Setting; } namespace browserSettings.colorManagement { /** * This setting controls the mode used for color management and must be a string from {@link browserSettings.ColorManagementMode}*/ export const mode: types.Setting; /** * This boolean setting controls whether or not native sRGB color management is used.*/ export const useNativeSRGB: types.Setting; /** * This boolean setting controls whether or not the WebRender compositor is used.*/ export const useWebRenderCompositor: types.Setting; } namespace browsingData { /** * Options that determine exactly what data will be removed.*/ export interface RemovalOptions { /** * Only remove data associated with this specific cookieStoreId.*/ cookieStoreId?: string; /** * Only remove data associated with these hostnames (only applies to cookies and localStorage).*/ hostnames?: string[]; /** * An object whose properties specify which origin types ought to be cleared. If this object isn't specified, it defaults to clearing only "unprotected" origins. Please ensure that you _really_ want to remove application data before adding 'protectedWeb' or 'extensions'.*/ originTypes?: { /** * Extensions and packaged applications a user has installed (be _really_ careful!).*/ extension?: boolean; /** * Websites that have been installed as hosted applications (be careful!).*/ protectedWeb?: boolean; /** * Normal websites.*/ unprotectedWeb?: boolean; }; /** * Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the `getTime` method of the JavaScript `Date` object). If absent, defaults to 0 (which would remove all browsing data).*/ since?: extensionTypes.Date; } /** * A set of data types. Missing data types are interpreted as `false`.*/ export interface DataTypeSet { /** * The browser's cache. Note: when removing data, this clears the _entire_ cache: it is not limited to the range you specify.*/ cache?: boolean; /** * The browser's cookies.*/ cookies?: boolean; /** * The browser's download list.*/ downloads?: boolean; /** * The browser's stored form data.*/ formData?: boolean; /** * The browser's history.*/ history?: boolean; /** * Websites' IndexedDB data.*/ indexedDB?: boolean; /** * Websites' local storage data.*/ localStorage?: boolean; /** * Stored passwords.*/ passwords?: boolean; /** * Plugins' data.*/ pluginData?: boolean; /** * Server-bound certificates.*/ serverBoundCertificates?: boolean; /** * Service Workers.*/ serviceWorkers?: boolean; } /** * Reports which types of data are currently selected in the 'Clear browsing data' settings UI. Note: some of the data types included in this API are not available in the settings UI, and some UI settings control more than one data type listed here.*/ export function settings(): Promise<{ /** * All of the types will be present in the result, with values of `true` if they are permitted to be removed (e.g., by enterprise policy) and `false` if not.*/ dataRemovalPermitted: DataTypeSet; /** * All of the types will be present in the result, with values of `true` if they are both selected to be removed and permitted to be removed, otherwise `false`.*/ dataToRemove: DataTypeSet; options: RemovalOptions; }>; /** * Clears various types of browsing data stored in a user's profile.*/ export function remove(options: RemovalOptions, /** * The set of data types to remove.*/ dataToRemove: DataTypeSet): Promise; /** * Clears the browser's cache.*/ export function removeCache(options: RemovalOptions): Promise; /** * Clears the browser's cookies and server-bound certificates modified within a particular timeframe.*/ export function removeCookies(options: RemovalOptions): Promise; /** * Clears the browser's list of downloaded files (_not_ the downloaded files themselves).*/ export function removeDownloads(options: RemovalOptions): Promise; /** * Clears the browser's stored form data (autofill).*/ export function removeFormData(options: RemovalOptions): Promise; /** * Clears the browser's history.*/ export function removeHistory(options: RemovalOptions): Promise; /** * Clears websites' local storage data.*/ export function removeLocalStorage(options: RemovalOptions): Promise; /** * Clears plugins' data.*/ export function removePluginData(options: RemovalOptions): Promise; /** * Clears the browser's stored passwords.*/ export function removePasswords(options: RemovalOptions): Promise; } namespace chromeSettingsOverrides { } namespace clipboard { /** * The image data to be copied.*/ export interface SetImageDataImageData { } /** * Copy an image to the clipboard. The image is re-encoded before it is written to the clipboard. If the image is invalid, the clipboard is not modified.*/ export function setImageData(/** * The image data to be copied.*/ imageData: SetImageDataImageData, /** * The type of imageData.*/ imageType: "jpeg" | "png"): Promise; } namespace cloudFile { /** * Information about a cloud file account.*/ export interface CloudFileAccount { /** * If true, the account is configured and ready to use. Only configured accounts are offered to the user.*/ configured: boolean; /** * Unique identifier of the account.*/ id: string; /** * A page for configuring accounts, to be displayed in the preferences UI.*/ managementUrl: string; /** * A user-friendly name for this account.*/ name: string; /** * The amount of remaining space on the cloud provider, in bytes. Set to `-1` if unsupported.*/ spaceRemaining?: number; /** * The amount of space already used on the cloud provider, in bytes. Set to `-1` if unsupported.*/ spaceUsed?: number; /** * The maximum size in bytes for a single file to upload. Set to `-1` if unlimited.*/ uploadSizeLimit?: number; } /** * Defines information to be used in the cloud file entry added to the message.*/ export interface CloudFileTemplateInfo { /** * If set, the cloud file entry for this upload will include a hint, that the link will only be available for a limited time.*/ download_expiry_date?: { /** * A format options object as used by {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat|Intl.DateTimeFormat}.*/ format?: { [key: string]: any; }; /** * The expiry date of the link as the number of milliseconds since the UNIX epoch.*/ timestamp: number; }; /** * If set, the cloud file entry for this upload will include a hint, that the file has a download limit.*/ download_limit?: number; /** * If set to true, the cloud file entry for this upload will include a hint, that the download link is password protected.*/ download_password_protected?: boolean; /** * A URL pointing to an icon to represent the used cloud file service. Defaults to the icon of the provider add-on.*/ service_icon?: string; /** * A name to represent the used cloud file service. Defaults to the associated cloud file account name.*/ service_name?: string; /** * A URL pointing to a web page of the used cloud file service. Will be used in a _Learn more about_ link in the footer of the cloud file attachment element.*/ service_url?: string; } /** * Information about a cloud file.*/ export interface CloudFile { /** * Contents of the file to be transferred.*/ data: { [key: string]: any; }; /** * An identifier for this file.*/ id: number; /** * Filename of the file to be transferred.*/ name: string; } /** * Information about an already uploaded cloud file, which is related to a new upload. For example if the content of a cloud attachment is updated, if a repeatedly used cloud attachment is renamed (and therefore should be re-uploaded to not invalidate existing links) or if the provider has its manifest property `reuse_uploads` set to `false`.*/ export interface RelatedCloudFile { /** * The content of the new upload differs from the related file.*/ dataChanged: boolean; /** * The identifier for the related file. In some circumstances, the id is unavailable.*/ id?: number; /** * Filename of the related file.*/ name: string; /** * Additional information of the related file, used in the cloud file entry added to the message.*/ templateInfo?: CloudFileTemplateInfo; /** * The URL where the upload of the related file can be accessed.*/ url?: string; } /** * Retrieve information about a single cloud file account. Returns `undefined`, if the requested account does not exist.*/ export function getAccount(/** * Unique identifier of the account.*/ accountId: string): Promise; /** * Retrieve all cloud file accounts for the current add-on.*/ export function getAllAccounts(): Promise; export interface UpdateAccountUpdateProperties { /** * If true, the account is configured and ready to use. Only configured accounts are offered to the user.*/ configured?: boolean; /** * A page for configuring accounts, to be displayed in the preferences UI.*/ managementUrl?: string; /** * The amount of remaining space on the cloud provider, in bytes. Set to `-1` if unsupported.*/ spaceRemaining?: number; /** * The amount of space already used on the cloud provider, in bytes. Set to `-1` if unsupported.*/ spaceUsed?: number; /** * The maximum size in bytes for a single file to upload. Set to `-1` if unlimited.*/ uploadSizeLimit?: number; } /** * Update a cloud file account. Returns `undefined`, if the requested account does not exist.*/ export function updateAccount(/** * Unique identifier of the account.*/ accountId: string, updateProperties: UpdateAccountUpdateProperties): Promise; /** * Fired when a file should be uploaded to the cloud file provider.*/ export const onFileUpload: WebExtEvent<(/** * The account used for the file upload.*/ account: CloudFileAccount, /** * The file to upload.*/ fileInfo: CloudFile, /** * The tab where the upload was initiated. Currently only available for the message composer.*/ tab: tabs.Tab, /** * Information about an already uploaded file, which is related to this upload.*/ relatedFileInfo?: RelatedCloudFile) => { /** * Set this to `true` if the file upload was aborted by the user and an {@link cloudFile.onFileUploadAbort} event has been received. No error message will be shown to the user.*/ aborted?: boolean; /** * Report an error to the user. Set this to `true` for showing a generic error message, or set a specific error message.*/ error?: boolean | string; /** * Additional file information used in the cloud file entry added to the message.*/ templateInfo?: CloudFileTemplateInfo; /** * The URL where the uploaded file can be accessed.*/ url?: string; }>; export const onFileUploadAbort: WebExtEvent<(/** * The account used for the file upload.*/ account: CloudFileAccount, /** * An identifier for this file.*/ fileId: number, /** * The tab where the upload was initiated. Currently only available for the message composer.*/ tab: tabs.Tab) => void>; /** * Fired when a previously uploaded file should be renamed.*/ export const onFileRename: WebExtEvent<(/** * The account used for the file upload.*/ account: CloudFileAccount, /** * An identifier for the file which should be renamed.*/ fileId: number, /** * The new name of the file.*/ newName: string, /** * The tab where the rename was initiated. Currently only available for the message composer.*/ tab: tabs.Tab) => { /** * Report an error to the user. Set this to `true` for showing a generic error message, or set a specific error message.*/ error?: boolean | string; /** * The URL where the renamed file can be accessed.*/ url?: string; }>; /** * Fired when a previously uploaded file should be deleted.*/ export const onFileDeleted: WebExtEvent<(/** * The account used for the file upload.*/ account: CloudFileAccount, /** * An identifier for this file.*/ fileId: number, /** * The tab where the upload was initiated. Currently only available for the message composer.*/ tab: tabs.Tab) => void>; /** * Fired when a cloud file account of this add-on was created.*/ export const onAccountAdded: WebExtEvent<(/** * The created account.*/ account: CloudFileAccount) => void>; /** * Fired when a cloud file account of this add-on was deleted.*/ export const onAccountDeleted: WebExtEvent<(/** * The id of the removed account.*/ accountId: string) => void>; } namespace commands { export interface Command { /** * The description of the Extension Command*/ description?: string; /** * The name of the Extension Command*/ name?: string; /** * The shortcut active for this command, or blank if not active.*/ shortcut?: string; } /** * Returns all the registered extension commands for this extension and their shortcut (if active).*/ export function getAll(): Promise; /** * Open extension shortcuts configuration page.*/ export function openShortcutSettings(): Promise; /** * Reset a command's details to what is specified in the manifest.*/ export function reset(/** * The name of the command.*/ name: string): Promise; /** * The new details for the command.*/ export interface UpdateDetail { /** * The description for the command.*/ description?: string; /** * The name of the command.*/ name: string; /** * An empty string to clear the shortcut, or a string matching the format defined by the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/commands#shortcut_values|MDN page of the commands API} to set a new shortcut key. If the string does not match this format, the function throws an error.*/ shortcut?: string; } /** * Update the details of an already defined command.*/ export function update(/** * The new details for the command.*/ detail: UpdateDetail): Promise; /** * Fired when a registered command is activated using a keyboard shortcut. This is a user input event handler. For asynchronous listeners some {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/User_actions|restrictions} apply.*/ export const onCommand: WebExtEvent<(command: string, /** * The details of the active tab while the command occurred.*/ tab: tabs.Tab) => void>; /** * Fired when a registered command's shortcut is changed.*/ export const onChanged: WebExtEvent<(changeInfo: { /** * The name of the shortcut.*/ name: string; /** * The new shortcut active for this command, or blank if not active.*/ newShortcut: string; /** * The old shortcut which is no longer active for this command, or blank if the shortcut was previously inactive.*/ oldShortcut: string; }) => void>; } namespace compose { type ComposeRecipient = string | { /** * The ID of a contact or mailing list from the $(doc:contacts) or $(doc:mailingLists).*/ id: string; /** * Which sort of object this ID is for.*/ type: "contact" | "mailingList"; }; type ComposeRecipientList = ComposeRecipient | ComposeRecipient[]; /** * Represent the state of the message composer.*/ export interface ComposeState { /** * The message can be send later.*/ canSendLater: boolean; /** * The message can be send now.*/ canSendNow: boolean; } /** * Used by various functions to represent the state of a message being composed. Note that functions using this type may have a partial implementation.*/ export interface ComposeDetails { /** * An additional fcc folder which can be selected while composing the message, an empty string if not used. Has no effect when the message is saved as a draft or template; the additional copy is only created when the message is actually sent or queued for sending. The permission accountsRead is required to use this property.*/ additionalFccFolder?: folders.MailFolder | ("") | folders.MailFolderId; /** * Whether the public OpenPGP key of the sending identity should be attached to the message.*/ attachPublicPGPKey?: boolean; /** * Whether or not the vCard of the used identity will be attached to the message during send.*/ attachVCard?: boolean; /** * Only used in the begin* functions. Attachments to add to the message.*/ attachments?: (FileAttachment | ComposeAttachment)[]; bcc?: ComposeRecipientList; /** * The HTML content of the message.*/ body?: string; cc?: ComposeRecipientList; /** * Array of custom headers. Headers will be returned in _Http-Header-Case_ (a.k.a. _Train-Case_). Set an empty array to clear all custom headers.*/ customHeaders?: CustomHeader[]; /** * Defines the MIME format of the sent message (ignored on plain text messages). Defaults to `auto`, which will send html messages as plain text, if they do not include any formatting, and as `both` otherwise (a multipart/mixed message).*/ deliveryFormat?: "auto" | "plaintext" | "html" | "both"; /** * Let the sender know when the recipient's server received the message. Not supported by all servers.*/ deliveryStatusNotification?: boolean; followupTo?: ComposeRecipientList; /** * *Caution*: Setting a value for `from` does not change the used identity, it overrides the _From_ header. Many email servers do not accept emails where the _From_ header does not match the sender identity. Must be set to exactly one valid email address.*/ from?: ComposeRecipient; /** * The ID of an identity from the $(doc:accounts). The settings from the identity will be used in the composed message. If `replyTo` is also specified, the `replyTo` property of the identity is overridden. The permission accountsRead is required to include the `identityId`.*/ identityId?: string; /** * Whether the composer is considered modified by the user. A modified composer asks for confirmation, when it is closed.*/ isModified?: boolean; /** * Whether the message is an HTML message or a plain text message.*/ isPlainText?: boolean; /** * A single newsgroup name or an array of newsgroup names.*/ newsgroups?: string | string[]; /** * Indicates whether the default fcc setting (defined by the used identity) is being overridden for this message. Setting `false` will clear the override. Setting `true` will throw an _ExtensionError_, if `overrideDefaultFccFolder` is not set as well. The permission accountsRead is required to use this property.*/ overrideDefaultFcc?: boolean; /** * This value overrides the default fcc setting (defined by the used identity) for this message only. Either a {@link folders.MailFolder} specifying the folder for the copy of the sent message, or an empty string to not save a copy at all. The permission accountsRead is required to use this property.*/ overrideDefaultFccFolder?: folders.MailFolder | ("") | folders.MailFolderId; /** * The plain text content of the message.*/ plainTextBody?: string; /** * The priority of the message.*/ priority?: "lowest" | "low" | "normal" | "high" | "highest"; /** * The id of the original message (in case of draft, template, forward or reply). Read-only. Is `undefined` in all other cases or if the original message was opened from file. The messagesRead permission is required to use this property.*/ relatedMessageId?: messages.MessageId; replyTo?: ComposeRecipientList; /** * Add the _Disposition-Notification-To_ header to the message to requests the recipients email client to send a reply once the message has been received. Recipient server may strip the header and the recipient might ignore the request.*/ returnReceipt?: boolean; /** * The selected encryption technology (`OpenPGP` or `S/MIME`) which is to be used to sign and/or encrypt the message. If the sending identity does not support encryption at all, this will be `undefined`.*/ selectedEncryptionTechnology?: compose.EncryptionPropertiesSMIME | compose.EncryptionPropertiesOpenPGP; subject?: string; to?: ComposeRecipientList; /** * Read-only. The type of the message being composed, depending on how the compose window was opened by the user.*/ type?: "draft" | "new" | "redirect" | "reply" | "forward"; } /** * Object used to add, update or rename an attachment in a message being composed.*/ export interface FileAttachment { /** * The new content for the attachment.*/ file?: { [key: string]: any; }; /** * The new name for the attachment, as displayed to the user. If not specified, the name of the provided `file` object is used.*/ name?: string; } /** * Represents an attachment in a message being composed.*/ export interface ComposeAttachment { /** * A unique identifier for this attachment.*/ id: number; /** * The name of this attachment, as displayed to the user.*/ name?: string; /** * The size in bytes of this attachment. Read-only.*/ size?: number; } /** * A custom header definition.*/ export interface CustomHeader { /** * Name of a custom header, must be prefixed by `X-` (but not by `X-Mozilla-`) or be one of the explicitly allowed headers (`MSIP_Labels`)*/ name: string; value: string; } /** * A _dictionary object_ with entries for all installed dictionaries, having a language identifier as _key_ (for example `en-US`) and a boolean expression as _value_, indicating whether that dictionary is enabled for spellchecking or not.*/ export interface ComposeDictionaries { } export interface EncryptionPropertiesOpenPGP { /** * Whether encryption of the message body using the OpenPGP technology is enabled.*/ encryptBody: boolean; /** * Whether encryption of the message subject using the OpenPGP technology is enabled (only supported if encryption of the body is enabled a well).*/ encryptSubject: boolean; name: string; /** * Whether the message will be signed using the OpenPGP technology.*/ signMessage: boolean; } export interface EncryptionPropertiesSMIME { /** * Whether encryption of the message body using the S/MIME technology is enabled.*/ encryptBody: boolean; name: string; /** * Whether the message will be signed using the S/MIME technology*/ signMessage: boolean; } /** * Open a new message compose window.*/ export function beginNew(/** * If specified, the message or template to edit as a new message.*/ messageId?: messages.MessageId, details?: ComposeDetails): Promise; /** * Open a new message compose window replying to a given message.*/ export function beginReply(/** * The message to reply to, as retrieved using other APIs.*/ messageId: messages.MessageId, replyType?: "replyToSender" | "replyToList" | "replyToAll", details?: ComposeDetails): Promise; /** * Open a new message compose window forwarding a given message.*/ export function beginForward(/** * The message to forward, as retrieved using other APIs.*/ messageId: messages.MessageId, forwardType?: "forwardInline" | "forwardAsAttachment", details?: ComposeDetails): Promise; /** * Fetches the current state of a compose window. Currently only a limited amount of information is available, more will be added in later versions.*/ export function getComposeDetails(tabId: number): Promise; /** * Updates the compose window. The properties of the given {@link compose.ComposeDetails} object will be used to overwrite the current values of the specified compose window, so only properties that are to be changed should be included. Modified settings will be treated as user initiated, and turn off further automatic changes on these settings.*/ export function setComposeDetails(tabId: number, details: ComposeDetails): Promise; /** * Returns a {@link compose.ComposeDictionaries} object, listing all installed dictionaries, including the information whether they are currently enabled or not.*/ export function getActiveDictionaries(tabId: number): Promise; /** * Updates the active dictionaries. Throws if the `activeDictionaries` array contains unknown or invalid language identifiers.*/ export function setActiveDictionaries(tabId: number, activeDictionaries: string[]): Promise; /** * Lists all of the attachments of the message being composed in the specified tab.*/ export function listAttachments(tabId: number): Promise; /** * Gets the content of a {@link compose.ComposeAttachment} as a {@link https://developer.mozilla.org/en-US/docs/Web/API/File|File} object.*/ export function getAttachmentFile(/** * The unique identifier for the attachment.*/ id: number): Promise<{ [key: string]: any; }>; /** * Adds an attachment to the message being composed in the specified tab.*/ export function addAttachment(tabId: number, attachment: FileAttachment | ComposeAttachment): Promise; /** * Updates the name and/or the content of an attachment in the message being composed in the specified tab. If the specified attachment is a cloud file attachment and the associated provider failed to update the attachment, the function will throw an _ExtensionError_.*/ export function updateAttachment(tabId: number, attachmentId: number, attachment: FileAttachment): Promise; /** * Removes an attachment from the message being composed in the specified tab.*/ export function removeAttachment(tabId: number, attachmentId: number): Promise; export interface SendMessageOptions { mode: "default" | "sendNow" | "sendLater"; } /** * Sends the message currently being composed. If the send mode is not specified or set to `default`, the message will be send directly if the user is online and placed in the users outbox otherwise. The returned Promise fulfills once the message has been successfully sent or placed in the user's outbox. Throws when the send process has been aborted by the user, by an {@link compose.onBeforeSend} event or if there has been an error while sending the message to the outgoing mail server.*/ export function sendMessage(tabId: number, options?: SendMessageOptions): Promise<{ /** * The header messageId of the outgoing message. Only included for actually sent messages.*/ headerMessageId?: string; /** * Copies of the sent message. The number of created copies depends on the applied file carbon copy configuration (fcc).*/ messages: messages.MessageHeader[]; /** * The used send mode.*/ mode: "sendNow" | "sendLater"; }>; export interface SaveMessageOptions { mode: "draft" | "template"; } /** * Saves the message currently being composed as a draft or as a template. If the save mode is not specified, the message will be saved as a draft. The returned Promise fulfills once the message has been successfully saved.*/ export function saveMessage(tabId: number, options?: SaveMessageOptions): Promise<{ /** * An array with exactly one element, the saved message.*/ messages: messages.MessageHeader[]; /** * The used save mode.*/ mode: "draft" | "template"; }>; /** * Returns information about the current state of the message composer.*/ export function getComposeState(tabId: number): Promise; /** * Fired when a message is about to be sent from the compose window. This is a user input event handler. For asynchronous listeners some {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/User_actions|restrictions} apply.*/ export const onBeforeSend: WebExtEvent<(tab: tabs.Tab, /** * The current state of the compose window. This is functionally the same as calling the {@link compose.getComposeDetails} function.*/ details: ComposeDetails) => { /** * Cancels the send.*/ cancel?: boolean; /** * Updates the compose window. This is functionally the same as calling the {@link compose.setComposeDetails} function.*/ details?: ComposeDetails; }>; /** * Fired when sending a message succeeded or failed.*/ export const onAfterSend: WebExtEvent<(/** * The tab of the associated compose window. By the time the event listener is called, this window may have already been destroyed.*/ tab: tabs.Tab, sendInfo: { /** * The {@link compose.ComposeDetails} of the send message.*/ details: ComposeDetails; /** * An error description, if sending the message failed.*/ error?: string; /** * The header messageId of the outgoing message. Only included for actually sent messages.*/ headerMessageId?: string; /** * Copies of the sent message. The number of created copies depends on the applied file carbon copy configuration (fcc). The messagesRead permission is required for this property to be included.*/ messages: messages.MessageHeader[]; /** * The used send mode.*/ mode: "sendNow" | "sendLater"; }) => void>; /** * Fired when saving a message as draft or template succeeded or failed.*/ export const onAfterSave: WebExtEvent<(tab: tabs.Tab, saveInfo: { /** * The {@link compose.ComposeDetails} of the saved message.*/ details: ComposeDetails; /** * An error description, if saving the message failed.*/ error?: string; /** * An array with exactly one element, the saved message. The messagesRead permission is required for this property to be included.*/ messages: messages.MessageHeader[]; /** * The used save mode.*/ mode: "autoSave" | "draft" | "template"; }) => void>; /** * Fired when an attachment is added to a message being composed.*/ export const onAttachmentAdded: WebExtEvent<(tab: tabs.Tab, attachment: ComposeAttachment) => void>; /** * Fired when an attachment is removed from a message being composed.*/ export const onAttachmentRemoved: WebExtEvent<(tab: tabs.Tab, attachmentId: number) => void>; /** * Fired when the user changes the identity that will be used to send a message being composed.*/ export const onIdentityChanged: WebExtEvent<(tab: tabs.Tab, identityId: string) => void>; /** * Fired when the state of the message composer changed.*/ export const onComposeStateChanged: WebExtEvent<(tab: tabs.Tab, state: ComposeState) => void>; /** * Fired when one or more dictionaries have been activated or deactivated.*/ export const onActiveDictionariesChanged: WebExtEvent<(tab: tabs.Tab, dictionaries: ComposeDictionaries) => void>; } namespace composeAction { /** * An array of four integers in the range [0,255] that make up the RGBA color. For example, opaque red is `[255, 0, 0, 255]`.*/ type ColorArray = number[]; /** * Pixel data for an image. Must be an {@link https://developer.mozilla.org/en-US/docs/Web/API/ImageData|ImageData} object (for example, from a {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/canvas|canvas} element).*/ export interface ImageDataType { } /** * A _dictionary object_ to specify multiple {@link https://developer.mozilla.org/en-US/docs/Web/API/ImageData|ImageData} objects in different sizes, so the icon does not have to be scaled for a device with a different pixel density. Each entry is a _name-value_ pair with _value_ being an {@link https://developer.mozilla.org/en-US/docs/Web/API/ImageData|ImageData} object, and _name_ its size.*/ export interface ImageDataDictionary { [key: string]: ImageDataType; } /** * Information sent when a composeAction button is clicked.*/ export interface OnClickData { /** * An integer value of button by which menu item was clicked.*/ button?: number; /** * An array of keyboard modifiers that were held while the menu item was clicked.*/ modifiers: ("Shift" | "Alt" | "Command" | "Ctrl" | "MacCtrl")[]; } export interface SetTitleDetails { /** * Sets the title only for the given tab.*/ tabId?: number; /** * A string the composeAction button should display as its label and when moused over. Cleared by setting it to `null` or an empty string (title defined the manifest will be used).*/ title: string | null; } /** * Sets the title of the composeAction button. Is used as tooltip and as the label.*/ export function setTitle(details: SetTitleDetails): Promise; export interface GetTitleDetails { /** * Specifies for which tab the title should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the title of the composeAction button.*/ export function getTitle(details: GetTitleDetails): Promise; export interface SetLabelDetails { /** * A string the composeAction button should use as its label, overriding the defined title. Can be set to an empty string to not display any label at all. If the containing toolbar is configured to display text only, its title will be used. Cleared by setting it to `null`.*/ label: string | null; /** * Sets the label only for the given tab.*/ tabId?: number; } /** * Sets the label of the composeAction button. Can be used to set different values for the tooltip (defined by the title) and the label. Additionally, the label can be set to an empty string, not showing any label at all.*/ export function setLabel(details: SetLabelDetails): Promise; export interface GetLabelDetails { /** * Specifies for which tab the label should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the label of the composeAction button. Returns `null`, if no label has been set and the title is used.*/ export function getLabel(details: GetLabelDetails): Promise; export interface SetIconDetails { /** * The image data for one or more icons for the composeAction button.*/ imageData?: ImageDataType | ImageDataDictionary; /** * The paths to one or more icons for the composeAction button.*/ path?: manifest.IconPath; /** * Sets the icon only for the given tab.*/ tabId?: number; } /** * Sets the icon for the composeAction button. Either the `path` or the `imageData` property must be specified.*/ export function setIcon(details: SetIconDetails): Promise; export interface SetPopupDetails { /** * The html file to show in a popup. Can be set to an empty string to not open a popup. Cleared by setting it to `null` (action will use the popup value defined in the manifest).*/ popup: string | null; /** * Sets the popup only for the given tab.*/ tabId?: number; } /** * Sets the html document to be opened as a popup when the user clicks on the composeAction button.*/ export function setPopup(details: SetPopupDetails): Promise; export interface GetPopupDetails { /** * Specifies for which tab the popup document should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the html document set as the popup for this composeAction button.*/ export function getPopup(details: GetPopupDetails): Promise; export interface SetBadgeTextDetails { /** * Sets the badge text only for the given tab.*/ tabId?: number; /** * Any number of characters can be passed, but only about four can fit in the space. Cleared by setting it to `null` or an empty string.*/ text: string | null; } /** * Sets the badge text for the composeAction button. The badge is displayed on top of the icon.*/ export function setBadgeText(details: SetBadgeTextDetails): Promise; export interface GetBadgeTextDetails { /** * Specifies for which tab the badge text should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the badge text of the composeAction button.*/ export function getBadgeText(details: GetBadgeTextDetails): Promise; export interface SetBadgeTextColorDetails { /** * The color to use as text color in the badge. Cleared by setting it to `null`.*/ color: string | ColorArray | null; /** * Sets the text color for the badge only for the given tab.*/ tabId?: number; } /** * Sets the text color for the badge.*/ export function setBadgeTextColor(details: SetBadgeTextColorDetails): Promise; export interface GetBadgeTextColorDetails { /** * Specifies for which tab the badge text color should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the text color of the badge.*/ export function getBadgeTextColor(details: GetBadgeTextColorDetails): Promise; export interface SetBadgeBackgroundColorDetails { /** * The color to use as background in the badge. Cleared by setting it to `null`.*/ color: string | ColorArray | null; /** * Sets the background color for the badge only for the given tab.*/ tabId?: number; } /** * Sets the background color for the badge.*/ export function setBadgeBackgroundColor(details: SetBadgeBackgroundColorDetails): Promise; export interface GetBadgeBackgroundColorDetails { /** * Specifies for which tab the badge background color should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the badge background color of the composeAction button.*/ export function getBadgeBackgroundColor(details: GetBadgeBackgroundColorDetails): Promise; /** * Enables the composeAction button for a specific tab (if a `tabId` is provided), or for all tabs which do not have a custom enable state. Once the enable state of a tab has been updated individually, all further changes to its state have to be done individually as well. By default, a composeAction button is enabled.*/ export function enable(/** * The id of the tab for which you want to modify the composeAction button.*/ tabId?: number): Promise; /** * Disables the composeAction button for a specific tab (if a `tabId` is provided), or for all tabs which do not have a custom enable state. Once the enable state of a tab has been updated individually, all further changes to its state have to be done individually as well.*/ export function disable(/** * The id of the tab for which you want to modify the composeAction button.*/ tabId?: number): Promise; export interface IsEnabledDetails { /** * Specifies for which tab the state should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Checks whether the composeAction button is enabled.*/ export function isEnabled(details: IsEnabledDetails): Promise; /** * An object with information about the popup to open.*/ export interface OpenPopupOptions { /** * Defaults to the current window.*/ windowId?: number; } /** * Opens the action's popup window in the specified window. Defaults to the current window. Returns false if the popup could not be opened because the action has no popup, is of type `menu`, is disabled or has been removed from the toolbar.*/ export function openPopup(/** * An object with information about the popup to open.*/ options?: OpenPopupOptions): Promise; /** * Fired when a composeAction button is clicked. This event will not fire if the composeAction has a popup. This is a user input event handler. For asynchronous listeners some {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/User_actions|restrictions} apply.*/ export const onClicked: WebExtEvent<(tab: tabs.Tab, info?: OnClickData) => void>; } namespace contentScripts { /** * Details of a content script registered programmatically*/ export interface RegisteredContentScriptOptions { /** * If allFrames is `true`, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's `false` and is only injected into the top frame.*/ allFrames?: boolean; /** * limit the set of matched tabs to those that belong to the given cookie store id*/ cookieStoreId?: string[] | string; /** * The list of CSS files to inject*/ css?: extensionTypes.ExtensionFileOrCode[]; /** * The css origin of the stylesheet to inject. Defaults to "author".*/ cssOrigin?: extensionTypes.CSSOrigin; excludeGlobs?: string[]; excludeMatches?: manifest.MatchPattern[]; includeGlobs?: string[]; /** * The list of JS files to inject*/ js?: extensionTypes.ExtensionFileOrCode[]; /** * If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Ignored if matchOriginAsFallback is specified. By default it is `false`.*/ matchAboutBlank?: boolean; /** * If matchOriginAsFallback is true, then the code is also injected in about:, data:, blob: when their origin matches the pattern in 'matches', even if the actual document origin is opaque (due to the use of CSP sandbox or iframe sandbox). Match patterns in 'matches' must specify a wildcard path glob. By default it is `false`.*/ matchOriginAsFallback?: boolean; matches: manifest.MatchPattern[]; /** * The soonest that the JavaScript or CSS will be injected into the tab. Defaults to "document_idle".*/ runAt?: extensionTypes.RunAt; /** * The JavaScript world for a script to execute within. Defaults to "ISOLATED".*/ world?: extensionTypes.ExecutionWorld; } /** * An object that represents a content script registered programmatically*/ export interface RegisteredContentScript { /** * Unregister a content script registered programmatically*/ unregister(): Promise; } /** * Register a content script programmatically*/ export function register(contentScriptOptions: RegisteredContentScriptOptions): Promise; } namespace contextualIdentities { /** * Represents information about a contextual identity.*/ export interface ContextualIdentity { /** * The color name of the contextual identity.*/ color: string; /** * The color hash of the contextual identity.*/ colorCode: string; /** * The cookie store ID of the contextual identity.*/ cookieStoreId: string; /** * The icon name of the contextual identity.*/ icon: string; /** * The icon url of the contextual identity.*/ iconUrl: string; /** * The name of the contextual identity.*/ name: string; } /** * Represents the association between a site and a contextual identity.*/ export interface SiteAssociation { /** * The cookie store ID of the contextual identity the host is associated with.*/ cookieStoreId: string; /** * The associated host, normalized to lower case and encoded as ASCII.*/ site: string; } /** * Retrieves information about a single contextual identity.*/ export function get(/** * The ID of the contextual identity cookie store.*/ cookieStoreId: string): Promise; /** * Information to filter the contextual identities being retrieved.*/ export interface QueryDetails { /** * Filters the contextual identity by name.*/ name?: string; } /** * Retrieves all contextual identities*/ export function query(/** * Information to filter the contextual identities being retrieved.*/ details: QueryDetails): Promise; /** * Retrieves the list of colors supported by contextual identities.*/ export function getSupportedColors(): Promise<{ /** * The color name, as accepted by the color property of create and update.*/ color: string; /** * The color hash for this color name.*/ colorCode: string; }[]>; /** * Retrieves the list of icons supported by contextual identities.*/ export function getSupportedIcons(): Promise<{ /** * The icon name, as accepted by the icon property of create and update.*/ icon: string; /** * The icon url for this icon name.*/ iconUrl: string; }[]>; /** * Details about the contextual identity being created.*/ export interface CreateDetails { /** * The color of the contextual identity.*/ color: string; /** * The icon of the contextual identity.*/ icon: string; /** * The name of the contextual identity.*/ name: string; } /** * Creates a contextual identity with the given data.*/ export function create(/** * Details about the contextual identity being created.*/ details: CreateDetails): Promise; /** * Details about the contextual identity being created.*/ export interface UpdateDetails { /** * The color of the contextual identity.*/ color?: string; /** * The icon of the contextual identity.*/ icon?: string; /** * The name of the contextual identity.*/ name?: string; } /** * Updates a contextual identity with the given data.*/ export function update(/** * The ID of the contextual identity cookie store.*/ cookieStoreId: string, /** * Details about the contextual identity being created.*/ details: UpdateDetails): Promise; /** * Reorder one or more contextual identities by their cookieStoreIDs to a given position.*/ export function move(/** * The ID or list of IDs of the contextual identity cookie stores.*/ cookieStoreIds: string | string[], /** * The position the contextual identity should move to.*/ position: number): Promise; /** * Deletes a contextual identity by its cookie Store ID.*/ export function remove(/** * The ID of the contextual identity cookie store.*/ cookieStoreId: string): Promise; /** * Details about the site association.*/ export interface SetSiteAssociationDetails { /** * The cookie store ID of the container to associate the site with.*/ cookieStoreId: string; /** * The host to associate with the container (matched as an exact host).*/ site: string; } /** * Associates a site with a container. Top-level navigations to that site will load in the given container.*/ export function setSiteAssociation(/** * Details about the site association.*/ details: SetSiteAssociationDetails): Promise; /** * Details about the site association to remove.*/ export interface RemoveSiteAssociationDetails { /** * The host whose container association should be removed.*/ site: string; } /** * Removes the container association for a site.*/ export function removeSiteAssociation(/** * Details about the site association to remove.*/ details: RemoveSiteAssociationDetails): Promise; /** * Details about the site to look up.*/ export interface GetSiteAssociationDetails { /** * The host to look up.*/ site: string; } /** * Retrieves the association of a site, or null if the site is not associated with any container.*/ export function getSiteAssociation(/** * Details about the site to look up.*/ details: GetSiteAssociationDetails): Promise; /** * Information to filter the associations being retrieved.*/ export interface QuerySiteAssociationsDetails { /** * If provided, only associations for this container are returned.*/ cookieStoreId?: string; } /** * Retrieves the list of site-to-container associations.*/ export function querySiteAssociations(/** * Information to filter the associations being retrieved.*/ details: QuerySiteAssociationsDetails): Promise; /** * Fired when a container is updated.*/ export const onUpdated: WebExtEvent<(changeInfo: { /** * Contextual identity that has been updated*/ contextualIdentity: ContextualIdentity; }) => void>; /** * Fired when a new container is created.*/ export const onCreated: WebExtEvent<(changeInfo: { /** * Contextual identity that has been created*/ contextualIdentity: ContextualIdentity; }) => void>; /** * Fired when a container is removed.*/ export const onRemoved: WebExtEvent<(changeInfo: { /** * Contextual identity that has been removed*/ contextualIdentity: ContextualIdentity; }) => void>; /** * Fired when a site-to-container association is added, changed, or removed.*/ export const onSiteAssociationChanged: WebExtEvent<(changeInfo: { /** * The cookie store ID of the now-associated container, or omitted if the association was removed.*/ cookieStoreId?: string; /** * The host whose association changed.*/ site: string; }) => void>; } namespace cookies { /** * A cookie's 'SameSite' state (https://tools.ietf.org/html/draft-west-first-party-cookies). 'no_restriction' corresponds to a cookie set without a 'SameSite' attribute, 'lax' to 'SameSite=Lax', and 'strict' to 'SameSite=Strict'.*/ export type SameSiteStatus = "unspecified" | "no_restriction" | "lax" | "strict"; /** * The description of the storage partition of a cookie. This object may be omitted (null) if a cookie is not partitioned.*/ export interface PartitionKey { /** * Whether or not the cookie is in a third-party context, respecting ancestor chains.*/ hasCrossSiteAncestor?: boolean; /** * The first-party URL of the cookie, if the cookie is in storage partitioned by the top-level site.*/ topLevelSite?: string; } /** * Represents information about an HTTP cookie.*/ export interface Cookie { /** * The domain of the cookie (e.g. "www.google.com", "example.com").*/ domain: string; /** * The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.*/ expirationDate?: number; /** * The first-party domain of the cookie.*/ firstPartyDomain: string; /** * True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie).*/ hostOnly: boolean; /** * True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts).*/ httpOnly: boolean; /** * The name of the cookie.*/ name: string; /** * The cookie's storage partition, if any. null if not partitioned.*/ partitionKey?: PartitionKey; /** * The path of the cookie.*/ path: string; /** * The cookie's same-site status (i.e. whether the cookie is sent with cross-site requests).*/ sameSite: SameSiteStatus; /** * True if the cookie is marked as Secure (i.e. its scope is limited to secure channels, typically HTTPS).*/ secure: boolean; /** * True if the cookie is a session cookie, as opposed to a persistent cookie with an expiration date.*/ session: boolean; /** * The ID of the cookie store containing this cookie, as provided in getAllCookieStores().*/ storeId: string; /** * The value of the cookie.*/ value: string; } /** * Represents a cookie store in the browser. An incognito mode window, for instance, uses a separate cookie store from a non-incognito window.*/ export interface CookieStore { /** * The unique identifier for the cookie store.*/ id: string; /** * Indicates if this is an incognito cookie store*/ incognito: boolean; /** * Identifiers of all the browser tabs that share this cookie store.*/ tabIds: number[]; } /** * The underlying reason behind the cookie's change. If a cookie was inserted, or removed via an explicit call to {@link cookies.remove}, "cause" will be "explicit". If a cookie was automatically removed due to expiry, "cause" will be "expired". If a cookie was removed due to being overwritten with an already-expired expiration date, "cause" will be set to "expired_overwrite". If a cookie was automatically removed due to garbage collection, "cause" will be "evicted". If a cookie was automatically removed due to a "set" call that overwrote it, "cause" will be "overwrite". Plan your response accordingly.*/ export type OnChangedCause = "evicted" | "expired" | "explicit" | "expired_overwrite" | "overwrite"; /** * Details to identify the cookie being retrieved.*/ export interface GetDetails { /** * The first-party domain which the cookie to retrieve is associated. This attribute is required if First-Party Isolation is enabled.*/ firstPartyDomain?: string; /** * The name of the cookie to retrieve.*/ name: string; /** * The storage partition, if the cookie is part of partitioned storage. By default, only non-partitioned cookies are returned.*/ partitionKey?: PartitionKey; /** * The ID of the cookie store in which to look for the cookie. By default, the current execution context's cookie store will be used.*/ storeId?: string; /** * The URL with which the cookie to retrieve is associated. This argument may be a full URL, in which case any data following the URL path (e.g. the query string) is simply ignored. If host permissions for this URL are not specified in the manifest file, the API call will fail.*/ url: string; } /** * Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, the one with the longest path will be returned. For cookies with the same path length, the cookie with the earliest creation time will be returned.*/ export function get(/** * Details to identify the cookie being retrieved.*/ details: GetDetails): Promise; /** * Information to filter the cookies being retrieved.*/ export interface GetAllDetails { /** * Restricts the retrieved cookies to those whose domains match or are subdomains of this one.*/ domain?: string; /** * Restricts the retrieved cookies to those whose first-party domains match this one. This attribute is required if First-Party Isolation is enabled. To not filter by a specific first-party domain, use null or undefined.*/ firstPartyDomain?: string; /** * Filters the cookies by name.*/ name?: string; /** * Selects a specific storage partition to look up cookies. Defaults to null, in which case only non-partitioned cookies are retrieved. If an object iis passed, partitioned cookies are also included, and filtered based on the keys present in the given PartitionKey description. An empty object ({}) returns all cookies (partitioned + unpartitioned), a non-empty object (e.g. {topLevelSite: '...'}) only returns cookies whose partition match all given attributes.*/ partitionKey?: PartitionKey; /** * Restricts the retrieved cookies to those whose path exactly matches this string.*/ path?: string; /** * Filters the cookies by their Secure property.*/ secure?: boolean; /** * Filters out session vs. persistent cookies.*/ session?: boolean; /** * The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used.*/ storeId?: string; /** * Restricts the retrieved cookies to those that would match the given URL.*/ url?: string; } /** * Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, with those with the longest path first. If multiple cookies have the same path length, those with the earliest creation time will be first.*/ export function getAll(/** * Information to filter the cookies being retrieved.*/ details: GetAllDetails): Promise; /** * Details about the cookie being set.*/ export interface SetDetails { /** * The domain of the cookie. If omitted, the cookie becomes a host-only cookie.*/ domain?: string; /** * The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie.*/ expirationDate?: number; /** * The first-party domain of the cookie. This attribute is required if First-Party Isolation is enabled.*/ firstPartyDomain?: string; /** * Whether the cookie should be marked as HttpOnly. Defaults to false.*/ httpOnly?: boolean; /** * The name of the cookie. Empty by default if omitted.*/ name?: string; /** * The storage partition, if the cookie is part of partitioned storage. By default, non-partitioned storage is used.*/ partitionKey?: PartitionKey; /** * The path of the cookie. Defaults to the path portion of the url parameter.*/ path?: string; /** * The cookie's same-site status.*/ sameSite?: SameSiteStatus; /** * Whether the cookie should be marked as Secure. Defaults to false.*/ secure?: boolean; /** * The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's cookie store.*/ storeId?: string; /** * The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail.*/ url: string; /** * The value of the cookie. Empty by default if omitted.*/ value?: string; } /** * Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.*/ export function set(/** * Details about the cookie being set.*/ details: SetDetails): Promise; /** * Information to identify the cookie to remove.*/ export interface RemoveDetails { /** * The first-party domain associated with the cookie. This attribute is required if First-Party Isolation is enabled.*/ firstPartyDomain?: string; /** * The name of the cookie to remove.*/ name: string; /** * The storage partition, if the cookie is part of partitioned storage. By default, non-partitioned storage is used.*/ partitionKey?: PartitionKey; /** * The ID of the cookie store to look in for the cookie. If unspecified, the cookie is looked for by default in the current execution context's cookie store.*/ storeId?: string; /** * The URL associated with the cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail.*/ url: string; } /** * Deletes a cookie by name.*/ export function remove(/** * Information to identify the cookie to remove.*/ details: RemoveDetails): Promise<{ /** * The first-party domain associated with the cookie that's been removed.*/ firstPartyDomain: string; /** * The name of the cookie that's been removed.*/ name: string; /** * The storage partition, if the cookie is part of partitioned storage. null if not partitioned.*/ partitionKey?: PartitionKey; /** * The ID of the cookie store from which the cookie was removed.*/ storeId: string; /** * The URL associated with the cookie that's been removed.*/ url: string; }>; /** * Lists all existing cookie stores.*/ export function getAllCookieStores(): Promise; /** * Fired when a cookie is set or removed. As a special case, note that updating a cookie's properties is implemented as a two step process: the cookie to be updated is first removed entirely, generating a notification with "cause" of "overwrite" . Afterwards, a new cookie is written with the updated values, generating a second notification with "cause" "explicit".*/ export const onChanged: WebExtEvent<(changeInfo: { /** * The underlying reason behind the cookie's change.*/ cause: OnChangedCause; /** * Information about the cookie that was set or removed.*/ cookie: Cookie; /** * True if a cookie was removed.*/ removed: boolean; }) => void>; } namespace declarativeNetRequest { /** * How the requested resource will be used. Comparable to the webRequest.ResourceType type. object_subrequest is unsupported.*/ export type ResourceType = "main_frame" | "sub_frame" | "stylesheet" | "script" | "image" | "object" | "object_subrequest" | "xmlhttprequest" | "xslt" | "ping" | "beacon" | "xml_dtd" | "font" | "media" | "websocket" | "csp_report" | "imageset" | "web_manifest" | "speculative" | "json" | "other"; /** * Describes the reason why a given regular expression isn't supported.*/ export type UnsupportedRegexReason = "syntaxError" | "memoryLimitExceeded"; export interface MatchedRule { /** * ID of the extension, if this rule belongs to a different extension.*/ extensionId?: string; /** * A matching rule's ID.*/ ruleId: number; /** * ID of the Ruleset this rule belongs to.*/ rulesetId: string; } /** * Describes the type of the Rule.action.redirect.transform property.*/ export interface URLTransform { /** * The new fragment for the request. Should be either empty, in which case the existing fragment is cleared; or should begin with '#'.*/ fragment?: string; /** * The new host name for the request.*/ host?: string; /** * The new password for the request.*/ password?: string; /** * The new path for the request. If empty, the existing path is cleared.*/ path?: string; /** * The new port for the request. If empty, the existing port is cleared.*/ port?: string; /** * The new query for the request. Should be either empty, in which case the existing query is cleared; or should begin with '?'. Cannot be specified if 'queryTransform' is specified.*/ query?: string; /** * Add, remove or replace query key-value pairs. Cannot be specified if 'query' is specified.*/ queryTransform?: { /** * The list of query key-value pairs to be added or replaced.*/ addOrReplaceParams?: { key: string; /** * If true, the query key is replaced only if it's already present. Otherwise, the key is also added if it's missing.*/ replaceOnly?: boolean; value: string; }[]; /** * The list of query keys to be removed.*/ removeParams?: string[]; }; /** * The new scheme for the request.*/ scheme?: "http" | "https" | "moz-extension"; /** * The new username for the request.*/ username?: string; } export interface Rule { /** * The action to take if this rule is matched.*/ action: { /** * Describes how the redirect should be performed. Only valid when type is 'redirect'.*/ redirect?: { /** * Path relative to the extension directory. Should start with '/'.*/ extensionPath?: string; /** * Substitution pattern for rules which specify a 'regexFilter'. The first match of regexFilter within the url will be replaced with this pattern. Within regexSubstitution, backslash-escaped digits (\1 to \9) can be used to insert the corresponding capture groups. \0 refers to the entire matching text.*/ regexSubstitution?: string; /** * Url transformations to perform.*/ transform?: URLTransform; /** * The redirect url. Redirects to JavaScript urls are not allowed.*/ url?: string; }; /** * The request headers to modify for the request. Only valid when type is 'modifyHeaders'.*/ requestHeaders?: { /** * The name of the request header to be modified.*/ header: string; /** * The operation to be performed on a header.*/ operation: "append" | "set" | "remove"; /** * The new value for the header. Must be specified for the 'append' and 'set' operations.*/ value?: string; }[]; /** * The response headers to modify for the request. Only valid when type is 'modifyHeaders'.*/ responseHeaders?: { /** * The name of the response header to be modified.*/ header: string; /** * The operation to be performed on a header.*/ operation: "append" | "set" | "remove"; /** * The new value for the header. Must be specified for the 'append' and 'set' operations.*/ value?: string; }[]; type: "block" | "redirect" | "allow" | "upgradeScheme" | "modifyHeaders" | "allowAllRequests"; }; /** * The condition under which this rule is triggered.*/ condition: { /** * Specifies whether the network request is first-party or third-party to the domain from which it originated. If omitted, all requests are matched.*/ domainType?: "firstParty" | "thirdParty"; /** * The rule will not match network requests originating from the list of 'initiatorDomains'. If the list is empty or omitted, no domains are excluded. This takes precedence over 'initiatorDomains'.*/ excludedInitiatorDomains?: string[]; /** * The rule will not match network requests when the domains matches one from the list of 'excludedRequestDomains'. If the list is empty or omitted, no domains are excluded. This takes precedence over 'requestDomains'.*/ excludedRequestDomains?: string[]; /** * List of request methods which the rule won't match. Cannot be specified if 'requestMethods' is specified. If neither of them is specified, all request methods are matched.*/ excludedRequestMethods?: string[]; /** * List of resource types which the rule won't match. Cannot be specified if 'resourceTypes' is specified. If neither of them is specified, all resource types except 'main_frame' are matched.*/ excludedResourceTypes?: ResourceType[]; /** * List of tabIds which the rule should not match. An ID of -1 excludes requests which don't originate from a tab. Only supported for session-scoped rules.*/ excludedTabIds?: number[]; /** * The rule will only match network requests originating from the list of 'initiatorDomains'. If the list is omitted, the rule is applied to requests from all domains.*/ initiatorDomains?: string[]; /** * Whether 'urlFilter' or 'regexFilter' is case-sensitive.*/ isUrlFilterCaseSensitive?: boolean; /** * Regular expression to match against the network request url. Only one of 'urlFilter' or 'regexFilter' can be specified.*/ regexFilter?: string; /** * The rule will only match network requests when the domain matches one from the list of 'requestDomains'. If the list is omitted, the rule is applied to requests from all domains.*/ requestDomains?: string[]; /** * List of HTTP request methods which the rule can match. Should be a lower-case method such as 'connect', 'delete', 'get', 'head', 'options', 'patch', 'post', 'put'.'*/ requestMethods?: string[]; /** * List of resource types which the rule can match. When the rule action is 'allowAllRequests', this must be specified and may only contain 'main_frame' or 'sub_frame'. Cannot be specified if 'excludedResourceTypes' is specified. If neither of them is specified, all resource types except 'main_frame' are matched.*/ resourceTypes?: ResourceType[]; /** * List of tabIds which the rule should match. An ID of -1 matches requests which don't originate from a tab. Only supported for session-scoped rules.*/ tabIds?: number[]; /** * TODO: link to doc explaining supported pattern. The pattern which is matched against the network request url. Only one of 'urlFilter' or 'regexFilter' can be specified.*/ urlFilter?: string; }; /** * An id which uniquely identifies a rule. Mandatory and should be >= 1.*/ id: number; /** * Rule priority. Defaults to 1. When specified, should be >= 1*/ priority?: number; } export interface GetRulesFilter { /** * If specified, only rules with matching IDs are included.*/ ruleIds?: number[]; } export interface UpdateDynamicRulesOptions { /** * Rules to add.*/ addRules?: Rule[]; /** * IDs of the rules to remove. Any invalid IDs will be ignored.*/ removeRuleIds?: number[]; } /** * Modifies the current set of dynamic rules for the extension. The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added. These rules are persisted across browser sessions and extension updates.*/ export function updateDynamicRules(options: UpdateDynamicRulesOptions): Promise; export interface UpdateSessionRulesOptions { /** * Rules to add.*/ addRules?: Rule[]; /** * IDs of the rules to remove. Any invalid IDs will be ignored.*/ removeRuleIds?: number[]; } /** * Modifies the current set of session scoped rules for the extension. The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added. These rules are not persisted across sessions and are backed in memory.*/ export function updateSessionRules(options: UpdateSessionRulesOptions): Promise; /** * Returns the ids for the current set of enabled static rulesets.*/ export function getEnabledRulesets(): Promise; export interface UpdateEnabledRulesetsUpdateRulesetOptions { disableRulesetIds?: string[]; enableRulesetIds?: string[]; } /** * Modifies the static rulesets enabled/disabled state.*/ export function updateEnabledRulesets(updateRulesetOptions: UpdateEnabledRulesetsUpdateRulesetOptions): Promise; export interface UpdateStaticRulesOptions { disableRuleIds?: number[]; enableRuleIds?: number[]; rulesetId: string; } /** * Modified individual static rules enabled/disabled state. Changes to rules belonging to a disabled ruleset will take effect when the ruleset becomes enabled.*/ export function updateStaticRules(options: UpdateStaticRulesOptions): Promise; /** * Returns the remaining number of static rules an extension can enable*/ export function getAvailableStaticRuleCount(): Promise; export interface GetDisabledRuleIdsOptions { rulesetId: string; } /** * Returns the list of individual disabled static rules from a given static ruleset id.*/ export function getDisabledRuleIds(options: GetDisabledRuleIdsOptions): Promise; /** * Returns the current set of dynamic rules for the extension.*/ export function getDynamicRules(/** * An object to filter the set of dynamic rules for the extension.*/ filter: GetRulesFilter): Promise; /** * Returns the current set of dynamic rules for the extension.*/ export function getDynamicRules(): Promise; /** * Returns the current set of session scoped rules for the extension.*/ export function getSessionRules(/** * An object to filter the set of session scoped rules for the extension.*/ filter: GetRulesFilter): Promise; /** * Returns the current set of session scoped rules for the extension.*/ export function getSessionRules(): Promise; export interface IsRegexSupportedRegexOptions { /** * Whether the 'regex' specified is case sensitive.*/ isCaseSensitive?: boolean; /** * The regular expresson to check.*/ regex: string; /** * Whether the 'regex' specified requires capturing. Capturing is only required for redirect rules which specify a 'regexSubstition' action.*/ requireCapturing?: boolean; } /** * Checks if the given regular expression will be supported as a 'regexFilter' rule condition.*/ export function isRegexSupported(regexOptions: IsRegexSupportedRegexOptions): Promise<{ /** * Whether the given regex is supported*/ isSupported: boolean; /** * Specifies the reason why the regular expression is not supported. Only provided if 'isSupported' is false.*/ reason?: UnsupportedRegexReason; }>; /** * The details of the request to test.*/ export interface TestMatchOutcomeRequest { /** * The initiator URL (if any) for the hypothetical request.*/ initiator?: string; /** * Standard HTTP method of the hypothetical request.*/ method?: string; /** * The ID of the tab in which the hypothetical request takes place. Does not need to correspond to a real tab ID. Default is -1, meaning that the request isn't related to a tab.*/ tabId?: number; /** * The resource type of the hypothetical request.*/ type: ResourceType; /** * The URL of the hypothetical request.*/ url: string; } export interface TestMatchOutcomeOptions { /** * Whether to account for rules from other installed extensions during rule evaluation.*/ includeOtherExtensions?: boolean; } /** * Checks if any of the extension's declarativeNetRequest rules would match a hypothetical request.*/ export function testMatchOutcome(/** * The details of the request to test.*/ request: TestMatchOutcomeRequest, options: TestMatchOutcomeOptions): Promise<{ /** * The rules (if any) that match the hypothetical request.*/ matchedRules: MatchedRule[]; }>; /** * Checks if any of the extension's declarativeNetRequest rules would match a hypothetical request.*/ export function testMatchOutcome(/** * The details of the request to test.*/ request: TestMatchOutcomeRequest): Promise<{ /** * The rules (if any) that match the hypothetical request.*/ matchedRules: MatchedRule[]; }>; /** * Ruleset ID for the dynamic rules added by the extension.*/ export const DYNAMIC_RULESET_ID: "_dynamic"; /** * The minimum number of static rules guaranteed to an extension across its enabled static rulesets. Any rules above this limit will count towards the global static rule limit.*/ export const GUARANTEED_MINIMUM_STATIC_RULES: number; /** * The maximum number of static rules that can be disabled on each static ruleset.*/ export const MAX_NUMBER_OF_DISABLED_STATIC_RULES: number; /** * Deprecated property returning the maximum number of dynamic and session rules an extension can add, replaced by MAX_NUMBER_OF_DYNAMIC_RULES/MAX_NUMBER_OF_SESSION_RULES.*/ export const MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES: number; /** * The maximum number of dynamic session rules an extension can add.*/ export const MAX_NUMBER_OF_DYNAMIC_RULES: number; /** * The maximum number of static Rulesets an extension can enable at any one time.*/ export const MAX_NUMBER_OF_ENABLED_STATIC_RULESETS: number; /** * The maximum number of regular expression rules that an extension can add. This limit is evaluated separately for the set of session rules, dynamic rules and those specified in the rule_resources file.*/ export const MAX_NUMBER_OF_REGEX_RULES: number; /** * The maximum number of dynamic session rules an extension can add.*/ export const MAX_NUMBER_OF_SESSION_RULES: number; /** * The maximum number of static Rulesets an extension can specify as part of the rule_resources manifest key.*/ export const MAX_NUMBER_OF_STATIC_RULESETS: number; /** * Ruleset ID for the session-scoped rules added by the extension.*/ export const SESSION_RULESET_ID: "_session"; } namespace dns { /** * An object encapsulating a DNS Record.*/ export interface DNSRecord { addresses: string[]; /** * The canonical hostname for this record. this value is empty if the record was not fetched with the 'canonical_name' flag.*/ canonicalName?: string; /** * Record retreived with TRR.*/ isTRR: string; } type ResolveFlags = ("allow_name_collisions" | "bypass_cache" | "canonical_name" | "disable_ipv4" | "disable_ipv6" | "disable_trr" | "offline" | "priority_low" | "priority_medium" | "speculate")[]; /** * Resolves a hostname to a DNS record.*/ export function resolve(hostname: string, flags?: ResolveFlags): Promise; } namespace downloads { export type FilenameConflictAction = "uniquify" | "overwrite" | "prompt"; export type InterruptReason = "FILE_FAILED" | "FILE_ACCESS_DENIED" | "FILE_NO_SPACE" | "FILE_NAME_TOO_LONG" | "FILE_TOO_LARGE" | "FILE_VIRUS_INFECTED" | "FILE_TRANSIENT_ERROR" | "FILE_BLOCKED" | "FILE_SECURITY_CHECK_FAILED" | "FILE_TOO_SHORT" | "NETWORK_FAILED" | "NETWORK_TIMEOUT" | "NETWORK_DISCONNECTED" | "NETWORK_SERVER_DOWN" | "NETWORK_INVALID_REQUEST" | "SERVER_FAILED" | "SERVER_NO_RANGE" | "SERVER_BAD_CONTENT" | "SERVER_UNAUTHORIZED" | "SERVER_CERT_PROBLEM" | "SERVER_FORBIDDEN" | "USER_CANCELED" | "USER_SHUTDOWN" | "CRASH"; /** * These string constants will never change, however the set of DangerTypes may change.*/ export type DangerType = "file" | "url" | "content" | "uncommon" | "host" | "unwanted" | "safe" | "accepted"; /** * These string constants will never change, however the set of States may change.*/ export type State = "in_progress" | "interrupted" | "complete"; export interface DownloadItem { byExtensionId?: string; byExtensionName?: string; /** * Number of bytes received so far from the host, without considering file compression.*/ bytesReceived: number; canResume: boolean; /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * Indication of whether this download is thought to be safe or known to be suspicious.*/ danger: DangerType; /** * Number of milliseconds between the unix epoch and when this download ended.*/ endTime?: string; /** * Number indicating why a download was interrupted.*/ error?: InterruptReason; estimatedEndTime?: string; exists: boolean; /** * Number of bytes in the whole file post-decompression, or -1 if unknown.*/ fileSize: number; /** * Absolute local path.*/ filename: string; /** * An identifier that is persistent across browser sessions.*/ id: number; /** * False if this download is recorded in the history, true if it is not recorded.*/ incognito: boolean; /** * The file's MIME type.*/ mime?: string; /** * True if the download has stopped reading data from the host, but kept the connection open.*/ paused: boolean; referrer?: string; /** * Number of milliseconds between the unix epoch and when this download began.*/ startTime: string; /** * Indicates whether the download is progressing, interrupted, or complete.*/ state: State; /** * Number of bytes in the whole file, without considering file compression, or -1 if unknown.*/ totalBytes: number; /** * Absolute URL.*/ url: string; } export interface StringDelta { current?: string; previous?: string; } export interface DoubleDelta { current?: number; previous?: number; } export interface BooleanDelta { current?: boolean; previous?: boolean; } /** * A time specified as a Date object, a number or string representing milliseconds since the epoch, or an ISO 8601 string*/ type DownloadTime = string | extensionTypes.Date; /** * Parameters that combine to specify a predicate that can be used to select a set of downloads. Used for example in search() and erase()*/ export interface DownloadQuery { /** * Number of bytes received so far from the host, without considering file compression.*/ bytesReceived?: number; /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * Indication of whether this download is thought to be safe or known to be suspicious.*/ danger?: DangerType; endTime?: string; /** * Limits results to downloads that ended after the given ms since the epoch.*/ endedAfter?: DownloadTime; /** * Limits results to downloads that ended before the given ms since the epoch.*/ endedBefore?: DownloadTime; /** * Why a download was interrupted.*/ error?: InterruptReason; exists?: boolean; /** * Number of bytes in the whole file post-decompression, or -1 if unknown.*/ fileSize?: number; /** * Absolute local path.*/ filename?: string; /** * Limits results to {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItems} whose `filename` matches the given regular expression.*/ filenameRegex?: string; id?: number; /** * Setting this integer limits the number of results. Otherwise, all matching {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItems} will be returned.*/ limit?: number; /** * The file's MIME type.*/ mime?: string; /** * Setting elements of this array to {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem} properties in order to sort the search results. For example, setting `orderBy='startTime'` sorts the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItems} by their start time in ascending order. To specify descending order, prefix `orderBy` with a hyphen: '-startTime'.*/ orderBy?: string[]; /** * True if the download has stopped reading data from the host, but kept the connection open.*/ paused?: boolean; /** * This array of search terms limits results to {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItems} whose `filename` or `url` contain all of the search terms that do not begin with a dash '-' and none of the search terms that do begin with a dash.*/ query?: string[]; startTime?: string; /** * Limits results to downloads that started after the given ms since the epoch.*/ startedAfter?: DownloadTime; /** * Limits results to downloads that started before the given ms since the epoch.*/ startedBefore?: DownloadTime; /** * Indicates whether the download is progressing, interrupted, or complete.*/ state?: State; /** * Number of bytes in the whole file, without considering file compression, or -1 if unknown.*/ totalBytes?: number; /** * Limits results to downloads whose totalBytes is greater than the given integer.*/ totalBytesGreater?: number; /** * Limits results to downloads whose totalBytes is less than the given integer.*/ totalBytesLess?: number; /** * Absolute URL.*/ url?: string; /** * Limits results to {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItems} whose `url` matches the given regular expression.*/ urlRegex?: string; } /** * What to download and how.*/ export interface DownloadOptions { /** * When this flag is set to `true`, then the browser will allow downloads to proceed after encountering HTTP errors such as `404 Not Found`.*/ allowHttpErrors?: boolean; /** * Post body.*/ body?: string; conflictAction?: FilenameConflictAction; /** * The cookie store ID of the contextual identity; requires "cookies" permission.*/ cookieStoreId?: string; /** * A file path relative to the Downloads directory to contain the downloaded file.*/ filename?: string; /** * Extra HTTP headers to send with the request if the URL uses the HTTP[s] protocol. Each header is represented as a dictionary containing the keys `name` and either `value` or `binaryValue`, restricted to those allowed by XMLHttpRequest.*/ headers?: { /** * Name of the HTTP header.*/ name: string; /** * Value of the HTTP header.*/ value: string; }[]; /** * Whether to associate the download with a private browsing session.*/ incognito?: boolean; /** * The HTTP method to use if the URL uses the HTTP[S] protocol.*/ method?: "GET" | "POST"; /** * Use a file-chooser to allow the user to select a filename. If the option is not specified, the file chooser will be shown only if the Thunderbird "Always ask you where to save files" option is enabled (i.e. the pref `browser.download.useDownloadDir` is set to `false`).*/ saveAs?: boolean; /** * The URL to download.*/ url: string; } /** * Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its hostname. If both `filename` and `saveAs` are specified, then the Save As dialog will be displayed, pre-populated with the specified `filename`. If the download started successfully, `callback` will be called with the new {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem}'s `downloadId`. If there was an error starting the download, then `callback` will be called with `downloadId=undefined` and {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/lastError|chrome.extension.lastError} will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases. You must not parse it.*/ export function download(/** * What to download and how.*/ options: DownloadOptions): Promise; /** * Find {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItems}. Set `query` to the empty object to get all {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItems}. To get a specific {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem}, set only the `id` field.*/ export function search(query: DownloadQuery): Promise; /** * Pause the download. If the request was successful the download is in a paused state. Otherwise {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/lastError|chrome.extension.lastError} contains an error message. The request will fail if the download is not active.*/ export function pause(/** * The id of the download to pause.*/ downloadId: number): Promise; /** * Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/lastError|chrome.extension.lastError} contains an error message. The request will fail if the download is not active.*/ export function resume(/** * The id of the download to resume.*/ downloadId: number): Promise; /** * Cancel a download. When `callback` is run, the download is cancelled, completed, interrupted or doesn't exist anymore.*/ export function cancel(/** * The id of the download to cancel.*/ downloadId: number): Promise; export interface GetFileIconOptions { /** * The size of the icon. The returned icon will be square with dimensions size * size pixels. The default size for the icon is 32x32 pixels.*/ size?: number; } /** * Retrieve an icon for the specified download. For new downloads, file icons are available after the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/onCreated|onCreated} event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/lastError|chrome.extension.lastError} will contain an error message.*/ export function getFileIcon(/** * The identifier for the download.*/ downloadId: number, options: GetFileIconOptions): Promise; /** * Retrieve an icon for the specified download. For new downloads, file icons are available after the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/onCreated|onCreated} event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/lastError|chrome.extension.lastError} will contain an error message.*/ export function getFileIcon(/** * The identifier for the download.*/ downloadId: number): Promise; /** * Open the downloaded file.*/ export function open(downloadId: number): Promise; /** * Show the downloaded file in its folder in a file manager.*/ export function show(downloadId: number): Promise; export function showDefaultFolder(): void; /** * Erase matching {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItems} from history*/ export function erase(query: DownloadQuery): Promise; export function removeFile(downloadId: number): Promise; /** * This event fires with the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem} object when a download begins.*/ export const onCreated: WebExtEvent<(downloadItem: DownloadItem) => void>; /** * Fires with the `downloadId` when a download is erased from history.*/ export const onErased: WebExtEvent<(/** * The `id` of the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem} that was erased.*/ downloadId: number) => void>; /** * When any of a {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem}'s properties except `bytesReceived` changes, this event fires with the `downloadId` and an object containing the properties that changed.*/ export const onChanged: WebExtEvent<(downloadDelta: { canResume?: BooleanDelta; /** * Describes a change in a {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem}'s `danger`.*/ danger?: StringDelta; /** * Describes a change in a {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem}'s `endTime`.*/ endTime?: StringDelta; /** * Describes a change in a {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem}'s `error`.*/ error?: StringDelta; exists?: BooleanDelta; /** * Describes a change in a {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem}'s `fileSize`.*/ fileSize?: DoubleDelta; /** * Describes a change in a {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem}'s `filename`.*/ filename?: StringDelta; /** * The `id` of the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem} that changed.*/ id: number; /** * Describes a change in a {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem}'s `mime`.*/ mime?: StringDelta; /** * Describes a change in a {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem}'s `paused`.*/ paused?: BooleanDelta; /** * Describes a change in a {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem}'s `startTime`.*/ startTime?: StringDelta; /** * Describes a change in a {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem}'s `state`.*/ state?: StringDelta; /** * Describes a change in a {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem}'s `totalBytes`.*/ totalBytes?: DoubleDelta; /** * Describes a change in a {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/DownloadItem|DownloadItem}'s `url`.*/ url?: StringDelta; }) => void>; } namespace events { /** * Description of a declarative rule for handling events.*/ export interface Rule { /** * List of actions that are triggered if one of the condtions is fulfilled.*/ actions: any[]; /** * List of conditions that can trigger the actions.*/ conditions: any[]; /** * Optional identifier that allows referencing this rule.*/ id?: string; /** * Optional priority of this rule. Defaults to 100.*/ priority?: number; /** * Tags can be used to annotate rules and perform operations on sets of rules.*/ tags?: string[]; } /** * An object which allows the addition and removal of listeners for a Chrome event.*/ export interface Event { /** * Registers an event listener _callback_ to an event.*/ addListener(): void; /** * Deregisters an event listener _callback_ from an event.*/ removeListener(): void; hasListener(): boolean; hasListeners(): boolean; } /** * Filters URLs for various criteria. See {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/events/UrlFilter|event filtering}. All criteria are case sensitive.*/ export interface UrlFilter { /** * Matches if the host name of the URL contains a specified string. To test whether a host name component has a prefix 'foo', use hostContains: '.foo'. This matches 'www.foobar.com' and 'foo.com', because an implicit dot is added at the beginning of the host name. Similarly, hostContains can be used to match against component suffix ('foo.') and to exactly match against components ('.foo.'). Suffix- and exact-matching for the last components need to be done separately using hostSuffix, because no implicit dot is added at the end of the host name.*/ hostContains?: string; /** * Matches if the host name of the URL is equal to a specified string.*/ hostEquals?: string; /** * Matches if the host name of the URL starts with a specified string.*/ hostPrefix?: string; /** * Matches if the host name of the URL ends with a specified string.*/ hostSuffix?: string; /** * Matches if the URL without query segment and fragment identifier matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the {@link https://github.com/google/re2/blob/master/doc/syntax.txt|RE2 syntax}.*/ originAndPathMatches?: string; /** * Matches if the path segment of the URL contains a specified string.*/ pathContains?: string; /** * Matches if the path segment of the URL is equal to a specified string.*/ pathEquals?: string; /** * Matches if the path segment of the URL starts with a specified string.*/ pathPrefix?: string; /** * Matches if the path segment of the URL ends with a specified string.*/ pathSuffix?: string; /** * Matches if the port of the URL is contained in any of the specified port lists. For example `[80, 443, [1000, 1200]]` matches all requests on port 80, 443 and in the range 1000-1200.*/ ports?: (number | number[])[]; /** * Matches if the query segment of the URL contains a specified string.*/ queryContains?: string; /** * Matches if the query segment of the URL is equal to a specified string.*/ queryEquals?: string; /** * Matches if the query segment of the URL starts with a specified string.*/ queryPrefix?: string; /** * Matches if the query segment of the URL ends with a specified string.*/ querySuffix?: string; /** * Matches if the scheme of the URL is equal to any of the schemes specified in the array.*/ schemes?: string[]; /** * Matches if the URL (without fragment identifier) contains a specified string. Port numbers are stripped from the URL if they match the default port number.*/ urlContains?: string; /** * Matches if the URL (without fragment identifier) is equal to a specified string. Port numbers are stripped from the URL if they match the default port number.*/ urlEquals?: string; /** * Matches if the URL (without fragment identifier) matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the {@link https://github.com/google/re2/blob/master/doc/syntax.txt|RE2 syntax}.*/ urlMatches?: string; /** * Matches if the URL (without fragment identifier) starts with a specified string. Port numbers are stripped from the URL if they match the default port number.*/ urlPrefix?: string; /** * Matches if the URL (without fragment identifier) ends with a specified string. Port numbers are stripped from the URL if they match the default port number.*/ urlSuffix?: string; } } namespace experiments { export interface ExperimentAPI { child?: { paths: APIPaths; scopes: APIChildScope[]; script: ExperimentURL; }; parent?: { events?: APIEvents; paths?: APIPaths; scopes?: APIParentScope[]; script: ExperimentURL; }; schema: ExperimentURL; } export type ExperimentURL = string; type APIPaths = APIPath[]; type APIPath = string[]; type APIEvents = APIEvent[]; export type APIEvent = "startup"; export type APIParentScope = "addon_parent" | "content_parent" | "devtools_parent"; export type APIChildScope = "addon_child" | "content_child" | "devtools_child"; } namespace extension { /** * The type of extension view.*/ export type ViewType = "tab" | "popup" | "sidebar"; /** * Converts a relative path within an extension install directory to a fully-qualified URL.* * @deprecated Please use $(ref:runtime.getURL).*/ export function getURL(/** * A path to a resource within an extension expressed relative to its install directory.*/ path: string): string; export interface GetViewsFetchProperties { /** * Find a view according to a tab id. If this field is omitted, returns all views.*/ tabId?: number; /** * The type of view to get. If omitted, returns all views (including background pages and tabs). Valid values: 'tab', 'popup', 'sidebar'.*/ type?: ViewType; /** * The window to restrict the search to. If omitted, returns all views.*/ windowId?: number; } /** * Returns an array of the JavaScript 'window' objects for each of the pages running inside the current extension.*/ export function getViews(fetchProperties?: GetViewsFetchProperties): { [key: string]: any; }[]; /** * Returns the JavaScript 'window' object for the background page running inside the current extension. Returns null if the extension has no background page.*/ export function getBackgroundPage(): { [key: string]: any; }; /** * Retrieves the state of the extension's access to Incognito-mode (as determined by the user-controlled 'Allowed in Incognito' checkbox.*/ export function isAllowedIncognitoAccess(): Promise; /** * Retrieves the state of the extension's access to the 'file://' scheme (as determined by the user-controlled 'Allow access to File URLs' checkbox.*/ export function isAllowedFileSchemeAccess(): Promise; /** * True for content scripts running inside incognito tabs, and for extension pages running inside an incognito process. The latter only applies to extensions with 'split' incognito_behavior.*/ export const inIncognitoContext: boolean; /** * Set for the lifetime of a callback if an ansychronous extension api has resulted in an error. If no error has occured lastError will be `undefined`.* * @deprecated Please use $(ref:runtime.lastError).*/ export const lastError: { /** * Description of the error that has taken place.*/ message: string; } & { [key: string]: any; }; } namespace composeScripts { /** * Details of a compose script registered programmatically.*/ export interface RegisteredComposeScriptOptions { /** * The list of CSS files to inject.*/ css?: extensionTypes.ExtensionFileOrCode[]; /** * The list of JavaScript files to inject.*/ js?: extensionTypes.ExtensionFileOrCode[]; } /** * An object that represents a compose script registered programmatically.*/ export interface RegisteredComposeScript { /** * Unregister a compose script registered programmatically.*/ unregister(): Promise; } /** * Register a compose script programmatically.*/ export function register(composeScriptOptions: RegisteredComposeScriptOptions): Promise; } namespace messageDisplayScripts { /** * Details of a message display script registered programmatically*/ export interface RegisteredMessageDisplayScriptOptions { /** * The list of CSS files to inject*/ css?: extensionTypes.ExtensionFileOrCode[]; /** * The list of JavaScript files to inject*/ js?: extensionTypes.ExtensionFileOrCode[]; /** * Determines when the files specified in css and js are injected. The states directly correspond to `Document.readyState`: `loading`, `interactive` and `complete`*/ runAt?: "document_start" | "document_end" | "document_idle"; } /** * An object that represents a message display script registered programmatically*/ export interface RegisteredMessageDisplayScript { /** * Unregister a message display script registered programmatically*/ unregister(): Promise; } /** * Register a message display script programmatically.*/ export function register(messageDisplayScriptOptions: RegisteredMessageDisplayScriptOptions): Promise; } namespace protocolHandlers { } namespace extensionTypes { /** * The format of an image.*/ export type ImageFormat = "jpeg" | "png"; /** * Details about the format, quality, area and scale of the capture.*/ export interface ImageDetails { /** * The format of the resulting image. Default is `"jpeg"`.*/ format?: ImageFormat; /** * When format is `"jpeg"`, controls the quality of the resulting image. This value is ignored for PNG images. As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease.*/ quality?: number; /** * The area of the document to capture, in CSS pixels, relative to the page. If omitted, capture the visible viewport.*/ rect?: { height: number; width: number; x: number; y: number; }; /** * If true, temporarily resets the scroll position of the document to 0. Only takes effect if rect is also specified.*/ resetScrollPosition?: boolean; /** * The scale of the resulting image. Defaults to `devicePixelRatio`.*/ scale?: number; } /** * The soonest that the JavaScript or CSS will be injected into the tab.*/ export type RunAt = "document_start" | "document_end" | "document_idle"; /** * The JavaScript world for a script to execute within. `ISOLATED` is the default execution environment of content scripts, `MAIN` is the web page's execution environment.*/ export type ExecutionWorld = "ISOLATED" | "MAIN"; /** * The origin of the CSS to inject, this affects the cascading order (priority) of the stylesheet.*/ export type CSSOrigin = "user" | "author"; /** * Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.*/ export interface InjectDetails { /** * If allFrames is `true`, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's `false` and is only injected into the top frame.*/ allFrames?: boolean; /** * JavaScript or CSS code to inject.

Warning:
Be careful using the `code` parameter. Incorrect use of it may open your extension to {@link https://en.wikipedia.org/wiki/Cross-site_scripting|cross site scripting} attacks.*/ code?: string; /** * The css origin of the stylesheet to inject. Defaults to "author".*/ cssOrigin?: CSSOrigin; /** * JavaScript or CSS file to inject.*/ file?: string; /** * The ID of the frame to inject the script into. This may not be used in combination with `allFrames`.*/ frameId?: number; /** * If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is `false`.*/ matchAboutBlank?: boolean; /** * The soonest that the JavaScript or CSS will be injected into the tab. Defaults to "document_idle".*/ runAt?: RunAt; } type Date = string | number | { [key: string]: any; }; type ExtensionFileOrCode = { file: manifest.ExtensionURL; } | { code: string; }; /** * A plain JSON value*/ type PlainJSONValue = null | number | string | boolean | PlainJSONValue[] | { [key: string]: PlainJSONValue; }; } namespace folders { /** * An object describing a folder.*/ export interface MailFolder { /** * The id of the account this folder belongs to.*/ accountId?: accounts.MailAccountId; /** * An identifier for the folder.*/ id?: folders.MailFolderId; /** * Whether this folder is a favorite folder.*/ isFavorite?: boolean; /** * Whether this folder is a root folder.*/ isRoot?: boolean; /** * Whether this folder is a virtual tag folder.*/ isTag?: boolean; /** * Whether this folder is a unified mailbox folder.*/ isUnified?: boolean; /** * Whether this folder is a virtual search folder.*/ isVirtual?: boolean; /** * The human-friendly name of this folder.*/ name?: string; /** * Path to this folder in the account. Although paths look predictable, never guess a folder's path, as there are a number of reasons why it may not be what you think it is. Use {@link folders.getParentFolders} or {@link folders.getSubFolders} to obtain hierarchy information.*/ path: string; /** * The special use of this folder. A folder can have multiple special uses.*/ specialUse?: folders.MailFolderSpecialUse[]; /** * Subfolders of this folder. This property is optional and only present if the inclusion of subfolders had been requested. The folders will be returned in the same order as used in Thunderbird's folder pane.*/ subFolders?: folders.MailFolder[]; /** * Deprecated. Was used to represent the type of this folder.*/ type?: folders.MailFolderSpecialUse; } /** * A unique id representing a {@link folders.MailFolder} throughout a session. Renaming or moving a folder will invalidate its id.*/ export type MailFolderId = string; /** * An object containing additional information about a folder.*/ export interface MailFolderInfo { /** * Deprecated. This information is now available in {@link folders.MailFolder}.*/ favorite?: boolean; /** * Date the folder was last used. It is updated every time the folder was accessed, when the user moved or copied messages into the folder and when the folder received new messages. (precision: seconds).*/ lastUsed?: extensionTypes.Date; /** * Date the folder was last used as a destination. It is updated every time the user moved or copied messages into the folder. (precision: seconds).*/ lastUsedAsDestination?: extensionTypes.Date; /** * Number of new messages in this folder.*/ newMessageCount?: number; /** * Quota information, if available.*/ quota?: folders.MailFolderQuota[]; /** * Number of messages in this folder.*/ totalMessageCount?: number; /** * Number of unread messages in this folder.*/ unreadMessageCount?: number; } /** * An object containing capability information about a folder.*/ export interface MailFolderCapabilities { /** * Whether this folder supports adding new messages.*/ canAddMessages?: boolean; /** * Whether this folder supports adding new subfolders.*/ canAddSubfolders?: boolean; /** * Whether this folder can be deleted.*/ canBeDeleted?: boolean; /** * Whether this folder can be renamed.*/ canBeRenamed?: boolean; /** * Whether this folder supports deleting messages.*/ canDeleteMessages?: boolean; } /** * Supported values for the special use of a folder.*/ export type MailFolderSpecialUse = "inbox" | "drafts" | "sent" | "trash" | "templates" | "archives" | "junk" | "outbox"; /** * An object containing quota information.*/ export interface MailFolderQuota { /** * The maximum available quota.*/ limit: number; /** * The type of the quota as defined by RFC 2087. A `STORAGE` quota is constraining the available storage in bytes, a `MESSAGE` quota is constraining the number of storable messages.*/ type: "STORAGE" | "MESSAGE"; /** * The currently unused quota.*/ unused: number; /** * The currently used quota.*/ used: number; } /** * An object defining a range for a date value to be used in queries.*/ type QueryDateRange = { /** * Whether the date must be considered to be recent by Thunderbird (within the last month) or not, to match the query.*/ recent: boolean; } | { /** * The minimum date required to match the query.*/ after?: extensionTypes.Date; /** * The maximum date required to match the query.*/ before?: extensionTypes.Date; }; /** * An object defining a range for an integer value to be used in queries.*/ export interface QueryRange { /** * The maximum value required to match the query.*/ max?: number; /** * The minimum value required to match the query.*/ min?: number; } export interface RegularExpression { /** * Supported RegExp flags: `i` = case insensitive, and/or one of `u` = unicode support or `v` = extended unicode support*/ flags?: string; /** * A regular expression, for example `^Projects \d{4}$`.*/ regexp: string; } export interface QueryQueryInfo { /** * Limits the search to folders of the account with the specified id.*/ accountId?: accounts.MailAccountId; /** * Whether the folder supports adding new messages, or not.*/ canAddMessages?: boolean; /** * Whether the folder supports adding new subfolders, or not.*/ canAddSubfolders?: boolean; /** * Whether the folder can be deleted, or not.*/ canBeDeleted?: boolean; /** * Whether the folder can be renamed, or not.*/ canBeRenamed?: boolean; /** * Whether the folder supports deleting messages, or not.*/ canDeleteMessages?: boolean; /** * Limits the search to the folder with the specified id.*/ folderId?: folders.MailFolderId; /** * Whether the folder (excluding subfolders) contains messages, or not. Supports to specify a {@link folders.QueryRange} (min/max) instead of a simple boolean value (none/some).*/ hasMessages?: boolean | QueryRange; /** * Whether the folder (excluding subfolders) contains new messages, or not. Supports to specify a {@link folders.QueryRange} (min/max) instead of a simple boolean value (none/some).*/ hasNewMessages?: boolean | QueryRange; /** * Whether the folder has subfolders, or not. Supports to specify a {@link folders.QueryRange} (min/max) instead of a simple boolean value (none/some).*/ hasSubFolders?: boolean | QueryRange; /** * Whether the folder (excluding subfolders) contains unread messages, or not. Supports to specify a {@link folders.QueryRange} (min/max) instead of a simple boolean value (none/some).*/ hasUnreadMessages?: boolean | QueryRange; /** * Whether the folder is a favorite folder, or not.*/ isFavorite?: boolean; /** * Whether the folder is a root folder, or not.*/ isRoot?: boolean; /** * Whether the folder is a virtual tag folder, or not. Virtual tag folders are always skipped, unless this property is set to `true`*/ isTag?: boolean; /** * Whether the folder is a unified mailbox folder, or not. Unified mailbox folders are always skipped, unless this property is set to `true`*/ isUnified?: boolean; /** * Whether the folder is a virtual search folder, or not.*/ isVirtual?: boolean; /** * Date the folder was last used (folder was accessed, user moved or copied messages into the folder or folder received new messages).*/ lastUsed?: QueryDateRange; /** * Date the folder was last used as a destination (user moved or copied messages into the folder).*/ lastUsedAsDestination?: QueryDateRange; /** * Limits the number of returned folders. If used together with `recent`, supports being set to $(ref:folders.DEFAULT_MOST_RECENT_LIMIT)*/ limit?: number; /** * Return only folders whose name is matched by the provided string or regular expression.*/ name?: RegularExpression | string; /** * Return only folders whose path is matched by the provided string or regular expression.*/ path?: RegularExpression | string; /** * Whether the folder (excluding subfolders) has been used within the last month, or not. The returned folders will be sorted by `lastUsed`.* * @deprecated Deprecated. Use queryInfo.lastUsed and queryInfo.sort.*/ recent?: boolean; /** * The sort order of the returned folders. If not specified, folders will be sorted by `path`. Sorting by `name` is case-insensitive.*/ sort?: "lastUsed" | "lastUsedAsDestination" | "name" | "path"; /** * Match only folders with the specified special use (folders have to match all specified uses).*/ specialUse?: folders.MailFolderSpecialUse[]; /** * Deprecated. Match only folders with the specified special use.*/ type?: folders.MailFolderSpecialUse; } /** * Gets folders that match the specified properties, or all folders if no properties are specified.*/ export function query(queryInfo?: QueryQueryInfo): Promise; /** * Returns the specified folder.*/ export function get(folderId: folders.MailFolderId, /** * Specifies whether the returned {@link folders.MailFolder} should populate its `subFolders` property and include all its (nested!) subfolders. Defaults to `true`.*/ includeSubFolders?: boolean): Promise; /** * Creates a new subfolder in the specified folder, or at the root of the specified account.*/ export function create(destination: folders.MailFolder | accounts.MailAccount | folders.MailFolderId, childName: string): Promise; /** * Renames a folder.*/ export function rename(folder: folders.MailFolder | folders.MailFolderId, newName: string): Promise; /** * Moves the given source folder into the given destination folder. Throws if the destination already contains a folder with the name of the source folder.*/ export function move(source: folders.MailFolder | folders.MailFolderId, destination: folders.MailFolder | accounts.MailAccount | folders.MailFolderId): Promise; /** * Copies the given source folder into the given destination folder. Throws if the destination already contains a folder with the name of the source folder.*/ export function copy(source: folders.MailFolder | folders.MailFolderId, destination: folders.MailFolder | accounts.MailAccount | folders.MailFolderId): Promise; /** * Deletes a folder.*/ function __delete(folder: folders.MailFolder | folders.MailFolderId): Promise; export { __delete as delete }; /** * The properties to update.*/ export interface UpdateUpdateProperties { /** * Sets or clears the favorite status.*/ isFavorite?: boolean; } /** * Updates properties of a folder.*/ export function update(folder: folders.MailFolder | folders.MailFolderId, /** * The properties to update.*/ updateProperties: UpdateUpdateProperties): Promise; /** * Get additional information about a folder.*/ export function getFolderInfo(folder: folders.MailFolder | folders.MailFolderId): Promise; /** * Get capability information about a folder.*/ export function getFolderCapabilities(folder: folders.MailFolder | folders.MailFolderId): Promise; /** * Get all parent folders as a flat ordered array. The first array entry is the direct parent.*/ export function getParentFolders(folder: folders.MailFolder | folders.MailFolderId, /** * Specifies whether each returned parent {@link folders.MailFolder} should populate its `subFolders` property and include all its (nested!) subfolders. Defaults to `false`.*/ includeSubFolders?: boolean): Promise; /** * Get the subfolders of the specified folder or account.*/ export function getSubFolders(folder: folders.MailFolder | accounts.MailAccount | folders.MailFolderId, /** * Specifies whether each returned direct child {@link folders.MailFolder} should populate its `subFolders` property and include all its (nested!) subfolders. Defaults to `true`.*/ includeSubFolders?: boolean): Promise; /** * Get one of the special unified mailbox folders, which are virtual search folders and return the content from all mail accounts. Throws if the requested folder does not exist.*/ export function getUnifiedFolder(/** * The requested unified mailbox folder type.*/ type: "inbox" | "drafts" | "sent" | "trash" | "templates" | "archives" | "junk", /** * Specifies whether the returned {@link folders.MailFolder} should populate its `subFolders` property and include all its (nested!) subfolders. Defaults to `false`.*/ includeSubFolders?: boolean): Promise; /** * Get one of the special virtual tag folders, which are virtual search folders and group messages from all mail accounts based on their tags. Throws if the requested folder does not exist.*/ export function getTagFolder(/** * The tag key of the requested folder. See {@link messages.tags.list} for the available tags. Throws when specifying an invalid tag key.*/ key: string): Promise; /** * Marks all messages in a folder as read.*/ export function markAsRead(folder: folders.MailFolder | folders.MailFolderId): Promise; /** * Fired when a folder has been created.*/ export const onCreated: WebExtEvent<(createdFolder: folders.MailFolder) => void>; /** * Fired when a folder has been renamed.*/ export const onRenamed: WebExtEvent<(originalFolder: folders.MailFolder, renamedFolder: folders.MailFolder) => void>; /** * Fired when a folder has been moved.*/ export const onMoved: WebExtEvent<(originalFolder: folders.MailFolder, movedFolder: folders.MailFolder) => void>; /** * Fired when a folder has been copied.*/ export const onCopied: WebExtEvent<(originalFolder: folders.MailFolder, copiedFolder: folders.MailFolder) => void>; /** * Fired when a folder has been deleted.*/ export const onDeleted: WebExtEvent<(deletedFolder: folders.MailFolder) => void>; /** * Fired when properties of a folder have changed (`specialUse` and `isFavorite`).*/ export const onUpdated: WebExtEvent<(originalFolder: folders.MailFolder, updatedFolder: folders.MailFolder) => void>; /** * Fired when certain information of a folder have changed. Bursts of message count changes are collapsed to a single event.*/ export const onFolderInfoChanged: WebExtEvent<(folder: folders.MailFolder, folderInfo: folders.MailFolderInfo) => void>; /** * The number of most recent folders used in Thunderbird's UI. Controlled by the `mail.folder_widget.max_recent` preference.*/ export const DEFAULT_MOST_RECENT_LIMIT: -1; } namespace i18n { /** * An ISO language code such as `en` or `fr`. For a complete list of languages supported by this method, see kLanguageInfoTable. For an unknown language, `und` will be returned, which means that [percentage] of the text is unknown to CLD*/ export type LanguageCode = string; /** * Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale, use {@link i18n.getUILanguage}.*/ export function getAcceptLanguages(): Promise; /** * Gets the localized string for the specified message. If the message is missing, this method returns an empty string (''). If the format of the `getMessage()` call is wrong — for example, _messageName_ is not a string or the _substitutions_ array has more than 9 elements — this method returns `undefined`.*/ export function getMessage(/** * The name of the message, as specified in the `$(topic:i18n-messages)[messages.json]` file.*/ messageName: string, /** * Substitution strings, if the message requires any.*/ substitutions?: any): string; /** * Gets the preferred locales of the operating system. This is different from the locales set in the browser; to get those, use {@link i18n.getAcceptLanguages}.*/ export function getPreferredSystemLanguages(): Promise; /** * Gets the browser UI language of the browser. This is different from {@link i18n.getAcceptLanguages} which returns the preferred user languages.*/ export function getUILanguage(): string; /** * Detects the language of the provided text using CLD.*/ export function detectLanguage(/** * User input string to be translated.*/ text: string): Promise<{ /** * CLD detected language reliability*/ isReliable: boolean; /** * array of detectedLanguage*/ languages: { language: LanguageCode; /** * The percentage of the detected language*/ percentage: number; }[]; }>; } namespace identities { export interface EncryptionCapabilities { /** * Whether the encryption technology is configured to support message encryption.*/ canEncrypt: boolean; /** * Whether the encryption technology is configured to support message signing.*/ canSign: boolean; } export interface MailIdentity { /** * The id of the {@link accounts.MailAccount} this identity belongs to. The `accountId` property is read-only.*/ accountId?: accounts.MailAccountId; /** * If the identity uses HTML as the default compose format.*/ composeHtml?: boolean; /** * The user's email address as used when messages are sent from this identity.*/ email?: string; /** * The encryption capabilities of this identity. Read only.*/ encryptionCapabilities?: { /** * The capabilities of this identity for the OpenPGP encryption technology.*/ OpenPGP: identities.EncryptionCapabilities; /** * The capabilities of this identity for the S/MIME encryption technology.*/ "S/MIME": identities.EncryptionCapabilities; }; /** * A unique identifier for this identity. The `id` property is read-only.*/ id?: string; /** * A user-defined label for this identity.*/ label?: string; /** * The user's name as used when messages are sent from this identity.*/ name?: string; /** * The organization associated with this identity.*/ organization?: string; /** * The reply-to email address associated with this identity.*/ replyTo?: string; /** * The signature of the identity.*/ signature?: string; /** * If the signature should be interpreted as plain text or as HTML.*/ signatureIsPlainText?: boolean; } /** * Returns the identities of the specified account, or all identities if no account is specified. Do not expect the returned identities to be in any specific order. Use {@link identities.getDefault} to get the default identity of an account.*/ export function list(accountId?: accounts.MailAccountId): Promise; /** * Returns details of the requested identity, or `null` if it doesn't exist.*/ export function get(identityId: string): Promise; /** * Create a new identity in the specified account.*/ export function create(accountId: accounts.MailAccountId, details: identities.MailIdentity): Promise; /** * Attempts to delete the requested identity. Default identities cannot be deleted.*/ function __delete(identityId: string): Promise; export { __delete as delete }; /** * Updates the details of an identity.*/ export function update(identityId: string, details: identities.MailIdentity): Promise; /** * Returns the default identity for the requested account, or `null` if it is not defined.*/ export function getDefault(accountId: accounts.MailAccountId): Promise; /** * Sets the default identity for the requested account.*/ export function setDefault(accountId: accounts.MailAccountId, identityId: string): Promise; /** * Fired when a new identity has been created and added to an account. The event also fires for default identities that are created when a new account is added.*/ export const onCreated: WebExtEvent<(identityId: string, identity: MailIdentity) => void>; /** * Fired when an identity has been removed from an account.*/ export const onDeleted: WebExtEvent<(identityId: string) => void>; /** * Fired when one or more properties of an identity have been modified. The returned {@link identities.MailIdentity} includes only the changed values.*/ export const onUpdated: WebExtEvent<(identityId: string, changedValues: MailIdentity) => void>; } namespace identity { /** * An object encapsulating an OAuth account id.*/ export interface AccountInfo { /** * A unique identifier for the account. This ID will not change for the lifetime of the account.*/ id: string; } export interface GetAuthTokenDetails { account?: AccountInfo; interactive?: boolean; scopes?: string[]; } export interface RemoveCachedAuthTokenDetails { token: string; } export interface LaunchWebAuthFlowDetails { interactive?: boolean; url: manifest.HttpURL; } /** * Starts an auth flow at the specified URL.*/ export function launchWebAuthFlow(details: LaunchWebAuthFlowDetails): Promise; /** * Generates a redirect URL to be used in |launchWebAuthFlow|.*/ export function getRedirectURL(/** * The path appended to the end of the generated URL.*/ path?: string): string; } namespace idle { export type IdleState = "active" | "idle"; /** * Returns "idle" if the user has not generated any input for a specified number of seconds, or "active" otherwise.*/ export function queryState(/** * The system is considered idle if detectionIntervalInSeconds seconds have elapsed since the last user input detected.*/ detectionIntervalInSeconds: number): Promise; /** * Sets the interval, in seconds, used to determine when the system is in an idle state for onStateChanged events. The default interval is 60 seconds.*/ export function setDetectionInterval(/** * Threshold, in seconds, used to determine when the system is in an idle state.*/ intervalInSeconds: number): void; /** * Fired when the system changes to an active or idle state. The event fires with "idle" if the the user has not generated any input for a specified number of seconds, and "active" when the user generates input on an idle system.*/ export const onStateChanged: WebExtEvent<(newState: IdleState) => void>; } namespace mailTabs { /** * A supported folder mode in the folder pane.*/ export type FolderMode = "all" | "unified" | "tags" | "unread" | "favorite" | "recent"; export interface MailTab { active: boolean; /** * The folder displayed in the mail tab. The accountsRead permission is required for this property to be included.*/ displayedFolder?: folders.MailFolder; /** * The folder mode of the currently displayed folder.*/ folderMode?: mailTabs.FolderMode; /** * The enabled folder modes in the folder pane, and their sort order.*/ folderModesEnabled?: mailTabs.FolderMode[]; /** * Whether the folder pane is visible or not.*/ folderPaneVisible?: boolean; id: number; /** * The arrangement of the folder pane, message list pane, and message display pane.*/ layout: "standard" | "wide" | "vertical"; /** * Whether the message pane is visible or not.*/ messagePaneVisible?: boolean; /** * The sort order of the message list.*/ sortOrder?: "none" | "ascending" | "descending"; /** * The primary sort column of the message list.*/ sortType?: "none" | "date" | "subject" | "author" | "id" | "thread" | "priority" | "status" | "size" | "flagged" | "unread" | "recipient" | "location" | "tags" | "junkStatus" | "attachments" | "account" | "custom" | "received" | "correspondent"; /** * Grouping type of the message list.*/ viewType?: "ungrouped" | "groupedByThread" | "groupedBySortType"; windowId: number; } export interface MailTabProperties { /** * Sets the folder displayed in the mail tab. Requires the accountsRead permission. The previous message selection in the given folder will be restored, if any.*/ displayedFolder?: folders.MailFolderId | folders.MailFolder; /** * Sets the currently used folder mode, enabling it if required. If used without also specifying `displayedFolder`, the currently selected folder is re-selected in the new folder mode, if possible.*/ folderMode?: mailTabs.FolderMode; /** * Set the enabled folder modes in the folder pane, and their sort order.*/ folderModesEnabled?: mailTabs.FolderMode[]; /** * Shows or hides the folder pane.*/ folderPaneVisible?: boolean; /** * Sets the arrangement of the folder pane, message list pane, and message display pane. Setting a layout will be applied to all mail tabs.*/ layout?: "standard" | "wide" | "vertical"; /** * Shows or hides the message display pane.*/ messagePaneVisible?: boolean; /** * Sorts the list of messages. `sortType` must also be given.*/ sortOrder?: "none" | "ascending" | "descending"; /** * Sorts the list of messages. `sortOrder` must also be given.*/ sortType?: "none" | "date" | "subject" | "author" | "id" | "thread" | "priority" | "status" | "size" | "flagged" | "unread" | "recipient" | "location" | "tags" | "junkStatus" | "attachments" | "account" | "custom" | "received" | "correspondent"; /** * Sets the grouping type of displayed messages.*/ viewType?: "ungrouped" | "groupedByThread" | "groupedBySortType"; } export interface QuickFilterTextDetail { /** * Shows messages where `text` matches the author.*/ author?: boolean; /** * Shows messages where `text` matches the message body.*/ body?: boolean; /** * Shows messages where `text` matches the recipients.*/ recipients?: boolean; /** * Shows messages where `text` matches the subject.*/ subject?: boolean; /** * String to match against the `recipients`, `author`, `subject`, or `body`.*/ text: string; } export interface QueryQueryInfo { /** * Whether the tabs are active in their windows.*/ active?: boolean; /** * Whether the tabs are in the current window.*/ currentWindow?: boolean; /** * Whether the tabs are in the last focused window.*/ lastFocusedWindow?: boolean; /** * The ID of the parent window, or $(ref:windows.WINDOW_ID_CURRENT) for the current window.*/ windowId?: number; } /** * Gets all mail tabs that have the specified properties, or all mail tabs if no properties are specified.*/ export function query(queryInfo?: QueryQueryInfo): Promise; /** * Get the {@link mailTabs.MailTab} properties of a mail tab.*/ export function get(/** * ID of the requested mail tab. Throws if the requested `tabId` does not belong to a mail tab.*/ tabId: number): Promise; /** * Get the {@link mailTabs.MailTab} properties of the active mail tab. Returns `undefined`, if the active tab is not a mail tab.*/ export function getCurrent(): Promise; /** * Creates a new mail tab. Standard tab properties can be adjusted via {@link tabs.update} after the mail tab has been created. A new mail window can be created via {@link windows.create}.*/ export function create(createProperties?: mailTabs.MailTabProperties): Promise; /** * Modifies the properties of a mail tab. Properties that are not specified in `updateProperties` are not modified.*/ export function update(/** * Defaults to the active tab of the current window.*/ tabId: number, updateProperties: mailTabs.MailTabProperties): Promise; /** * Modifies the properties of a mail tab. Properties that are not specified in `updateProperties` are not modified.*/ export function update(updateProperties: mailTabs.MailTabProperties): Promise; export interface GetListedMessagesOptions { /** * The sort order for the returned messages. Ignored if `sortType` is not specified.*/ sortOrder?: "ascending" | "descending"; /** * Specifies how the returned messages should be sorted. This does not change the actual sort of the displayed messages. Default sort order is `descending`, if not specified otherwise. Returning sorted messages is faster than manually sorting the messages afterwards, but slower than returning the messages in their original order.*/ sortType?: "author" | "date" | "flagged" | "junk" | "junkScore" | "priority" | "read" | "recipients" | "size" | "subject" | "tags"; } /** * Lists the messages in the current view, honoring sort order and filters as used in the UI. Sort order of the returned messages can be overridden via the `options` parameter*/ export function getListedMessages(/** * Defaults to the active tab of the current window.*/ tabId?: number, options?: GetListedMessagesOptions): Promise; /** * Lists the selected folders in the folder pane. Does not include folders which are context-clicked, but not selected. The context-clicked folders are always returned by the {@link menus.onClicked} event of the menus API.*/ export function getSelectedFolders(/** * Defaults to the active tab of the current window.*/ tabId?: number): Promise; /** * Lists the selected messages in the current folder. Includes messages in collapsed threads. Does not include messages which are context-clicked, but not selected. The context-clicked messages are always returned by the {@link menus.onClicked} event of the menus API.*/ export function getSelectedMessages(/** * Defaults to the active tab of the current window.*/ tabId?: number): Promise; /** * Selects none, one or multiple messages. Opens collapsed threads to show the selection, if required.*/ export function setSelectedMessages(/** * Defaults to the active tab of the current window.*/ tabId: number, /** * The IDs of the messages, which should be selected. The mail tab will switch to the folder of the selected messages. Throws if they belong to different folders. Array can be empty to deselect any currently selected message.*/ messageIds: messages.MessageId[]): Promise; /** * Selects none, one or multiple messages. Opens collapsed threads to show the selection, if required.*/ export function setSelectedMessages(/** * The IDs of the messages, which should be selected. The mail tab will switch to the folder of the selected messages. Throws if they belong to different folders. Array can be empty to deselect any currently selected message.*/ messageIds: messages.MessageId[]): Promise; export interface SetQuickFilterProperties { /** * Shows only messages with attachments.*/ attachment?: boolean; /** * Shows only messages from people in the address book.*/ contact?: boolean; /** * Shows only flagged messages.*/ flagged?: boolean; /** * Shows or hides the Quick Filter bar.*/ show?: boolean; /** * Shows only messages with tags on them.*/ tags?: boolean | messages.tags.TagsDetail; /** * Shows only messages matching the supplied text.*/ text?: mailTabs.QuickFilterTextDetail; /** * Shows only unread messages.*/ unread?: boolean; } /** * Sets the Quick Filter user interface based on the options specified.*/ export function setQuickFilter(/** * Defaults to the active tab of the current window.*/ tabId: number, properties: SetQuickFilterProperties): Promise; /** * Sets the Quick Filter user interface based on the options specified.*/ export function setQuickFilter(properties: SetQuickFilterProperties): Promise; /** * Fired when the displayed folder changes in any mail tab.*/ export const onDisplayedFolderChanged: WebExtEvent<(tab: tabs.Tab, displayedFolder: folders.MailFolder) => void>; /** * Fired when the selected messages change in any mail tab.*/ export const onSelectedMessagesChanged: WebExtEvent<(tab: tabs.Tab, selectedMessages: messages.MessageList) => void>; } namespace management { /** * Information about an icon belonging to an extension.*/ export interface IconInfo { /** * A number representing the width and height of the icon. Likely values include (but are not limited to) 128, 48, 24, and 16.*/ size: number; /** * The URL for this icon image. To display a grayscale version of the icon (to indicate that an extension is disabled, for example), append `?grayscale=true` to the URL.*/ url: string; } /** * A reason the item is disabled.*/ export type ExtensionDisabledReason = "unknown" | "permissions_increase"; /** * The type of this extension, 'extension' or 'theme'.*/ export type ExtensionType = "extension" | "theme"; /** * How the extension was installed.*/ export type ExtensionInstallType = "development" | "normal" | "sideload" | "admin" | "other"; /** * Information about an installed extension.*/ export interface ExtensionInfo { /** * The description of this extension.*/ description: string; /** * A reason the item is disabled.*/ disabledReason?: ExtensionDisabledReason; /** * Whether it is currently enabled or disabled.*/ enabled: boolean; /** * The URL of the homepage of this extension.*/ homepageUrl?: string; /** * Returns a list of host based permissions.*/ hostPermissions?: string[]; /** * A list of icon information. Note that this just reflects what was declared in the manifest, and the actual image at that url may be larger or smaller than what was declared, so you might consider using explicit width and height attributes on img tags referencing these images. See the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/icons|manifest documentation on icons} for more details.*/ icons?: IconInfo[]; /** * The extension's unique identifier.*/ id: string; /** * How the extension was installed.*/ installType: ExtensionInstallType; /** * Whether this extension can be disabled or uninstalled by the user.*/ mayDisable: boolean; /** * The name of this extension.*/ name: string; /** * The url for the item's options page, if it has one.*/ optionsUrl: string; /** * Returns a list of API based permissions.*/ permissions?: string[]; /** * A short version of the name of this extension.*/ shortName?: string; /** * The type of this extension, 'extension' or 'theme'.*/ type: ExtensionType; /** * The update URL of this extension.*/ updateUrl?: string; /** * The {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/version|version} of this extension.*/ version: string; /** * The {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/version_name|version name} of this extension if the manifest specified one.*/ versionName?: string; } /** * Returns a list of information about installed extensions.*/ export function getAll(): Promise; /** * Returns information about the installed extension that has the given ID.*/ export function get(/** * The ID from an item of {@link management.ExtensionInfo}.*/ id: manifest.ExtensionID): Promise; export interface InstallOptions { /** * A hash of the XPI file, using sha256 or stronger.*/ hash?: string; /** * URL pointing to the XPI file on addons.mozilla.org or similar.*/ url: manifest.HttpURL; } /** * Installs and enables a theme extension from the given url.*/ export function install(options: InstallOptions): Promise<{ id: manifest.ExtensionID; }>; /** * Returns information about the calling extension. Note: This function can be used without requesting the 'management' permission in the manifest.*/ export function getSelf(): Promise; export interface UninstallSelfOptions { /** * The message to display to a user when being asked to confirm removal of the extension.*/ dialogMessage?: string; /** * Whether or not a confirm-uninstall dialog should prompt the user. Defaults to false.*/ showConfirmDialog?: boolean; } /** * Uninstalls the calling extension. Note: This function can be used without requesting the 'management' permission in the manifest.*/ export function uninstallSelf(options?: UninstallSelfOptions): Promise; /** * Enables or disables the given add-on.*/ export function setEnabled(/** * ID of the add-on to enable/disable.*/ id: string, /** * Whether to enable or disable the add-on.*/ enabled: boolean): Promise; /** * Fired when an addon has been disabled.*/ export const onDisabled: WebExtEvent<(info: ExtensionInfo) => void>; /** * Fired when an addon has been enabled.*/ export const onEnabled: WebExtEvent<(info: ExtensionInfo) => void>; /** * Fired when an addon has been installed.*/ export const onInstalled: WebExtEvent<(info: ExtensionInfo) => void>; /** * Fired when an addon has been uninstalled.*/ export const onUninstalled: WebExtEvent<(info: ExtensionInfo) => void>; } namespace menus { /** * 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 {@link https://developer.thunderbird.net/add-ons/mailextensions/supported-ui-elements#menu-items|Supported UI Elements} article on developer.thunderbird.net.*/ export type ContextType = "all" | "all_message_attachments" | "audio" | "browser_action" | "browser_action_menu" | "compose_action" | "compose_action_menu" | "compose_attachments" | "compose_body" | "editable" | "folder_pane" | "frame" | "header_pane_link" | "image" | "link" | "message_attachments" | "message_display_action" | "message_display_action_menu" | "message_list" | "page" | "password" | "selection" | "tab" | "tools_menu" | "video"; /** * The type of menu item.*/ export type ItemType = "normal" | "checkbox" | "radio" | "separator"; /** * 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.*/ export interface OnShowData { /** * 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.*/ attachments?: (compose.ComposeAttachment | messages.MessageAttachment)[]; /** * A list of all contexts that apply to the menu.*/ contexts: ContextType[]; /** * The displayed folder. Only available for the `message_list` context. The accountsRead permission is required.*/ displayedFolder?: folders.MailFolder; /** * A flag indicating whether the element is editable (text input, textarea, etc.).*/ editable: boolean; /** * An identifier of the clicked Thunderbird UI element, if any.*/ fieldId?: "composeSubject" | "composeTo" | "composeCc" | "composeBcc" | "composeReplyTo" | "composeNewsgroupTo"; /** * The URL of the frame of the element where the context menu was clicked, if it was in a frame.*/ frameUrl?: string; /** * If the element is a link, the text of that link.*/ linkText?: string; /** * If the element is a link, the URL it points to.*/ linkUrl?: string; /** * One of `image`, `video`, or `audio` if the context menu was activated on one of these types of elements.*/ mediaType?: string; /** * A list of IDs of the menu items that were shown.*/ menuIds: (number | string)[]; /** * 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.*/ pageUrl?: string; /** * 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.* * @deprecated Deprecated since Thunderbird 128 and removed in Manifest V3: The selectedAccount property has been replaced by the selectedFolders property, returning the root folder of the account.*/ selectedAccount?: accounts.MailAccount; /** * 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.* * @deprecated Deprecated since Thunderbird 128 and removed in Manifest V3: The selectedFolder property has been replaced by the selectedFolders property.*/ selectedFolder?: folders.MailFolder; /** * 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 Thunderbird's UI, which may not be the currently 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.*/ selectedFolders?: folders.MailFolder[]; /** * 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 Thunderbird's UI, which may not be the currently 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.*/ selectedMessages?: messages.MessageList; /** * The text for the context selection, if any.*/ selectionText?: string; /** * Will be present for elements with a _src_ URL.*/ srcUrl?: string; /** * An identifier of the clicked content element, if any. Use {@link menus.getTargetElement} in the page to find the corresponding element.*/ targetElementId?: number; /** * The type of view where the menu is shown. May be unset if the menu is not associated with a view.*/ viewType?: extension.ViewType; } /** * Information sent when a context menu item is clicked.*/ export interface OnClickData { /** * 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.*/ attachments?: (compose.ComposeAttachment | messages.MessageAttachment)[]; /** * An integer value of button by which menu item was clicked.*/ button?: number; /** * A flag indicating the state of a checkbox or radio item after it is clicked.*/ checked?: boolean; /** * The displayed folder. Only available for the `message_list` context. The accountsRead permission is required.*/ displayedFolder?: folders.MailFolder; /** * A flag indicating whether the element is editable (text input, textarea, etc.).*/ editable: boolean; /** * An identifier of the clicked Thunderbird UI element, if any.*/ fieldId?: "composeSubject" | "composeTo" | "composeCc" | "composeBcc" | "composeReplyTo" | "composeNewsgroupTo"; /** * The id of the frame of the element where the context menu was clicked.*/ frameId?: number; /** * The URL of the frame of the element where the context menu was clicked, if it was in a frame.*/ frameUrl?: string; /** * If the element is a link, the text of that link.*/ linkText?: string; /** * If the element is a link, the URL it points to.*/ linkUrl?: string; /** * One of `image`, `video`, or `audio` if the context menu was activated on one of these types of elements.*/ mediaType?: string; /** * The ID of the menu item that was clicked.*/ menuItemId: number | string; /** * An array of keyboard modifiers that were held while the menu item was clicked.*/ modifiers: ("Shift" | "Alt" | "Command" | "Ctrl" | "MacCtrl")[]; /** * 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.*/ pageUrl?: string; /** * The parent ID, if any, for the item clicked.*/ parentMenuItemId?: number | string; /** * 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.* * @deprecated Deprecated since Thunderbird 128 and removed in Manifest V3: The selectedAccount property has been replaced by the selectedFolders property, returning the root folder of the account.*/ selectedAccount?: accounts.MailAccount; /** * 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.* * @deprecated Deprecated since Thunderbird 128 and removed in Manifest V3: The selectedFolder property has been replaced by the selectedFolders property.*/ selectedFolder?: folders.MailFolder; /** * 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 Thunderbird's UI, which may not be the currently 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.*/ selectedFolders?: folders.MailFolder[]; /** * 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 Thunderbird's UI, which may not be the currently 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.*/ selectedMessages?: messages.MessageList; /** * The text for the context selection, if any.*/ selectionText?: string; /** * Will be present for elements with a _src_ URL.*/ srcUrl?: string; /** * An identifier of the clicked content element, if any. Use {@link menus.getTargetElement} in the page to find the corresponding element.*/ targetElementId?: number; /** * The type of view where the menu is clicked. May be unset if the menu is not associated with a view.*/ viewType?: extension.ViewType; /** * A flag indicating the state of a checkbox or radio item before it was clicked.*/ wasChecked?: boolean; } /** * 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.*/ type MenuIconPath = string | string; /** * 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 {@link menus.MenuIconPath}.*/ export interface MenuIconDictionary { [key: string]: MenuIconPath; } /** * A predefined command to open an action popup.*/ export type MenuActionCommand = "_execute_browser_action" | "_execute_compose_action" | "_execute_message_display_action"; export interface CreateCreateProperties { /** * 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.*/ checked?: boolean; /** * Specifies a command to issue for the context click. Can either be a user defined command, or one of the predefined action commands.*/ command?: string | menus.MenuActionCommand; /** * List of contexts this menu item will appear in. Defaults to `['page']` if not specified.*/ contexts?: ContextType[]; /** * 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 {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns|Match Patterns}.*/ documentUrlPatterns?: string[]; /** * Whether this context menu item is enabled or disabled. Defaults to true.*/ enabled?: boolean; /** * Custom icons to display next to the menu item. Custom icons can only be set for items appearing in submenus.*/ icons?: MenuIconPath | MenuIconDictionary; /** * The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension.*/ id?: string; /** * A function that will be called back when the menu item is clicked. Event pages cannot use this.*/ onclick?: (/** * Information about the item clicked and the context where the click happened.*/ info: OnClickData, /** * The details of the tab where the click took place.*/ tab: tabs.Tab) => void; /** * The ID of a parent menu item; this makes the item a child of a previously added item.*/ parentId?: number | string; /** * Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags.*/ targetUrlPatterns?: string[]; /** * 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`.*/ title?: string; /** * The type of menu item. Defaults to `normal` if not specified.*/ type?: ItemType; /** * List of view types where the menu item will be shown. Defaults to any view, including those without a viewType.*/ viewTypes?: extension.ViewType[]; /** * Whether the item is visible in the menu.*/ visible?: boolean; } /** * 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 {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/lastError|runtime.lastError}).*/ export function create(createProperties: CreateCreateProperties): number | string; /** * The properties to update. Accepts the same values as the create function.*/ export interface UpdateUpdateProperties { checked?: boolean; contexts?: ContextType[]; documentUrlPatterns?: string[]; enabled?: boolean; icons?: MenuIconPath | MenuIconDictionary; onclick?: (info: OnClickData, /** * The details of the tab where the click took place.*/ tab: tabs.Tab) => void; /** * The hierarchical parent of the element. Updating an element to become a child of its own descendants is not supported.*/ parentId?: number | string; targetUrlPatterns?: string[]; title?: string; type?: ItemType; viewTypes?: extension.ViewType[]; /** * Whether the item is visible in the menu.*/ visible?: boolean; } /** * Updates a previously created context menu item.*/ export function update(/** * The ID of the item to update.*/ id: number | string, /** * The properties to update. Accepts the same values as the create function.*/ updateProperties: UpdateUpdateProperties): Promise; /** * Removes a context menu item.*/ export function remove(/** * The ID of the context menu item to remove.*/ menuItemId: number | string): Promise; /** * Removes all context menu items added by this extension.*/ export function removeAll(): Promise; export interface OverrideContextContextOptions { /** * 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.*/ context?: "tab"; /** * Whether to also include default menu items in the menu.*/ showDefaults?: boolean; /** * Required when context is `tab`. Requires the tabs permission.*/ tabId?: number; } /** * Show the matching menu items from this extension instead of the default menu. This should be called during a {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/contextmenu_event|contextmenu} event handler, and only applies to the menu that opens after this event.*/ export function overrideContext(contextOptions: OverrideContextContextOptions): void; /** * 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.*/ export function refresh(): Promise; /** * Retrieve the element that was associated with a recent {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/contextmenu_event|contextmenu} event.*/ export function getTargetElement(/** * The identifier of the clicked element, available as `info.targetElementId` in the {@link menus.onShown} and {@link menus.onClicked} events.*/ targetElementId: number): { [key: string]: any; }; /** * Fired when a context menu item is clicked. This is a user input event handler. For asynchronous listeners some {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/User_actions|restrictions} apply.*/ export const onClicked: WebExtEvent<(/** * Information about the item clicked and the context where the click happened.*/ info: OnClickData, /** * 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.*/ tab?: tabs.Tab) => void>; /** * Fired when a menu is shown. The extension can add, modify or remove menu items and call {@link menus.refresh} to update the menu.*/ export const onShown: WebExtEvent<(/** * Information about the context of the menu action and the created menu items.*/ info: OnShowData, /** * The details of the tab where the menu was opened.*/ tab: tabs.Tab) => void>; /** * Fired when a menu is hidden. This event is only fired if onShown has fired before.*/ export const onHidden: WebExtEvent<() => void>; /** * 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.*/ export const ACTION_MENU_TOP_LEVEL_LIMIT: 6; } namespace messageDisplay { /** * Gets the currently displayed message in the specified tab (even if the tab itself is currently not visible), or the currently active tab. It returns `null` if no messages are displayed, or if multiple messages are displayed.*/ export function getDisplayedMessage(tabId?: number): Promise; /** * Gets an array of the currently displayed messages in the specified tab (even if the tab itself is currently not visible), or the currently active tab. The array is empty if no messages are displayed.*/ export function getDisplayedMessages(tabId?: number): Promise; /** * Settings for opening the message. Exactly one of messageId, headerMessageId or file must be specified.*/ export interface OpenOpenProperties { /** * Whether the new tab should become the active tab in the window. Only applicable to messages opened in tabs.*/ active?: boolean; /** * The DOM file object of a message to be opened.*/ file?: { [key: string]: any; }; /** * The headerMessageId of a message to be opened. Will throw an _ExtensionError_, if the provided `headerMessageId` is unknown or invalid. Not supported for external messages.*/ headerMessageId?: string; /** * Where to open the message. If not specified, the users preference is honoured.*/ location?: "tab" | "window"; /** * The id of a message to be opened. Will throw an _ExtensionError_, if the provided `messageId` is unknown or invalid.*/ messageId?: messages.MessageId; /** * The id of the window, where the new tab should be created. Defaults to the current window. Only applicable to messages opened in tabs.*/ windowId?: number; } /** * Opens a message in a new tab or in a new window.*/ export function open(/** * Settings for opening the message. Exactly one of messageId, headerMessageId or file must be specified.*/ openProperties: OpenOpenProperties): Promise; /** * Fired when a message is displayed, whether in a 3-pane tab, a message tab, or a message window.*/ export const onMessageDisplayed: WebExtEvent<(tab: tabs.Tab, message: messages.MessageHeader) => void>; /** * Fired when either a single message is displayed or when multiple messages are displayed, whether in a 3-pane tab, a message tab, or a message window.*/ export const onMessagesDisplayed: WebExtEvent<(tab: tabs.Tab, messages: messages.MessageHeader[]) => void>; } namespace messageDisplayAction { /** * An array of four integers in the range [0,255] that make up the RGBA color. For example, opaque red is `[255, 0, 0, 255]`.*/ type ColorArray = number[]; /** * Pixel data for an image. Must be an {@link https://developer.mozilla.org/en-US/docs/Web/API/ImageData|ImageData} object (for example, from a {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/canvas|canvas} element).*/ export interface ImageDataType { } /** * A _dictionary object_ to specify multiple {@link https://developer.mozilla.org/en-US/docs/Web/API/ImageData|ImageData} objects in different sizes, so the icon does not have to be scaled for a device with a different pixel density. Each entry is a _name-value_ pair with _value_ being an {@link https://developer.mozilla.org/en-US/docs/Web/API/ImageData|ImageData} object, and _name_ its size.*/ export interface ImageDataDictionary { [key: string]: ImageDataType; } /** * Information sent when a messageDisplayAction button is clicked.*/ export interface OnClickData { /** * An integer value of button by which menu item was clicked.*/ button?: number; /** * An array of keyboard modifiers that were held while the menu item was clicked.*/ modifiers: ("Shift" | "Alt" | "Command" | "Ctrl" | "MacCtrl")[]; } export interface SetTitleDetails { /** * Sets the title only for the given tab.*/ tabId?: number; /** * A string the messageDisplayAction button should display as its label and when moused over. Cleared by setting it to `null` or an empty string (title defined the manifest will be used).*/ title: string | null; } /** * Sets the title of the messageDisplayAction button. Is used as tooltip and as the label.*/ export function setTitle(details: SetTitleDetails): Promise; export interface GetTitleDetails { /** * Specifies for which tab the title should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the title of the messageDisplayAction button.*/ export function getTitle(details: GetTitleDetails): Promise; export interface SetLabelDetails { /** * A string the messageDisplayAction button should use as its label, overriding the defined title. Can be set to an empty string to not display any label at all. If the containing toolbar is configured to display text only, its title will be used. Cleared by setting it to `null`.*/ label: string | null; /** * Sets the label only for the given tab.*/ tabId?: number; } /** * Sets the label of the messageDisplayAction button. Can be used to set different values for the tooltip (defined by the title) and the label. Additionally, the label can be set to an empty string, not showing any label at all.*/ export function setLabel(details: SetLabelDetails): Promise; export interface GetLabelDetails { /** * Specifies for which tab the label should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the label of the messageDisplayAction button. Returns `null`, if no label has been set and the title is used.*/ export function getLabel(details: GetLabelDetails): Promise; export interface SetIconDetails { /** * The image data for one or more icons for the composeAction button.*/ imageData?: ImageDataType | ImageDataDictionary; /** * The paths to one or more icons for the messageDisplayAction button.*/ path?: manifest.IconPath; /** * Sets the icon only for the given tab.*/ tabId?: number; } /** * Sets the icon for the messageDisplayAction button. Either the `path` or the `imageData` property must be specified.*/ export function setIcon(details: SetIconDetails): Promise; export interface SetPopupDetails { /** * The html file to show in a popup. Can be set to an empty string to not open a popup. Cleared by setting it to `null` (action will use the popup value defined in the manifest).*/ popup: string | null; /** * Sets the popup only for the given tab.*/ tabId?: number; } /** * Sets the html document to be opened as a popup when the user clicks on the messageDisplayAction button.*/ export function setPopup(details: SetPopupDetails): Promise; export interface GetPopupDetails { /** * Specifies for which tab the popup document should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the html document set as the popup for this messageDisplayAction button.*/ export function getPopup(details: GetPopupDetails): Promise; export interface SetBadgeTextDetails { /** * Sets the badge text only for the given tab.*/ tabId?: number; /** * Any number of characters can be passed, but only about four can fit in the space. Cleared by setting it to `null` or an empty string.*/ text: string | null; } /** * Sets the badge text for the messageDisplayAction button. The badge is displayed on top of the icon.*/ export function setBadgeText(details: SetBadgeTextDetails): Promise; export interface GetBadgeTextDetails { /** * Specifies for which tab the badge text should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the badge text of the messageDisplayAction button.*/ export function getBadgeText(details: GetBadgeTextDetails): Promise; export interface SetBadgeTextColorDetails { /** * The color to use as text color in the badge. Cleared by setting it to `null`.*/ color: string | ColorArray | null; /** * Sets the text color for the badge only for the given tab.*/ tabId?: number; } /** * Sets the text color for the badge.*/ export function setBadgeTextColor(details: SetBadgeTextColorDetails): Promise; export interface GetBadgeTextColorDetails { /** * Specifies for which tab the badge text color should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the text color of the badge.*/ export function getBadgeTextColor(details: GetBadgeTextColorDetails): Promise; export interface SetBadgeBackgroundColorDetails { /** * The color to use as background in the badge. Cleared by setting it to `null`.*/ color: string | ColorArray | null; /** * Sets the background color for the badge only for the given tab.*/ tabId?: number; } /** * Sets the background color for the badge.*/ export function setBadgeBackgroundColor(details: SetBadgeBackgroundColorDetails): Promise; export interface GetBadgeBackgroundColorDetails { /** * Specifies for which tab the badge background color should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Gets the badge background color of the messageDisplayAction button.*/ export function getBadgeBackgroundColor(details: GetBadgeBackgroundColorDetails): Promise; /** * Enables the messageDisplayAction button for a specific tab (if a `tabId` is provided), or for all tabs which do not have a custom enable state. Once the enable state of a tab has been updated individually, all further changes to its state have to be done individually as well. By default, a messageDisplayAction button is enabled.*/ export function enable(/** * The id of the tab for which you want to modify the messageDisplayAction button.*/ tabId?: number): Promise; /** * Disables the messageDisplayAction button for a specific tab (if a `tabId` is provided), or for all tabs which do not have a custom enable state. Once the enable state of a tab has been updated individually, all further changes to its state have to be done individually as well.*/ export function disable(/** * The id of the tab for which you want to modify the messageDisplayAction button.*/ tabId?: number): Promise; export interface IsEnabledDetails { /** * Specifies for which tab the state should be retrieved. If no tab is specified, the global value is retrieved.*/ tabId?: number; } /** * Checks whether the messageDisplayAction button is enabled.*/ export function isEnabled(details: IsEnabledDetails): Promise; /** * An object with information about the popup to open.*/ export interface OpenPopupOptions { /** * Defaults to the current window.*/ windowId?: number; } /** * Opens the action's popup window in the specified window. Defaults to the current window. Returns false if the popup could not be opened because the action has no popup, is of type `menu`, is disabled or has been removed from the toolbar.*/ export function openPopup(/** * An object with information about the popup to open.*/ options?: OpenPopupOptions): Promise; /** * Fired when a messageDisplayAction button is clicked. This event will not fire if the messageDisplayAction has a popup. This is a user input event handler. For asynchronous listeners some {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/User_actions|restrictions} apply.*/ export const onClicked: WebExtEvent<(tab: tabs.Tab, info?: OnClickData) => void>; } namespace messages { export type MessageId = number; /** * An inline part with content type `text/*`. These parts are not returned by {@link messages.listAttachments} and usually make up the readable content of the message, mostly with content type `text/plain` or `text/html`*/ export interface InlineTextPart { /** * The content of this inline text part.*/ content: string; /** * The content type of the part. Most common types for inline text parts are `text/plain` and `text/html`. Possible other (deprecated) types are `text/richtext` and `text/enriched`. Some calendaring services include an inline text part with type `text/calendar`.*/ contentType: string; } /** * Content may either be a single email address, or a mailbox string (see RFC 5322, section 3.4). Use {@link messengerUtilities.parseMailboxString} to extract the name and/or the email from the mailbox string.*/ export type MailBoxHeaderString = string; /** * Basic information about a message.*/ export interface MessageHeader { author: messages.MailBoxHeaderString; /** * The Bcc recipients. Not populated for news/nntp messages.*/ bccList: messages.MailBoxHeaderString[]; /** * The Cc recipients. Not populated for news/nntp messages.*/ ccList: messages.MailBoxHeaderString[]; /** * The date and time when the message was sent, according to the Date header in the message.*/ date: extensionTypes.Date; /** * Whether this message is a real message or an external message (opened from a file or from an attachment).*/ external: boolean; /** * Whether this message is flagged (a.k.a. starred).*/ flagged: boolean; /** * The accountsRead permission is required for this property to be included. Not available for external or attached messages.*/ folder?: folders.MailFolder; /** * The message-id header of the message.*/ headerMessageId: string; /** * Some account types (for example `pop3`) allow to download only the headers of the message, but not its body. The body of such messages will not be available.*/ headersOnly: boolean; id: messages.MessageId; /** * Whether the message has been marked as junk. Always `false` for news/nntp messages and external messages.*/ junk: boolean; /** * The junk score associated with the message. Always `0` for news/nntp messages and external messages.*/ junkScore: number; /** * Whether the message has been received recently and is marked as new.*/ new: boolean; /** * The priority of the message.*/ priority: "none" | "lowest" | "low" | "normal" | "high" | "highest"; /** * Whether the message has been marked as read. Not available for external or attached messages.*/ read?: boolean; /** * The To recipients. Not populated for news/nntp messages.*/ recipients: messages.MailBoxHeaderString[]; /** * The total size of the message in bytes.*/ size: number; /** * The subject of the message.*/ subject: string; /** * Tags associated with this message. For a list of available tags, use {@link messages.tags.list}.*/ tags: string[]; } /** * See $(doc:guides/messageLists) for more information.*/ export interface MessageList { /** * Id of the message list, to be used with {@link messages.continueList} or {@link messages.abortList}.*/ id: string | null; messages: messages.MessageHeader[]; } /** * Represents an email message "part", which could be the whole message.*/ export interface MessagePart { /** * The quoted-printable or base64 decoded content of the part. Only present for parts with a content type of `text/*` and only if requested, see the `decodeContent` option of {@link messages.getFull}. Use {@link messages.getAttachmentFile} to retrieve the content of parts which have a content type other than `text/*`.*/ body?: string; contentType?: string; /** * The decryption status, only available for the root part.*/ decryptionStatus?: "none" | "skipped" | "success" | "fail"; /** * A _dictionary object_ of RFC 2047 decoded part headers as _key-value_ pairs, with the header name as _key_, and an array of headers as _value_. Only present if requested, see the `decodeHeaders` option of {@link messages.getFull}.*/ headers?: messages.HeadersDictionary; /** * Name of the part, if it is a file.*/ name?: string; /** * The identifier of this part, used in {@link messages.getAttachmentFile}.*/ partName?: string; /** * Any sub-parts of this part.*/ parts?: messages.MessagePart[]; /** * The raw content of the part. Only present if requested, see the `decodeContent` option of {@link messages.getFull}.*/ rawBody?: string; /** * A _dictionary object_ of raw part headers as _key-value_ pairs, with the header name as _key_, and an array of headers as _value_. Only present if requested, see the `decodeHeaders` option of {@link messages.getFull}.*/ rawHeaders?: messages.HeadersDictionary; /** * The size of this part. The size of parts with content type _message/rfc822_ is not the actual message size (on disc), but the total size of its decoded body parts, excluding headers.*/ size?: number; } /** * Message properties used in {@link messages.update} and {@link messages.import}. They can also be monitored by {@link messages.onUpdated}.*/ export interface MessageProperties { /** * Whether the message is flagged (a.k.a starred).*/ flagged?: boolean; /** * Whether the message is marked as junk. Only supported in {@link messages.update}.*/ junk?: boolean; /** * Whether the message is marked as new. Only supported in {@link messages.import}.*/ new?: boolean; /** * Whether the message is marked as read.*/ read?: boolean; /** * Tags associated with this message. For a list of available tags, call the {@link messages.tags.list} method.*/ tags?: string[]; } /** * The type of an attachment in a message.*/ export type AttachmentType = "normal" | "detached" | "deleted" | "linked" | "cloudFile"; /** * Represents an attachment in a message.*/ export interface MessageAttachment { /** * The remote location a `cloudFile` attachment's content is stored at. Present for `cloudFile` attachments (see {@link messages.AttachmentType}), whose content is not part of the message.*/ cloudFileUrl?: string; /** * The content disposition of the attachment, for example `attachment` for normal attachments, or `inline` for inline attachments.*/ contentDisposition: string; /** * The content-id of this part. Available for related parts, which are referenced from other places inside the same message (e.g. inline images).*/ contentId?: string; /** * The content type of the attachment. A value of `text/x-moz-deleted` indicates that the original attachment was permanently deleted and replaced by a placeholder text attachment with some meta information about the original attachment.*/ contentType: string; /** * A _dictionary object_ of RFC 2047 decoded attachment headers as _key-value_ pairs, with the header name as _key_, and an array of headers as _value_.*/ headers: messages.HeadersDictionary; /** * The remote location the attachment's content is linked to. Present for `linked` attachments (see {@link messages.AttachmentType}), whose content is not part of the message and can be fetched from this url.*/ linkUrl?: string; /** * A MessageHeader, if this attachment is a message.*/ message?: messages.MessageHeader; /** * The name, as displayed to the user, of this attachment. This is usually but not always the filename of the attached file. For a `cloudFile` attachment, this is the real name of the linked file, when the message provides one.*/ name: string; /** * Identifies the MIME part of the message associated with this attachment.*/ partName: string; /** * The size in bytes of this attachment.*/ size: number; /** * The type of this attachment.*/ type: messages.AttachmentType; } /** * A _dictionary object_ of headers as _key-value_ pairs, with the header name as _key_, and an array of headers as _value_.*/ export interface HeadersDictionary { } /** * An object defining a range.*/ export interface QueryRange { /** * The maximum value required to match the query.*/ max?: number; /** * The minimum value required to match the query.*/ min?: number; } /** * Details of a message to be sent.*/ export interface NewMessageDetails { /** * An additional fcc folder. Only effective for send operations ({@link messages.sendMessage}), has no effect for save operations ({@link messages.saveMessage}), which only ever store the message in the primary draft or template folder. For compatibility with {@link compose.ComposeDetails}, setting an empty string is supported as well, but has no effect.*/ additionalFccFolder?: folders.MailFolder | (""); /** * Wether or not the vCard of the used identity will be attached to the message during send.*/ attachVCard?: boolean; /** * Attachments to add to the message. **Note:** {@link compose.ComposeAttachments} are included as real file attachments, not as cloudFile links.*/ attachments?: (compose.FileAttachment | compose.ComposeAttachment)[]; bcc?: compose.ComposeRecipientList; /** * The HTML content for the message.*/ body?: string; cc?: compose.ComposeRecipientList; /** * The languages of the message content, used for the _Content-Language_ header. Each entry is a free-form language tag (for example `en-US`). If omitted, no _Content-Language_ header is added. The i18n API's `detectLanguage()` can be used to derive a value from the message body, which should be converted to plain text first (for example via {@link messengerUtilities.convertToPlainText}), so that markup does not influence the detection.*/ contentLanguage?: string[]; /** * Array of custom headers.*/ customHeaders?: compose.CustomHeader[]; /** * Defines the mime format of the sent message. Defaults to auto, which prefers to send plain text messages, if the specified body does not include any formatting. **Note**: If a plain text body and an HTML body is included in the message, the plain text body is always derived from the included HTML body. It is not possible to specify two independent values via body and plainTextBody.*/ deliveryFormat?: "auto" | "plaintext" | "html" | "both"; /** * Let the sender know when the recipient's server received the message. Not supported by all servers.*/ deliveryStatusNotification?: boolean; followupTo?: compose.ComposeRecipientList; /** * *Caution*: Setting a value for from does not change the used identity, it overrides the FROM header. Many email servers do not accept emails where the FROM header does not match the sender identity. Must be set to exactly one valid email address.*/ from?: compose.ComposeRecipient; /** * The ID of an identity from the $(doc:accounts) API. Defaults to the default identity. The permission accountsRead is required to include the identityId.*/ identityId?: string; /** * Whether the message should be sent as plain text or as HTML. Prefers a specified plainTextBody over a specified body.*/ isPlainText?: boolean; /** * A single newsgroup name or an array of newsgroup names.*/ newsgroups?: string | string[]; /** * This value overrides the default fcc setting (defined by the used identity) for this message. Either a {@link folders.MailFolder} specifying the folder for the copy of the sent message, or an empty string to not save a copy at all.*/ overrideDefaultFccFolder?: folders.MailFolder | (""); /** * The content for a plain text message. A specified body will be preferred, except when isPlainText is specified as well.*/ plainTextBody?: string; /** * The priority of the message.*/ priority?: "lowest" | "low" | "normal" | "high" | "highest"; replyTo?: compose.ComposeRecipientList; /** * Add the _Disposition-Notification-To_ header to the message to requests the recipients email client to send a reply once the message has been received. Recipient server may strip the header and the recipient might ignore the request.*/ returnReceipt?: boolean; subject: string; to?: compose.ComposeRecipientList; } export interface ListOptions { /** * The sort order for the returned messages. Ignored if `sortType` is not specified.*/ sortOrder?: "ascending" | "descending"; /** * Specifies how the returned messages should be sorted. Default sort order is `descending`, if not specified otherwise. Returning sorted messages is faster than manually sorting the messages afterwards, but slower than returning the messages in their original order.*/ sortType?: "author" | "date" | "flagged" | "junk" | "junkScore" | "priority" | "read" | "recipients" | "size" | "subject" | "tags"; } /** * Gets all messages in a folder.*/ export function list(folder: folders.MailFolder | folders.MailFolderId, options?: ListOptions): Promise; /** * Returns the next chunk of messages in a list. See $(doc:guides/messageLists) for more information.*/ export function continueList(messageListId: string): Promise; /** * Finalizes the specified list and terminates any process currently still adding messages.*/ export function abortList(messageListId: string): Promise; /** * Returns the specified message.*/ export function get(messageId: messages.MessageId): Promise; export interface GetFullOptions { /** * Whether to decode quoted-printable or base64 encoded content of message parts. Defaults to `true`.*/ decodeContent?: boolean; /** * Whether to decode RFC 2047 encoded headers of message parts. Defaults to `true`.*/ decodeHeaders?: boolean; /** * Whether the message should be decrypted. If the message could not be decrypted, its parts are omitted. Defaults to `true`.*/ decrypt?: boolean; } /** * Returns the specified message, including all headers and MIME parts. Throws if the message could not be read, for example due to network issues.*/ export function getFull(messageId: messages.MessageId, options?: GetFullOptions): Promise; export interface GetHeadersOptions { /** * Whether to decode RFC 2047 encoded headers. Defaults to `true`.*/ decodeHeaders?: boolean; } /** * Returns all message headers of the specified message, without MIME structure parsing. Throws an error if the message cannot be read, for example due to network issues. This function is significantly faster than {@link messages.getFull} when only the header information is required.*/ export function getHeaders(messageId: messages.MessageId, options?: GetHeadersOptions): Promise; export interface GetRawOptions { /** * The message can either be returned as a DOM File or as a {@link https://udn.realityripple.com/docs/Web/API/DOMString/Binary|binary string}. The historic default is to return a binary string (kept for backward compatibility). However, it is now recommended to use the `File` format, because the DOM File object can be used as-is with the downloads API and has useful methods to access the content, like {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob/text|File.text()} and {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob/arrayBuffer|File.arrayBuffer()}.*/ data_format?: "BinaryString" | "File"; /** * Whether the message should be decrypted. Throws, if the message could not be decrypted.*/ decrypt?: boolean; } /** * Returns the raw content of a message. Throws if the message could not be read, for example due to network issues.*/ export function getRaw(/** * Either a {@link messages.MessageId} of an existing message, or a {@link messages.MessagePart} with raw header and raw content data representing a full RFC 822 message (the provided data will be used as-is without applying any further encoding). See the `decodeHeaders` and `decodeContent` options of {@link messages.getFull} for further details on how to retrieve a {@link messages.MessagePart} with raw values. You can use {@link messengerUtilities.decodeMimeHeader} and {@link messengerUtilities.encodeMimeHeader} to manipulate a raw MessagePart.*/ message: messages.MessageId | messages.MessagePart, options?: GetRawOptions): Promise; /** * Lists the attachments of a message. If the message is encrypted, the attachments of the decrypted message are listed.*/ export function listAttachments(messageId: messages.MessageId): Promise; /** * Lists all inline text parts of a message. These parts are not returned by {@link messages.listAttachments} and usually make up the readable content of the message, mostly with content type `text/plain` or `text/html`. If a message only includes a part with content type `text/html`, the method {@link messengerUtilities.convertToPlainText} can be used to retreive a plain text version. If the message is encrypted, the inline text parts of the decrypted message are listed.*/ export function listInlineTextParts(messageId: messages.MessageId): Promise; /** * Gets the content of a {@link messages.MessageAttachment} as a {@link https://developer.mozilla.org/en-US/docs/Web/API/File|File} object. If the message is encrypted, the function retrieves the attachment from the decrypted message.*/ export function getAttachmentFile(messageId: messages.MessageId, /** * The `partName` of an attachment to be retrieved from the decrypted message.*/ partName: string): Promise<{ [key: string]: any; }>; /** * Deletes the specified attachments and replaces them by placeholder text attachments with meta information about the original attachments and a `text/x-moz-deleted` content type. This permanently modifies the message. Deleting attachments of encrypted messages is not supported and will throw an _ExtensionError_.*/ export function deleteAttachments(messageId: number, /** * An array of attachments, identifying the to be deleted attachments by their `partName`.*/ partNames: string[]): Promise; /** * Opens the specified attachment.*/ export function openAttachment(messageId: messages.MessageId, partName: string, /** * The ID of the tab associated with the message opening.*/ tabId: number): Promise; export interface QueryQueryInfo { /** * Limits the search to the specified account(s). Accounts are searched in the specified order.*/ accountId?: accounts.MailAccountId | accounts.MailAccountId[]; /** * Whether the message has attachments, or not. Supports to specify a {@link messages.QueryRange} (min/max) instead of a simple boolean value (none/some).*/ attachment?: boolean | QueryRange; /** * Returns only messages with this value matching the author. The search value is a single email address, a name or a combination (e.g.: `Name `). The address part of the search value (if provided) must match the author's address completely. The name part of the search value (if provided) must match the author's name partially. All matches are done case-insensitive.*/ author?: string; /** * Set the timeout in ms after which results should be returned, even if the nominal number of messages-per-page has not yet been reached. Defaults to `1000` ms. Setting it to `0` will disable auto-pagination.*/ autoPaginationTimeout?: number; /** * Returns only messages with this value in the body of the mail.*/ body?: string; /** * Returns only flagged (or unflagged if false) messages.*/ flagged?: boolean; /** * Returns only messages from the specified folder. The accountsRead permission is required.* * @deprecated Support deprecated since Thunderbird 121 and removed in Manifest V3: messages.queryInfo.folder has been replaced by messages.queryInfo.folderId.*/ folder?: folders.MailFolder; /** * Limits the search to the specified folder(s). Folders are searched in the specified order. The accountsRead permission is required.*/ folderId?: folders.MailFolderId | folders.MailFolderId[]; /** * Returns only messages with a date after this value.*/ fromDate?: extensionTypes.Date; /** * Returns only messages with the author's address matching any configured identity.*/ fromMe?: boolean; /** * Returns only messages with this value somewhere in the mail (subject, body or author).*/ fullText?: string; /** * Returns only messages with a Message-ID header matching this value.*/ headerMessageId?: string; /** * Search the specified folder recursively.*/ includeSubFolders?: boolean; /** * Returns only messages whith the specified junk state.*/ junk?: boolean; /** * Returns only messages with a junk score in the specified range.*/ junkScore?: QueryRange; /** * Set the nominal number of messages-per-page for this query. Defaults to `100` messages.*/ messagesPerPage?: number; /** * Returns only messages with the specified new state.*/ new?: boolean; /** * Query the server directly instead of the local message database. Online queries currently only support querying the `headerMessageId` property. Currently only supported for NNTP accounts.*/ online?: boolean; /** * Returns only messages whose recipients match all specified addresses. The search value is a semicolon separated list of email addresses, names or combinations (e.g.: `Name `). For a match, all specified addresses must equal a recipient's address completely and all specified names must match a recipient's name partially. All matches are done case-insensitive.*/ recipients?: string; /** * The _messageListId_ is usually returned together with the first page, after some messages have been found. Enabling this option will change the return value of this function and return the _messageListId_ directly.*/ returnMessageListId?: boolean; /** * Returns only messages with a size in the specified byte range.*/ size?: QueryRange; /** * Returns only messages whose subject contains the provided string.*/ subject?: string; /** * Returns only messages with the specified tags. For a list of available tags, call the {@link messages.tags.list} method.*/ tags?: messages.tags.TagsDetail; /** * Returns only messages with a date before this value.*/ toDate?: extensionTypes.Date; /** * Returns only messages with at least one recipient address matching any configured identity.*/ toMe?: boolean; /** * Returns only unread (or read if false) messages.*/ unread?: boolean; } /** * Gets all messages that have the specified properties, or all messages if no properties are specified. Messages of unified mailbox folders are not included by default (as that could double the amount of returned messages), but explicitly specifying a unified mailbox folder is supported.*/ export function query(queryInfo?: QueryQueryInfo): Promise; /** * Updates message properties and tags. Updating external messages will throw an _ExtensionError_.*/ export function update(messageId: messages.MessageId, newProperties: messages.MessageProperties): Promise; export interface MoveOptions { /** * Whether this move operation should be treated as a user action, for example allowing undo.*/ isUserAction?: boolean; } /** * Moves messages to a specified folder. If the messages cannot be removed from the source folder, they will be copied instead of moved. Moving external messages will throw an _ExtensionError_.*/ export function move(/** * The IDs of the messages to move.*/ messageIds: messages.MessageId[], /** * The folder to move the messages to.*/ destination: folders.MailFolder | folders.MailFolderId, options?: MoveOptions): Promise; export interface CopyOptions { /** * Whether this copy operation should be treated as a user action, for example allowing undo.*/ isUserAction?: boolean; } /** * Copies messages to a specified folder.*/ export function copy(/** * The IDs of the messages to copy.*/ messageIds: messages.MessageId[], /** * The folder to copy the messages to.*/ destination: folders.MailFolder | folders.MailFolderId, options?: CopyOptions): Promise; /** * Deletes messages permanently, or moves them to the trash folder (honoring the account's deletion behavior settings). Deleting external messages will throw an _ExtensionError_. The `deletePermanently` parameter allows immediate permanent deletion, bypassing the trash folder.*/ function __delete(/** * The IDs of the messages to delete.*/ messageIds: messages.MessageId[], options?: boolean | { /** * Whether the message will be deleted permanently, regardless of the account's deletion behavior settings. A permanently deleted message cannot be restored, even if the action is defined as a user action. Use this with care!*/ deletePermanently?: boolean; /** * Whether this copy operation should be treated as a user action, for example allowing undo.*/ isUserAction?: boolean; }): Promise; export { __delete as delete }; export interface ImportFile { } /** * Imports a message into a folder. Supports local folders, POP and IMAP folders. Throws, if the destination folder already contains a message with the Message-ID of the message being imported.*/ function __import(file: ImportFile, /** * The folder to import the messages into.*/ destination: folders.MailFolder | folders.MailFolderId, properties?: messages.MessageProperties): Promise; export { __import as import }; export interface SendMessageOptions { mode: "default" | "sendNow" | "sendLater"; } /** * Sends a message programmatically in the background without user interaction. If the send mode is not specified or set to default, the message will be sent directly if the user is online and placed in the user's outbox otherwise. The returned Promise fulfills once the message has been successfully sent or placed in the user's outbox. Throws when there has been an error while sending the message to the outgoing mail server. **Note:** If no deliveryFormat is specified, the message is sent as plain text when the body contains no HTML formatting. **Note:** It is possible to pass in a {@link compose.ComposeDetails} object as the details parameter, and it will be interpreted as a {@link messages.NewMessageDetails} object.*/ export function sendMessage(details: messages.NewMessageDetails, options?: SendMessageOptions): Promise<{ /** * The header messageId of the outgoing message. Only included for actually sent messages.*/ headerMessageId?: string; /** * Copies of the sent message. The number of created copies depends on the applied file carbon copy configuration (fcc).*/ messages: messages.MessageHeader[]; /** * The used send mode.*/ mode: "sendNow" | "sendLater"; }>; export interface SaveMessageOptions { mode: "draft" | "template"; } /** * Saves a message programmatically as a draft or as a template in the background without user interaction. The save mode defaults to draft. The returned Promise fulfills once the message has been successfully saved. Throws when there has been an error while saving the message. **Note:** If no deliveryFormat is specified, the message is saved as plain text when the body contains no HTML formatting.*/ export function saveMessage(details: NewMessageDetails, options?: SaveMessageOptions): Promise<{ /** * The saved message(s). The number of saved messages depends on the applied file carbon copy configuration (fcc).*/ messages: messages.MessageHeader[]; /** * The used save mode.*/ mode: "draft" | "template"; }>; /** * Archives messages using the current settings. Archiving external messages will throw an _ExtensionError_.*/ export function archive(/** * The IDs of the messages to archive.*/ messageIds: messages.MessageId[]): Promise; /** * Returns a list of tags that can be set on messages, and their human-friendly name, colour, and sort order.* * @deprecated Deprecated since Thunderbird 121 and removed in Manifest V3: messages.listTags() is now available as messages.tags.list().*/ export function listTags(): Promise; /** * Creates a new message tag. Tagging a message will store the tag's key in the user's message. Throws if the specified tag key is used already.* * @deprecated Deprecated since Thunderbird 121 and removed in Manifest V3: messages.createTag() is now available as messages.tags.create().*/ export function createTag(/** * Unique tag identifier (will be converted to lower case). Must be an ASCII string that is safe to use as an IMAP keyword.*/ key: string, /** * Human-readable tag name.*/ tag: string, /** * Tag color in hex format (i.e.: `#000080` for navy blue).*/ color: string): Promise; export interface UpdateTagUpdateProperties { /** * Tag color in hex format (i.e.: `#000080` for navy blue).*/ color?: string; /** * Human-readable tag name.*/ tag?: string; } /** * Updates a message tag. Throws if the specified tag key does not exist.* * @deprecated Deprecated since Thunderbird 121 and removed in Manifest V3: messages.updateTag() is now available as messages.tags.update().*/ export function updateTag(/** * Unique tag identifier (will be converted to lower case). Must not include `()<>{/%*"` or spaces.*/ key: string, updateProperties: UpdateTagUpdateProperties): Promise; /** * Deletes a message tag, removing it from the list of known tags. Its key will not be removed from tagged messages, but they will appear untagged. Recreating a deleted tag, will make all former tagged messages appear tagged again.* * @deprecated Deprecated since Thunderbird 121 and removed in Manifest V3: messages.deleteTag() is now available as messages.tags.delete().*/ export function deleteTag(/** * Unique tag identifier (will be converted to lower case). Must not include `()<>{/%*"` or spaces.*/ key: string): Promise; /** * Fired when one or more properties of a message have been updated.*/ export const onUpdated: WebExtEvent<(message: messages.MessageHeader, changedProperties: messages.MessageProperties, oldProperties: messages.MessageProperties) => void>; /** * Fired when messages have been moved.*/ export const onMoved: WebExtEvent<(originalMessages: messages.MessageList, movedMessages: messages.MessageList) => void>; /** * Fired when messages have been copied.*/ export const onCopied: WebExtEvent<(originalMessages: messages.MessageList, copiedMessages: messages.MessageList) => void>; /** * Fired when messages have been permanently deleted.*/ export const onDeleted: WebExtEvent<(messages: messages.MessageList) => void>; /** * Fired when a new message is received, and has been handled by message filters and junk classification. Filters running after junk classification may move the message again.*/ export const onNewMailReceived: { addListener: (callback: (folder: folders.MailFolder, messages: messages.MessageList) => void, monitorAllFolders?: boolean) => void; removeListener: (callback: (folder: folders.MailFolder, messages: messages.MessageList) => void) => void; hasListener: (callback: (folder: folders.MailFolder, messages: messages.MessageList) => void) => boolean; }; } namespace messages.tags { export interface MessageTag { /** * Tag color in upper case hex format (i.e.: `#000080` for navy blue).*/ color: string; /** * Unique tag identifier.*/ key: string; /** * A custom sort string.*/ ordinal: string; /** * Human-readable tag name.*/ tag: string; } export interface MessageTagProperties { /** * Tag color in upper case hex format (i.e.: `#000080` for navy blue).*/ color?: string; /** * A custom sort string.*/ ordinal?: string; /** * Human-readable tag name.*/ tag?: string; } /** * Used for filtering messages by tag in various methods. Note that functions using this type may have a partial implementation.*/ export interface TagsDetail { /** * Whether `all` of the tag filters must apply, `any` of them, or `none`. The `none` mode ignores the provided filters and selects only messages without any tags.*/ mode: "all" | "any" | "none"; /** * A _dictionary object_ with one or more filter condition as _key-value_ pairs, the _key_ being the tag to filter on, and the _value_ being a boolean expression, requesting whether a message must include (`true`) or exclude (`false`) the tag. For a list of available tags, call the {@link messages.tags.list} method.*/ tags: { [key: string]: any; }; } /** * Returns a list of tags that can be set on messages, and their human-friendly name, colour, and sort order.*/ export function list(): Promise; /** * Returns a message tag identified by its key.*/ export function get(/** * The key of the message tag to retrieve.*/ key: string): Promise; /** * Creates a new message tag and returns the associated key. Tagging a message will store the tag's key in the user's message. Throws if the specified tag key is used already.*/ export function create(/** * Unique tag identifier (will be converted to lower case). Must be an ASCII string that is safe to use as an IMAP keyword. Will be auto-generated if not provided.*/ key: string, /** * Human-readable tag name.*/ tag: string, /** * Tag color in hex format (i.e.: `#000080` for navy blue).*/ color: string): Promise; /** * Creates a new message tag and returns the associated key. Tagging a message will store the tag's key in the user's message. Throws if the specified tag key is used already.*/ export function create(/** * Human-readable tag name.*/ tag: string, /** * Tag color in hex format (i.e.: `#000080` for navy blue).*/ color: string): Promise; /** * Updates a message tag. Throws if the specified tag key does not exist.*/ export function update(/** * Unique tag identifier (will be converted to lower case). Must not include `()<>{/%*"` or spaces.*/ key: string, updateProperties: messages.tags.MessageTagProperties): Promise; /** * Deletes a message tag, removing it from the list of known tags. Its key will not be removed from tagged messages, but they will appear untagged. Recreating a deleted tag, will make all former tagged messages appear tagged again.*/ function __delete(/** * Unique tag identifier (will be converted to lower case). Must not include `()<>{/%*"` or spaces.*/ key: string): Promise; export { __delete as delete }; /** * Fired when a new message tag has been created.*/ export const onCreated: WebExtEvent<(tag: messages.tags.MessageTag) => void>; /** * Fired when one or more properties of a message tag have been updated.*/ export const onUpdated: WebExtEvent<(/** * Unique tag identifier of the updated message tag.*/ key: string, /** * The changed message tag properties.*/ changedProperties: messages.tags.MessageTagProperties, /** * The old values of the changed message tag properties.*/ oldProperties: messages.tags.MessageTagProperties) => void>; /** * Fired when a message tag has been deleted.*/ export const onDeleted: WebExtEvent<(/** * Unique tag identifier of the deleted message tag.*/ key: string) => void>; } namespace messengerSettings { /** * Whether the inline (real-time) spell checker is enabled in the message compose window.*/ export const composeInlineSpellCheckEnabled: types.Setting; /** * The line length limit for outgoing messages, to comply with requirements from RFC 2822. See description of {@link messengerSettings.messagePlainTextFlowedOutputEnabled}. This property is read-only.*/ export const messageLineLengthLimit: types.Setting; /** * Whether long lines in outgoing plain text messages will get soft line breaks (` `) or hard line breaks (` `), to comply with requirements from RFC 2822. Soft line breaks will be ignored when displayed by the receiving client. When flowed output is enabled, add-ons should not create plain text messages with manually inserted hard or soft line breaks to achieve a certain text width, as that will most probably interfere with the default line break handling and generate ridged text. When flowed output is disabled, add-ons could add hard line breaks to have control over the final message, but any line longer than the maximum line length will still receive additional hard line breaks. See {@link messengerSettings.messageLineLengthLimit}. This property is read-only.*/ export const messagePlainTextFlowedOutputEnabled: types.Setting; /** * Whether supported attachments (for example, media files) are shown inline within the body of displayed messages. This property is read-only.*/ export const readerDisplayAttachmentsInline: types.Setting; } namespace messengerUtilities { /** * Representation of a parsed mailbox string (see RFC 5322, section 3.4).*/ export interface ParsedMailbox { /** * The `addr-spec` associated with the provided address, if available.*/ email?: string; /** * The members of the group, if available.*/ group?: messengerUtilities.ParsedMailbox[]; /** * The `display-name` associated with the provided address or group, if available.*/ name?: string; } /** * MIME headers, which by default are treated as containing one or more mailbox strings.*/ export type MailboxHeaders = "bcc" | "cc" | "from" | "reply-to" | "resent-bcc" | "resent-cc" | "resent-from" | "resent-reply-to" | "resent-sender" | "resent-to" | "sender" | "to" | "approved" | "disposition-notification-to" | "delivered-to" | "return-receipt-to" | "mail-reply-to" | "mail-followup-to"; export interface ConvertToPlainTextOptions { /** * The converted plain text will be wrapped to lines not longer than 72 characters and use format flowed, as defined by RFC 2646.*/ flowed?: boolean; } /** * Converts the provided body to readable plain text, without tags and leading/trailing whitespace.*/ export function convertToPlainText(/** * The to-be-converted body.*/ body: string, options?: ConvertToPlainTextOptions): Promise; /** * Returns the provided file size in a human readable format (e.g. `12 bytes` or `11,4 GB`).*/ export function formatFileSize(/** * The size in bytes.*/ sizeInBytes: number): Promise; /** * Parse a mailbox string containing one or more email addresses (see RFC 5322, section 3.4).*/ export function parseMailboxString(/** * The string to be parsed (e.g. `User , other-user@example.com`)*/ mailboxString: string, options?: boolean | { /** * Expand Thunderbird mailing lists (specified as `ListName `) and include the parsed primary email addresses of all members. When used together with `preserveGroups`, the mailing list's name and hierarchy are preserved. If the mailing list does not exist, or the addressBook permission is not granted, the entries are not expanded and returned unchanged.*/ expandMailingLists?: boolean; /** * Keep grouped hierarchies. Groups may be specified in a mailbox string as follows: `GroupName : user1 , user2@example,com ;`.*/ preserveGroups?: boolean; }): Promise; /** * Decode the provided header into a readable format according to RFC 2047.*/ export function decodeMimeHeader(headerName: string, headerValue: string | string[], /** * Headers containing multiple mailbox strings need special handling. For example the header `=?UTF-8?Q?H=C3=B6rst=2C_Kenny?= , new@thunderbird.bug` will be wrongly decoded to `Hörst, Kenny , new@thunderbird.bug`, corrupting the structure of the first mailbox string. This option overrides the default behavior of treating the headers defined in {@link messengerUtilities.MailboxHeaders} as mailbox headers.*/ isMailBoxHeader?: boolean): Promise; /** * Encode the provided header according to RFC 2047.*/ export function encodeMimeHeader(headerName: string, headerValue: string | string[], /** * Headers containing multiple mailbox strings need special handling. This option overrides the default behavior of treating the headers defined in {@link messengerUtilities.MailboxHeaders} as mailbox headers.*/ isMailBoxHeader?: boolean): Promise; } namespace notifications { export type TemplateType = "basic" | "image" | "list" | "progress"; export type PermissionLevel = "granted" | "denied"; export interface NotificationItem { /** * Additional details about this item.*/ message: string; /** * Title of one item of a list notification.*/ title: string; } export interface CreateNotificationOptions { /** * A URL to the app icon mask.*/ appIconMaskUrl?: string; /** * Alternate notification content with a lower-weight font.*/ contextMessage?: string; /** * A timestamp associated with the notification, in milliseconds past the epoch.*/ eventTime?: number; /** * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.*/ iconUrl?: string; /** * A URL to the image thumbnail for image-type notifications.*/ imageUrl?: string; /** * Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification.*/ isClickable?: boolean; /** * Items for multi-item notifications.*/ items?: NotificationItem[]; /** * Main notification content.*/ message: string; /** * Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default.*/ priority?: number; /** * Current progress ranges from 0 to 100.*/ progress?: number; /** * Title of the notification (e.g. sender name for email).*/ title: string; /** * Which type of notification to display.*/ type: TemplateType; } export interface UpdateNotificationOptions { /** * A URL to the app icon mask.*/ appIconMaskUrl?: string; /** * Alternate notification content with a lower-weight font.*/ contextMessage?: string; /** * A timestamp associated with the notification, in milliseconds past the epoch.*/ eventTime?: number; /** * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.*/ iconUrl?: string; /** * A URL to the image thumbnail for image-type notifications.*/ imageUrl?: string; /** * Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification.*/ isClickable?: boolean; /** * Items for multi-item notifications.*/ items?: NotificationItem[]; /** * Main notification content.*/ message?: string; /** * Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default.*/ priority?: number; /** * Current progress ranges from 0 to 100.*/ progress?: number; /** * Title of the notification (e.g. sender name for email).*/ title?: string; /** * Which type of notification to display.*/ type?: TemplateType; } /** * Creates and displays a notification.*/ export function create(/** * Identifier of the notification. If it is empty, this method generates an id. If it matches an existing notification, this method first clears that notification before proceeding with the create operation.*/ notificationId: string, /** * Contents of the notification.*/ options: CreateNotificationOptions): Promise; /** * Creates and displays a notification.*/ export function create(/** * Contents of the notification.*/ options: CreateNotificationOptions): Promise; /** * Clears an existing notification.*/ export function clear(/** * The id of the notification to be updated.*/ notificationId: string): Promise; /** * Retrieves all the notifications.*/ export function getAll(): Promise<{ [key: string]: CreateNotificationOptions; }>; /** * Fired when the notification closed, either by the system or by user action.*/ export const onClosed: WebExtEvent<(/** * The notificationId of the closed notification.*/ notificationId: string, /** * True if the notification was closed by the user.*/ byUser: boolean) => void>; /** * Fired when the user clicked in a non-button area of the notification.*/ export const onClicked: WebExtEvent<(/** * The notificationId of the clicked notification.*/ notificationId: string) => void>; /** * Fired when the user pressed a button in the notification.*/ export const onButtonClicked: WebExtEvent<(/** * The notificationId of the clicked notification.*/ notificationId: string, /** * The index of the button clicked by the user.*/ buttonIndex: number) => void>; /** * Fired when the notification is shown.*/ export const onShown: WebExtEvent<(/** * The notificationId of the shown notification.*/ notificationId: string) => void>; } namespace oauthProvider { } namespace permissions { export interface Permissions { data_collection?: manifest.OptionalDataCollectionPermission[]; origins?: manifest.MatchPattern[]; permissions?: (manifest.OptionalPermission | manifest.OptionalOnlyPermission)[]; } export interface AnyPermissions { data_collection?: manifest.OptionalDataCollectionPermission[]; origins?: manifest.MatchPattern[]; permissions?: (manifest.Permission | manifest.OptionalOnlyPermission)[]; } /** * Get a list of all the extension's permissions.*/ export function getAll(): Promise; /** * Check if the extension has the given permissions.*/ export function contains(permissions: AnyPermissions): Promise; /** * Request the given permissions.*/ export function request(permissions: Permissions): Promise; /** * Relinquish the given permissions.*/ export function remove(permissions: Permissions): Promise; /** * Fired when the extension acquires new permissions.*/ export const onAdded: WebExtEvent<(permissions: Permissions) => void>; /** * Fired when permissions are removed from the extension.*/ export const onRemoved: WebExtEvent<(permissions: Permissions) => void>; } namespace pkcs11 { /** * checks whether a PKCS#11 module, given by name, is installed*/ export function isModuleInstalled(name: string): Promise; /** * Install a PKCS#11 module with a given name*/ export function installModule(name: string, flags?: number): Promise; /** * Remove an installed PKCS#11 module from firefox*/ export function uninstallModule(name: string): Promise; /** * Enumerate a module's slots, each with their name and whether a token is present*/ export function getModuleSlots(name: string): Promise; } namespace privacy { } namespace privacy.network { /** * The IP handling policy of WebRTC.*/ export type IPHandlingPolicy = "default" | "default_public_and_private_interfaces" | "default_public_interface_only" | "disable_non_proxied_udp" | "proxy_only"; /** * An object which describes TLS minimum and maximum versions.*/ export interface tlsVersionRestrictionConfig { /** * The maximum TLS version supported.*/ maximum?: "TLSv1" | "TLSv1.1" | "TLSv1.2" | "TLSv1.3" | "unknown"; /** * The minimum TLS version supported.*/ minimum?: "TLSv1" | "TLSv1.1" | "TLSv1.2" | "TLSv1.3" | "unknown"; } /** * The mode for https-only mode.*/ export type HTTPSOnlyModeOption = "always" | "private_browsing" | "never"; /** * Allow users to query the status of 'Global Privacy Control'. This setting's value is of type boolean, defaulting to `false`.*/ export const globalPrivacyControl: types.Setting; /** * Allow users to query the mode for 'HTTPS-Only Mode'. This setting's value is of type HTTPSOnlyModeOption, defaulting to `never`.*/ export const httpsOnlyMode: types.Setting; /** * If enabled, the browser attempts to speed up your web browsing experience by pre-resolving DNS entries, prerendering sites (`<link rel='prefetch' ...>`), and preemptively opening TCP and SSL connections to servers. This preference's value is a boolean, defaulting to `true`.*/ export const networkPredictionEnabled: types.Setting; /** * Allow users to enable and disable RTCPeerConnections (aka WebRTC).*/ export const peerConnectionEnabled: types.Setting; /** * This property controls the minimum and maximum TLS versions. This setting's value is an object of {@link tlsVersionRestrictionConfig}.*/ export const tlsVersionRestriction: types.Setting; /** * Allow users to specify the media performance/privacy tradeoffs which impacts how WebRTC traffic will be routed and how much local address information is exposed. This preference's value is of type IPHandlingPolicy, defaulting to `default`.*/ export const webRTCIPHandlingPolicy: types.Setting; } namespace privacy.services { /** * If enabled, the password manager will ask if you want to save passwords. This preference's value is a boolean, defaulting to `true`.*/ export const passwordSavingEnabled: types.Setting; } namespace privacy.websites { /** * The mode for tracking protection.*/ export type TrackingProtectionModeOption = "always" | "never" | "private_browsing"; /** * The settings for cookies.*/ export interface CookieConfig { /** * The type of cookies to allow.*/ behavior?: "allow_all" | "reject_all" | "reject_third_party" | "allow_visited" | "reject_trackers" | "reject_trackers_and_partition_foreign"; /** * Whether to create all cookies as nonPersistent (i.e., session) cookies.* * @deprecated This property has no effect anymore and its value is always false.*/ nonPersistentCookies?: boolean; } /** * Allow users to specify the default settings for allowing cookies, as well as whether all cookies should be created as non-persistent cookies. This setting's value is of type CookieConfig.*/ export const cookieConfig: types.Setting; /** * If enabled, the browser will associate all data (including cookies, HSTS data, cached images, and more) for any third party domains with the domain in the address bar. This prevents third party trackers from using directly stored information to identify you across different websites, but may break websites where you login with a third party account (such as a Facebook or Google login.) The value of this preference is of type boolean, and the default value is `false`.*/ export const firstPartyIsolate: types.Setting; /** * If enabled, the browser sends auditing pings when requested by a website (`<a ping>`). The value of this preference is of type boolean, and the default value is `true`.*/ export const hyperlinkAuditingEnabled: types.Setting; /** * If enabled, the browser sends `referer` headers with your requests. Yes, the name of this preference doesn't match the misspelled header. No, we're not going to change it. The value of this preference is of type boolean, and the default value is `true`.*/ export const referrersEnabled: types.Setting; /** * If enabled, the browser attempts to appear similar to other users by reporting generic information to websites. This can prevent websites from uniquely identifying users. Examples of data that is spoofed include number of CPU cores, precision of JavaScript timers, the local timezone, and disabling features such as GamePad support, and the WebSpeech and Navigator APIs. The value of this preference is of type boolean, and the default value is `false`.*/ export const resistFingerprinting: types.Setting; /** * Allow users to specify the mode for tracking protection. This setting's value is of type TrackingProtectionModeOption, defaulting to `private_browsing_only`.*/ export const trackingProtectionMode: types.Setting; } namespace proxy { /** * An object which describes proxy settings.*/ export interface ProxyConfig { /** * A URL to use to configure the proxy.*/ autoConfigUrl?: string; /** * Do not prompt for authentication if password is saved.*/ autoLogin?: boolean; /** * The address of the ftp proxy, can include a port. Deprecated since Thunderbird 88.* * @deprecated true*/ ftp?: string; /** * The address of the http proxy, can include a port.*/ http?: string; /** * Use the http proxy server for all protocols.*/ httpProxyAll?: boolean; /** * A list of hosts which should not be proxied.*/ passthrough?: string; /** * Proxy DNS when using SOCKS. DNS queries get leaked to the network when set to false. True by default for SOCKS v5. False by default for SOCKS v4.*/ proxyDNS?: boolean; /** * The type of proxy to use.*/ proxyType?: "none" | "autoDetect" | "system" | "manual" | "autoConfig"; /** * If true (the default value), do not use newer TLS protocol features that might have interoperability problems on the Internet. This is intended only for use with critical infrastructure like the updates, and is only available to privileged addons.*/ respectBeConservative?: boolean; /** * The address of the socks proxy, can include a port.*/ socks?: string; /** * The version of the socks proxy.*/ socksVersion?: number; /** * The address of the ssl proxy, can include a port.*/ ssl?: string; } /** * Fired when proxy data is needed for a request.*/ export const onRequest: { addListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * Indicates if this response was fetched from disk cache.*/ fromCache: boolean; /** * True for private browsing requests.*/ incognito?: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The HTTP request headers that are going to be sent out with this request.*/ requestHeaders?: webRequest.HttpHeaders; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: webRequest.ResourceType; url: string; /** * Url classification if the request has been classified.*/ urlClassification: webRequest.UrlClassification; }) => void, filter: webRequest.RequestFilter, extraInfoSpec?: ("requestHeaders")[]) => void; removeListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * Indicates if this response was fetched from disk cache.*/ fromCache: boolean; /** * True for private browsing requests.*/ incognito?: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The HTTP request headers that are going to be sent out with this request.*/ requestHeaders?: webRequest.HttpHeaders; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: webRequest.ResourceType; url: string; /** * Url classification if the request has been classified.*/ urlClassification: webRequest.UrlClassification; }) => void) => void; hasListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * Indicates if this response was fetched from disk cache.*/ fromCache: boolean; /** * True for private browsing requests.*/ incognito?: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The HTTP request headers that are going to be sent out with this request.*/ requestHeaders?: webRequest.HttpHeaders; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: webRequest.ResourceType; url: string; /** * Url classification if the request has been classified.*/ urlClassification: webRequest.UrlClassification; }) => void) => boolean; }; /** * Notifies about errors caused by the invalid use of the proxy API.*/ export const onError: WebExtEvent<(error: { [key: string]: any; }) => void>; /** * Configures proxy settings. This setting's value is an object of type ProxyConfig.*/ export const settings: types.Setting; } namespace runtime { /** * The type of extension view.*/ export type ContextType = "BACKGROUND" | "POPUP" | "SIDE_PANEL" | "TAB"; /** * A context hosting extension content*/ export interface ExtensionContext { /** * An unique identifier associated to this context*/ contextId: string; /** * The type of the context*/ contextType: ContextType; /** * An UUID for the document associated with this context, or undefined if it is not hosted in a document*/ documentId?: string; /** * The origin of the document associated with this context, or undefined if it is not hosted in a document*/ documentOrigin?: string; /** * The URL of the document associated with this context, or undefined if it is not hosted in a document*/ documentUrl?: string; /** * The frame ID for this context, or -1 if it is not hosted in a frame.*/ frameId: number; /** * Whether the context is associated with an private browsing context.*/ incognito: boolean; /** * The tab ID for this context, or -1 if it is not hosted in a tab.*/ tabId: number; /** * The window ID for this context, or -1 if it is not hosted in a window.*/ windowId: number; } /** * An object which allows two way communication with other pages.*/ export interface Port { disconnect: () => void; name: string; onDisconnect: events.Event; onMessage: events.Event; postMessage: () => void; /** * This property will only be present on ports passed to onConnect/onConnectExternal listeners.*/ sender?: MessageSender; } /** * An object containing information about the script context that sent a message or request.*/ export interface MessageSender { /** * A UUID of the document that opened the connection.*/ documentId?: string; /** * The $(topic:frame_ids)[frame] that opened the connection. 0 for top-level frames, positive for child frames. This will only be set when `tab` is set.*/ frameId?: number; /** * The ID of the extension or app that opened the connection, if any.*/ id?: string; /** * The {@link tabs.Tab} which opened the connection, if any. This property will only be present when the connection was opened from a tab (including content scripts), and only if the receiver is an extension, not an app.*/ tab?: tabs.Tab; /** * The URL of the page or frame that opened the connection. If the sender is in an iframe, it will be iframe's URL not the URL of the page which hosts it.*/ url?: string; /** * The worldId of the USER_SCRIPT world that sent the message. Only present on onUserScriptMessage and onUserScriptConnect (in port.sender) events.*/ userScriptWorldId?: string; /** * The window ID of the document that opened the connection.*/ windowId?: number; } /** * The operating system the browser is running on.*/ export type PlatformOs = "mac" | "win" | "android" | "cros" | "linux" | "openbsd"; /** * The machine's processor architecture.*/ export type PlatformArch = "arm" | "arm64" | "ppc64" | "riscv64" | "s390x" | "sparc64" | "x86-32" | "x86-64" | "noarch"; /** * An object containing information about the current platform.*/ export interface PlatformInfo { /** * The machine's processor architecture.*/ arch: PlatformArch; /** * The operating system the browser is running on.*/ os: PlatformOs; } /** * An object containing information about the current browser.*/ export interface BrowserInfo { /** * The browser's build ID/date, for example '20160101'.*/ buildID: string; /** * The name of the browser, for example 'Thunderbird'.*/ name: string; /** * The name of the browser vendor, for example 'Mozilla'.*/ vendor: string; /** * The browser's version, for example '42.0.0' or '0.8.1pre'.*/ version: string; } /** * Result of the update check.*/ export type RequestUpdateCheckStatus = "throttled" | "no_update" | "update_available"; /** * The reason that this event is being dispatched.*/ export type OnInstalledReason = "install" | "update" | "browser_update"; /** * The reason that the event is being dispatched. 'app_update' is used when the restart is needed because the application is updated to a newer version. 'os_update' is used when the restart is needed because the browser/OS is updated to a newer version. 'periodic' is used when the system runs for more than the permitted uptime set in the enterprise policy.*/ export type OnRestartRequiredReason = "app_update" | "os_update" | "periodic"; /** * The performance warning event category, e.g. 'content_script'.*/ export type OnPerformanceWarningCategory = "content_script"; /** * The performance warning event severity. Will be 'high' for serious and user-visible issues.*/ export type OnPerformanceWarningSeverity = "low" | "medium" | "high"; /** * Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set.*/ export function getBackgroundPage(): Promise<{ [key: string]: any; }>; /** * Fetches information about active contexts associated with this extension*/ export function getContexts(/** * A filter to find matching context.*/ filter: ContextFilter): Promise; /** *

Open your Extension's options page, if possible.

The precise behavior may depend on your manifest's `$(topic:optionsV2)[options_ui]` or `$(topic:options)[options_page]` key, or what the browser happens to support at the time.

If your Extension does not declare an options page, or the browser failed to create one for some other reason, the callback will set {@link lastError}.

*/ export function openOptionsPage(): Promise; /** * Returns details about the app or extension from the manifest. The object returned is a serialization of the full $(topic:manifest)[manifest file].*/ export function getManifest(): { [key: string]: any; }; /** * Returns the extension version as declared in the manifest.*/ export function getVersion(): string; /** * Converts a relative path within an app/extension install directory to a fully-qualified URL.*/ export function getURL(/** * A path to a resource within an app/extension expressed relative to its install directory.*/ path: string): string; /** * Get the documentId of any window global or frame element. Throws for invalid targets, such as unloaded frames.*/ export function getDocumentId(/** * A WindowProxy or a browsing context container Element (iframe, frame, embed, or object) for the target frame.*/ target: any): string; /** * Get the frameId of any window global or frame element.*/ export function getFrameId(/** * A WindowProxy or a browsing context container Element (iframe, frame, embed, or object) for the target frame.*/ target: any): number; /** * Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, and implement surveys. Maximum 1023 characters.*/ export function setUninstallURL(/** * URL to be opened after the extension is uninstalled. This URL must have an http: or https: scheme. Set an empty string to not open a new tab upon uninstallation.*/ url?: string): Promise; /** * Reloads the app or extension.*/ export function reload(): void; export interface ConnectConnectInfo { /** * Whether the TLS channel ID will be passed into onConnectExternal for processes that are listening for the connection event.*/ includeTlsChannelId?: boolean; /** * Will be passed into onConnect for processes that are listening for the connection event.*/ name?: string; } /** * Attempts to connect to connect listeners within an extension/app (such as the background page), or other extensions/apps. This is useful for content scripts connecting to their extension processes, inter-app/extension communication, and $(topic:manifest/externally_connectable)[web messaging]. Note that this does not connect to any listeners in a content script. Extensions may connect to content scripts embedded in tabs via {@link tabs.connect}.*/ export function connect(/** * The ID of the extension or app to connect to. If omitted, a connection will be attempted with your own extension. Required if sending messages from a web page for $(topic:manifest/externally_connectable)[web messaging].*/ extensionId?: string, connectInfo?: ConnectConnectInfo): Port; /** * Connects to a native application in the host machine.*/ export function connectNative(/** * The name of the registered application to connect to.*/ application: string): Port; export interface SendMessageOptions { } /** * Sends a single message to event listeners within your extension/app or a different extension/app. Similar to {@link runtime.connect} but only sends a single message, with an optional response. If sending to your extension, the {@link runtime.onMessage} event will be fired in each page, or {@link runtime.onMessageExternal}, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use {@link tabs.sendMessage}.*/ export function sendMessage(/** * The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for $(topic:manifest/externally_connectable)[web messaging].*/ extensionId: string, message: any, options: SendMessageOptions, responseCallback: (/** * The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and {@link runtime.lastError} will be set to the error message.*/ response: any) => void): void; /** * Sends a single message to event listeners within your extension/app or a different extension/app. Similar to {@link runtime.connect} but only sends a single message, with an optional response. If sending to your extension, the {@link runtime.onMessage} event will be fired in each page, or {@link runtime.onMessageExternal}, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use {@link tabs.sendMessage}.*/ export function sendMessage(message: any, options?: SendMessageOptions, responseCallback?: (/** * The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and {@link runtime.lastError} will be set to the error message.*/ response: any) => void): void; /** * Send a single message to a native application.*/ export function sendNativeMessage(/** * The name of the native messaging host.*/ application: string, /** * The message that will be passed to the native messaging host.*/ message: any, responseCallback?: (/** * The response message sent by the native messaging host. If an error occurs while connecting to the native messaging host, the callback will be called with no arguments and {@link runtime.lastError} will be set to the error message.*/ response: any) => void): void; /** * Returns information about the current browser.*/ export function getBrowserInfo(): Promise; /** * Returns information about the current platform.*/ export function getPlatformInfo(): Promise; /** * Fired when a profile that has this extension installed first starts up. This event is not fired for incognito profiles.*/ export const onStartup: WebExtEvent<() => void>; /** * Fired when the extension is first installed, when the extension is updated to a new version, and when the browser is updated to a new version.*/ export const onInstalled: WebExtEvent<(details: { /** * Indicates the previous version of the extension, which has just been updated. This is present only if 'reason' is 'update'.*/ previousVersion?: string; /** * The reason that this event is being dispatched.*/ reason: OnInstalledReason; /** * Indicates whether the addon is installed as a temporary extension.*/ temporary: boolean; }) => void>; /** * Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up. Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete. If more activity for the event page occurs before it gets unloaded the onSuspendCanceled event will be sent and the page won't be unloaded.*/ export const onSuspend: WebExtEvent<() => void>; /** * Sent after onSuspend to indicate that the app won't be unloaded after all.*/ export const onSuspendCanceled: WebExtEvent<() => void>; /** * Fired when an update is available, but isn't installed immediately because the app is currently running. If you do nothing, the update will be installed the next time the background page gets unloaded, if you want it to be installed sooner you can explicitly call {@link runtime.reload}. If your extension is using a persistent background page, the background page of course never gets unloaded, so unless you call {@link runtime.reload} manually in response to this event the update will not get installed until the next time the browser itself restarts. If no handlers are listening for this event, and your extension has a persistent background page, it behaves as if {@link runtime.reload} is called in response to this event.*/ export const onUpdateAvailable: WebExtEvent<(/** * The manifest details of the available update.*/ details: { /** * The version number of the available update.*/ version: string; } & { [key: string]: any; }) => void>; /** * Fired when a connection is made from either an extension process or a content script.*/ export const onConnect: WebExtEvent<(port: Port) => void>; /** * Fired when a connection is made from a USER_SCRIPT world registered through the userScripts API.*/ export const onUserScriptConnect: WebExtEvent<(port: Port) => void>; /** * Fired when a connection is made from another extension.*/ export const onConnectExternal: WebExtEvent<(port: Port) => void>; /** * Fired when a message is sent from either an extension process or a content script.*/ export const onMessage: WebExtEvent<((/** * The message sent by the calling script.*/ message: any, sender: MessageSender, /** * Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one `onMessage` listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until `sendResponse` is called).*/ sendResponse: () => void) => boolean) | ((sender: MessageSender, /** * Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one `onMessage` listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until `sendResponse` is called).*/ sendResponse: () => void) => boolean)>; /** * Fired when a message is sent from another extension/app. Cannot be used in a content script.*/ export const onMessageExternal: WebExtEvent<((/** * The message sent by the calling script.*/ message: any, sender: MessageSender, /** * Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one `onMessage` listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until `sendResponse` is called).*/ sendResponse: (response?: any) => void) => boolean) | ((sender: MessageSender, /** * Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one `onMessage` listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until `sendResponse` is called).*/ sendResponse: (response?: any) => void) => boolean)>; /** * Fired when a message is sent from a USER_SCRIPT world registered through the userScripts API.*/ export const onUserScriptMessage: WebExtEvent<((/** * The message sent by the calling script.*/ message: any, sender: MessageSender, /** * Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one `onMessage` listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until `sendResponse` is called).*/ sendResponse: () => void) => boolean) | ((sender: MessageSender, /** * Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one `onMessage` listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until `sendResponse` is called).*/ sendResponse: () => void) => boolean)>; /** * Fired when a runtime performance issue is detected with the extension. Observe this event to be proactively notified of runtime performance problems with the extension.*/ export const onPerformanceWarning: WebExtEvent<(details: { /** * The performance warning event category, e.g. 'content_script'.*/ category: OnPerformanceWarningCategory; /** * An explanation of what the warning means, and hopefully how to address it.*/ description: string; /** * The performance warning event severity, e.g. 'high'.*/ severity: OnPerformanceWarningSeverity; /** * The {@link tabs.Tab} that the performance warning relates to, if any.*/ tabId?: number; }) => void>; /** * The ID of the extension/app.*/ export const id: string; /** * This will be defined during an API method callback if there was an error*/ export const lastError: { /** * Details about the error which occurred.*/ message?: string; } & { [key: string]: any; }; } namespace scripting.compose { export interface ComposeScriptDetails { /** * The list of CSS files to be injected. These are injected in the order they appear in this array.*/ css?: manifest.ExtensionURL[]; /** * The id of the compose script, specified in the API call.*/ id: string; /** * The list of JavaScript files to be injected. These are injected in the order they appear in this array.*/ js?: manifest.ExtensionURL[]; /** * Specifies when JavaScript files are injected. The preferred and default value is `document_idle`.*/ runAt?: extensionTypes.RunAt; } export interface ComposeScriptFilter { /** * The IDs of specific compose scripts to retrieve with `getRegisteredScripts()` or to unregister with `unregisterScripts()`.*/ ids?: string[]; } /** * Returns all registered compose scripts for this extension that match the given filter.*/ export function getRegisteredScripts(/** * An object to filter the extension's registered compose scripts.*/ filter: ComposeScriptFilter): Promise; /** * Returns all registered compose scripts for this extension that match the given filter.*/ export function getRegisteredScripts(): Promise; /** * Registers one or more compose scripts for this extension, which should be injected into the message compose editor.*/ export function registerScripts(/** * 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.*/ scripts: ComposeScriptDetails[]): Promise; /** * Unregisters one or more compose scripts for this extension.*/ export function unregisterScripts(/** * If specified, only unregisters compose scripts which match the filter. Otherwise, all of the extension's compose scripts are unregistered.*/ filter: ComposeScriptFilter): Promise; /** * Unregisters one or more compose scripts for this extension.*/ export function unregisterScripts(): Promise; } namespace scripting.messageDisplay { export interface MessageDisplayScriptDetails { /** * The list of CSS files to be injected. These are injected in the order they appear in this array.*/ css?: manifest.ExtensionURL[]; /** * The id of the message display script, specified in the API call.*/ id: string; /** * The list of JavaScript files to be injected. These are injected in the order they appear in this array.*/ js?: manifest.ExtensionURL[]; /** * Specifies when JavaScript files are injected. The preferred and default value is `document_idle`.*/ runAt?: extensionTypes.RunAt; } export interface MessageDisplayScriptFilter { /** * The IDs of specific message display scripts to retrieve with `getRegisteredScripts()` or to unregister with `unregisterScripts()`.*/ ids?: string[]; } /** * Returns all registered message display scripts for this extension that match the given filter.*/ export function getRegisteredScripts(/** * An object to filter the extension's registered message display scripts.*/ filter: MessageDisplayScriptFilter): Promise; /** * Returns all registered message display scripts for this extension that match the given filter.*/ export function getRegisteredScripts(): Promise; /** * Registers one or more message display scripts for this extension, which should be injected into displayed messages.*/ export function registerScripts(/** * 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.*/ scripts: MessageDisplayScriptDetails[]): Promise; /** * Unregisters one or more message display scripts for this extension.*/ export function unregisterScripts(/** * If specified, only unregisters message display scripts which match the filter. Otherwise, all of the extension's message display scripts are unregistered.*/ filter: MessageDisplayScriptFilter): Promise; /** * Unregisters one or more message display scripts for this extension.*/ export function unregisterScripts(): Promise; } namespace scripting { /** * Details of a script injection*/ export interface ScriptInjection { /** * The arguments to curry into a provided function. This is only valid if the `func` parameter is specified. These arguments must be JSON-serializable.*/ args?: any[]; /** * The path of the JS files to inject, relative to the extension's root directory. Exactly one of `files` and `func` must be specified.*/ files?: string[]; /** * A JavaScript function to inject. This function will be serialized, and then deserialized for injection. This means that any bound parameters and execution context will be lost. Exactly one of `files` and `func` must be specified.*/ func?: () => void; /** * Whether the injection should be triggered in the target as soon as possible (but not necessarily prior to page load).*/ injectImmediately?: boolean; /** * Details specifying the target into which to inject the script.*/ target: InjectionTarget; world?: ExecutionWorld; } /** * Result of a script injection.*/ export interface InjectionResult { /** * The document associated with the injection.*/ documentId: string; /** * The error property is set when the script execution failed. The value is typically an (Error) object with a message property, but could be any value (including primitives and undefined) if the script threw or rejected with such a value.*/ error?: any; /** * The frame ID associated with the injection.*/ frameId: number; /** * The result of the script execution.*/ result?: any; } export interface InjectionTarget { /** * Whether the script should inject into all frames within the tab. Defaults to false. This must not be true if `frameIds` is specified.*/ allFrames?: boolean; /** * The IDs of specific documents to inject into. This must not be set if `frameIds` or `allFrames` is set.*/ documentIds?: string[]; /** * The IDs of specific frames to inject into.*/ frameIds?: number[]; /** * The ID of the tab into which to inject.*/ tabId: number; } export interface CSSInjection { /** * A string containing the CSS to inject. Exactly one of `files` and `css` must be specified.*/ css?: string; /** * The path of the CSS files to inject, relative to the extension's root directory. Exactly one of `files` and `css` must be specified.*/ files?: string[]; /** * The style origin for the injection. Defaults to `'AUTHOR'`.*/ origin?: "USER" | "AUTHOR"; /** * Details specifying the target into which to inject the CSS.*/ target: InjectionTarget; } export interface ContentScriptFilter { /** * The IDs of specific scripts to retrieve with `getRegisteredContentScripts()` or to unregister with `unregisterContentScripts()`.*/ ids?: string[]; } /** * The JavaScript world for a script to execute within. `ISOLATED` is the default execution environment of content scripts, `MAIN` is the web page's execution environment.*/ export type ExecutionWorld = "ISOLATED" | "MAIN"; export interface RegisteredContentScript { /** * If specified true, it will inject into all frames, even if the frame is not the top-most frame in the tab. Each frame is checked independently for URL requirements; it will not inject into child frames if the URL requirements are not met. Defaults to false, meaning that only the top frame is matched.*/ allFrames?: boolean; /** * The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array.*/ css?: manifest.ExtensionURL[]; cssOrigin?: extensionTypes.CSSOrigin; /** * Excludes pages that this content script would otherwise be injected into.*/ excludeMatches?: string[]; /** * The id of the content script, specified in the API call.*/ id: string; /** * The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array.*/ js?: manifest.ExtensionURL[]; /** * If matchOriginAsFallback is true, then the code is also injected in about:, data:, blob: when their origin matches the pattern in 'matches', even if the actual document origin is opaque (due to the use of CSP sandbox or iframe sandbox). Match patterns in 'matches' must specify a wildcard path glob. By default it is `false`.*/ matchOriginAsFallback?: boolean; /** * Specifies which pages this content script will be injected into. Must be specified for `registerContentScripts()`.*/ matches?: string[]; /** * Specifies if this content script will persist into future sessions. Defaults to true.*/ persistAcrossSessions?: boolean; /** * Specifies when JavaScript files are injected into the web page. The preferred and default value is `document_idle`.*/ runAt?: extensionTypes.RunAt; /** * The JavaScript world for a script to execute within. Defaults to "ISOLATED".*/ world?: ExecutionWorld; } /** * Injects a script into a target context. The script will be run at `document_idle`.*/ export function executeScript(/** * The details of the script which to inject.*/ injection: ScriptInjection): Promise; /** * Inserts a CSS stylesheet into a target context. If multiple frames are specified, unsuccessful injections are ignored.*/ export function insertCSS(/** * The details of the styles to insert.*/ injection: CSSInjection): Promise; /** * Removes a CSS stylesheet that was previously inserted by this extension from a target context.*/ export function removeCSS(/** * The details of the styles to remove. Note that the `css`, `files`, and `origin` properties must exactly match the stylesheet inserted through `insertCSS`. Attempting to remove a non-existent stylesheet is a no-op.*/ injection: CSSInjection): Promise; /** * Registers one or more content scripts for this extension.*/ export function registerContentScripts(/** * Contains a list of 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.*/ scripts: RegisteredContentScript[]): Promise; /** * Returns all dynamically registered content scripts for this extension that match the given filter.*/ export function getRegisteredContentScripts(/** * An object to filter the extension's dynamically registered scripts.*/ filter: ContentScriptFilter): Promise; /** * Returns all dynamically registered content scripts for this extension that match the given filter.*/ export function getRegisteredContentScripts(): Promise; /** * Unregisters one or more content scripts for this extension.*/ export function unregisterContentScripts(/** * If specified, only unregisters dynamic content scripts which match the filter. Otherwise, all of the extension's dynamic content scripts are unregistered.*/ filter: ContentScriptFilter): Promise; /** * Unregisters one or more content scripts for this extension.*/ export function unregisterContentScripts(): Promise; /** * Updates one or more content scripts for this extension.*/ export function updateContentScripts(/** * Contains a list of scripts to be updated. If there are errors during script parsing/file validation, or if the IDs specified do not already exist, then no scripts are updated.*/ scripts: { /** * If specified true, it will inject into all frames, even if the frame is not the top-most frame in the tab. Each frame is checked independently for URL requirements; it will not inject into child frames if the URL requirements are not met. Defaults to false, meaning that only the top frame is matched.*/ allFrames?: boolean; /** * The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array.*/ css?: manifest.ExtensionURL[]; cssOrigin?: extensionTypes.CSSOrigin; /** * Excludes pages that this content script would otherwise be injected into.*/ excludeMatches?: string[]; /** * The id of the content script, specified in the API call.*/ id: string; /** * The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array.*/ js?: manifest.ExtensionURL[]; /** * If matchOriginAsFallback is true, then the code is also injected in about:, data:, blob: when their origin matches the pattern in 'matches', even if the actual document origin is opaque (due to the use of CSP sandbox or iframe sandbox). Match patterns in 'matches' must specify a wildcard path glob. By default it is `false`.*/ matchOriginAsFallback?: boolean; /** * Specifies which pages this content script will be injected into. Must be specified for `registerContentScripts()`.*/ matches?: string[]; /** * Specifies if this content script will persist into future sessions. Defaults to true.*/ persistAcrossSessions?: boolean; /** * Specifies when JavaScript files are injected into the web page. The preferred and default value is `document_idle`.*/ runAt?: extensionTypes.RunAt; /** * The JavaScript world for a script to execute within. Defaults to "ISOLATED".*/ world?: ExecutionWorld; }[]): Promise; } namespace sessions { /** * Store a key/value pair associated with a given tab.*/ export function setTabValue(/** * ID of the tab with which you want to associate the data. Error is thrown if ID is invalid.*/ tabId: number, /** * Key that you can later use to retrieve this particular data value.*/ key: string, value: string): Promise; /** * 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`.*/ export function getTabValue(/** * ID of the tab whose data you are trying to retrieve. Error is thrown if ID is invalid.*/ tabId: number, /** * Key identifying the particular value to retrieve.*/ key: string): Promise; /** * Remove a key/value pair from a given tab.*/ export function removeTabValue(/** * ID of the tab whose data you are trying to remove. Error is thrown if ID is invalid.*/ tabId: number, /** * Key identifying the particular value to remove.*/ key: string): Promise; } namespace spaces { /** * Properties for the new tab being opened by clicking on the associated button in the spaces toolbar.*/ export interface SpaceTabProperties { /** * The {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/contextualIdentities/ContextualIdentity#cookiestoreid|CookieStore} id used by the tab. Either a custom id created using the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/contextualIdentities|contextualIdentities API}, or a built-in one: `firefox-default`, `firefox-container-1`, `firefox-container-2`, `firefox-container-3`, `firefox-container-4`, `firefox-container-5`.*/ cookieStoreId?: string; /** * Thunderbird is a mail client, not a browser. It is possible to load a web page, but opening follow-up pages through hyperlinks should be handled by the user's default browser. This property specifies to what extent this behavior should be enforced. The default `balanced` link handler will open links to the same host directly in Thunderbird, everything else will be opened in the user's default browser. A `relaxed` link handler will open all links inside of Thunderbird, a `strict` link handler will open all links in the user's default browser, except links to the same page.*/ linkHandler?: "strict" | "balanced" | "relaxed"; /** * The default URL. May point to a WebExtension page or a web page.*/ url?: string; } /** * Properties of a button in the spaces toolbar.*/ export interface SpaceButtonProperties { /** * Sets the background color of the badge. Can be specified as an array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is `[255, 0, 0, 255]`. Can also be a string with an HTML color name (`red`) or a HEX color value (`#FF0000` or `#F00`). Reset when set to an empty string.*/ badgeBackgroundColor?: string | spaces.ColorArray; /** * Sets the badge text for the button in the spaces toolbar. The badge is displayed on top of the icon. Any number of characters can be set, but only about four can fit in the space. Removed when set to an empty string.*/ badgeText?: string; /** * The paths to one or more icons for the button in the spaces toolbar. Reset to the extension icon, when set to an empty string.*/ defaultIcons?: string | manifest.IconPath; /** * Specifies dark and light icons for the button in the spaces toolbar to be used with themes: The `light` icons will be used on dark backgrounds and vice versa. At least the set for _16px_ icons should be specified. The set for _32px_ icons will be used on screens with a very high pixel density, if specified. Reset when set to an empty array.*/ themeIcons?: manifest.ThemeIcons[]; /** * The title for the button in the spaces toolbar, used in the tooltip of the button and as the displayed name in the overflow menu. Reset to the name of the extension, when set to an empty string.*/ title?: string; } /** * An array of four integers in the range [0,255] that make up the RGBA color. For example, opaque red is `[255, 0, 0, 255]`.*/ type ColorArray = number[]; export interface Space { /** * The id of the extension which owns the space. The management permission is required to include this property.*/ extensionId?: string; /** * The id of the space.*/ id: number; /** * Whether this space is one of the default Thunderbird spaces, or an extension space.*/ isBuiltIn: boolean; /** * Whether this space was created by this extension.*/ isSelfOwned: boolean; /** * The name of the space. Names are unique for a single extension, but different extensions may use the same name.*/ name: string; } /** * Creates a new space and adds its button to the spaces toolbar.*/ export function create(/** * The name to assign to this space. May only contain alphanumeric characters and underscores. Must be unique for this extension.*/ name: string, /** * The properties for the new tab being opened, when the associated button in the spaces toolbar is clicked. Either a _string_ specifying the default URL, or a {@link spaces.SpaceTabProperties} object. The URL may point to a WebExtension page or a web page.*/ tabProperties: string | spaces.SpaceTabProperties, /** * Properties of the button in the spaces toolbar for the new space.*/ buttonProperties?: spaces.SpaceButtonProperties): Promise; /** * Retrieves details about the specified space.*/ export function get(/** * The id of the space.*/ spaceId: number): Promise; export interface QueryQueryInfo { /** * Id of the extension which should own the spaces. The management permission is required to be able to match against extension ids.*/ extensionId?: string; /** * The id of the space.*/ id?: number; /** * Spaces should be default Thunderbird spaces.*/ isBuiltIn?: boolean; /** * Spaces should have been created by this extension.*/ isSelfOwned?: boolean; /** * The name of the spaces (names are not unique).*/ name?: string; } /** * Gets all spaces that have the specified properties, or all spaces if no properties are specified.*/ export function query(queryInfo?: QueryQueryInfo): Promise; /** * Removes the specified space, closes all its tabs and removes its button from the spaces toolbar. Throws an exception if the requested space does not exist or was not created by this extension.*/ export function remove(/** * The id of the space.*/ spaceId: number): Promise; /** * Updates the specified space. Throws an exception if the requested space does not exist or was not created by this extension.*/ export function update(/** * The id of the space.*/ spaceId: number, /** * The properties for the new tab being opened, when the associated button in the spaces toolbar is clicked. Either a _string_ specifying the default URL, or a {@link spaces.SpaceTabProperties} object. The URL may point to a WebExtension page or a web page.*/ tabProperties: string | spaces.SpaceTabProperties | spaces.SpaceButtonProperties, /** * Properties of the button in the spaces toolbar for the specified space Only specified button properties will be updated.*/ buttonProperties?: spaces.SpaceButtonProperties): Promise; /** * Opens or switches to the specified space. Throws an exception if the requested space does not exist or was not created by this extension.*/ export function open(/** * The id of the space.*/ spaceId: number, /** * The id of the normal window, where the space should be opened. Defaults to the most recent normal window.*/ windowId?: number): Promise; } namespace spacesToolbar { export interface ButtonProperties { /** * Sets the background color of the badge. Can be specified as an array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is `[255, 0, 0, 255]`. Can also be a string with an HTML color name (`red`) or a HEX color value (`#FF0000` or `#F00`). Reset when set to an empty string.*/ badgeBackgroundColor?: string | ColorArray; /** * Sets the badge text for the spaces toolbar button. The badge is displayed on top of the icon. Any number of characters can be set, but only about four can fit in the space. Removed when set to an empty string.*/ badgeText?: string; /** * The paths to one or more icons for the button in the spaces toolbar. Defaults to the extension icon, if set to an empty string.*/ defaultIcons?: string | manifest.IconPath; /** * Specifies dark and light icons for the spaces toolbar button to be used with themes: The `light` icons will be used on dark backgrounds and vice versa. At least the set for _16px_ icons should be specified. The set for _32px_ icons will be used on screens with a very high pixel density, if specified.*/ themeIcons?: manifest.ThemeIcons[]; /** * The title for the spaces toolbar button, used in the tooltip of the button and as the displayed name in the overflow menu. Defaults to the name of the extension, if set to an empty string.*/ title?: string; /** * The page url, loaded into a tab when the button is clicked. Supported are `https://` and `http://` links, as well as links to WebExtension pages.*/ url?: string; } /** * An array of four integers in the range [0,255] that make up the RGBA color. For example, opaque red is `[255, 0, 0, 255]`.*/ type ColorArray = number[]; /** * Adds a new button to the spaces toolbar. Throws an exception, if the used `id` is not unique within the extension.*/ export function addButton(/** * The unique id to assign to this button. May only contain alphanumeric characters and underscores.*/ id: string, /** * Properties of the new button. The `url` is mandatory.*/ properties: spacesToolbar.ButtonProperties): Promise; /** * Removes the specified button from the spaces toolbar. Throws an exception if the requested spaces toolbar button does not exist or was not created by this extension. If the tab of this button is currently open, it will be closed.*/ export function removeButton(/** * The id of the spaces toolbar button, which is to be removed. May only contain alphanumeric characters and underscores.*/ id: string): Promise; /** * Updates properties of the specified spaces toolbar button. Throws an exception if the requested spaces toolbar button does not exist or was not created by this extension.*/ export function updateButton(/** * The id of the spaces toolbar button, which is to be updated. May only contain alphanumeric characters and underscores.*/ id: string, /** * Only specified properties will be updated.*/ properties: spacesToolbar.ButtonProperties): Promise; /** * Trigger a click on the specified spaces toolbar button. Throws an exception if the requested spaces toolbar button does not exist or was not created by this extension.*/ export function clickButton(/** * The id of the spaces toolbar button. May only contain alphanumeric characters and underscores.*/ id: string, /** * The id of the normal window, where the spaces toolbar button should be clicked. Defaults to the most recent normal window.*/ windowId?: number): Promise; } namespace storage { export interface StorageChange { /** * The new value of the item, if there is a new value.*/ newValue?: any; /** * The old value of the item, if there was an old value.*/ oldValue?: any; } export interface StorageArea { /** * Gets one or more items from storage.*/ get(/** * A single key to get, list of keys to get, or a dictionary specifying default values (see description of the object). An empty list or object will return an empty result object. Pass in `null` to get the entire contents of storage.*/ keys?: string | string[] | { [key: string]: any; }): Promise<{ [key: string]: any; }>; /** * Gets the amount of space (in bytes) being used by one or more items.*/ getBytesInUse(/** * A single key or list of keys to get the total usage for. An empty list will return 0. Pass in `null` to get the total usage of all of storage.*/ keys?: string | string[]): Promise; /** * Gets the keys of all items in storage.*/ getKeys(): Promise; /** * Sets multiple items.*/ set(/** *

An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected.

Primitive values such as numbers will serialize as expected. Values with a `typeof` `"object"` and `"function"` will typically serialize to `{}`, with the exception of `Array` (serializes as expected), `Date`, and `Regex` (serialize using their `String` representation).

*/ items: { [key: string]: any; }): Promise; /** * Removes one or more items from storage.*/ remove(/** * A single key or a list of keys for items to remove.*/ keys: string | string[]): Promise; /** * Removes all items from storage.*/ clear(): Promise; } /** * Fired when one or more items change.*/ export const onChanged: WebExtEvent<(/** * Object mapping each key that changed to its corresponding {@link storage.StorageChange} for that item.*/ changes: { [key: string]: StorageChange; }, /** * The name of the storage area (`"session"`, `"sync"`, `"local"` or `"managed"`) the changes are for.*/ areaName: string) => void>; /** * Items in the `local` storage area are local to each machine.*/ export const local: StorageArea; /** * Items in the `managed` storage area are set by administrators or native applications, and are read-only for the extension; trying to modify this namespace results in an error.*/ export const managed: StorageArea; /** * Items in the `session` storage area are kept in memory, and only until the either browser or extension is closed or reloaded.*/ export const session: StorageArea; /** * Items in the `sync` storage area are synced by the browser.*/ export const sync: StorageArea; } namespace tabs { export interface Tab { /** * Whether the tab is active in its window. (Does not necessarily mean the window is focused.)*/ active: boolean; /** * The {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/contextualIdentities/ContextualIdentity#cookiestoreid|CookieStore} id used by the tab. Either a custom id created using the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/contextualIdentities|contextualIdentities API}, or a built-in one: `firefox-default`, `firefox-container-1`, `firefox-container-2`, `firefox-container-3`, `firefox-container-4`, `firefox-container-5`.*/ cookieStoreId?: string; /** * The URL of the tab's favicon. This property is only present if the extension's manifest includes the tabs permission. It may also be an empty string if the tab is loading.*/ favIconUrl?: string; /** * The ID of the group that the tab belongs to. -1 if the tab does not belong to a tab group.*/ groupId?: number; /** * The height of the tab in pixels.*/ height?: number; /** * Whether the tab is highlighted. Works as an alias of active*/ highlighted: boolean; /** * The ID of the tab. Tab IDs are unique within a session. Under some circumstances a Tab may not be assigned an ID. Tab ID can also be set to $(ref:tabs.TAB_ID_NONE) for apps and devtools windows.*/ id?: number; /** * The zero-based index of the tab within its window.*/ index: number; /** * Whether the tab is a 3-pane tab.*/ mailTab?: boolean; /** * The id of the space.*/ spaceId?: number; /** * The ID of the Split View that the tab belongs to. -1 if the tab does not belong to a split view.*/ splitViewId?: number; /** * Either `loading` or `complete`.*/ status?: string; /** * The title of the tab. This property is only present if the extension's manifest includes the tabs permission.*/ title?: string; type?: TabType; /** * The URL the tab is displaying. This property is only present if the extension's manifest includes the tabs permission.*/ url?: string; /** * The width of the tab in pixels.*/ width?: number; /** * The ID of the window the tab is contained within.*/ windowId?: number; } /** * Whether the tabs have completed loading.*/ export type TabStatus = "loading" | "complete"; /** * Tab types supported by the tabs API.*/ export type TabType = "addressBook" | "calendar" | "calendarEvent" | "calendarTask" | "chat" | "content" | "mail" | "messageCompose" | "messageDisplay" | "special" | "tasks"; /** * The type of a window. Under some circumstances a Window may not be assigned a type property.*/ export type WindowType = "normal" | "popup" | "panel" | "app" | "devtools" | "messageCompose" | "messageDisplay"; /** * Event names supported in {@link tabs.onUpdated}.*/ export type UpdatePropertyName = "favIconUrl" | "status" | "title"; /** * An object describing filters to apply to {@link tabs.onUpdated} events.*/ export interface UpdateFilter { /** * A list of property names. Events that do not match any of the names will be filtered out.*/ properties?: UpdatePropertyName[]; tabId?: number; /** * A list of URLs or URL patterns. Events that cannot match any of the URLs will be filtered out. Filtering with urls requires the tabs or activeTab permission.*/ urls?: string[]; windowId?: number; } /** * Retrieves details about the specified tab.*/ export function get(tabId: number): Promise; /** * Gets the tab that this script call is being made from. Returns `undefined` if called from a non-tab context (for example a background page or a popup view).*/ export function getCurrent(): Promise; export interface ConnectConnectInfo { /** * Open a port to a specific document identified by `documentId` instead of all frames in the tab.*/ documentId?: string; /** * Open a port to a specific frame identified by `frameId` instead of all frames in the tab.*/ frameId?: number; /** * Will be passed into onConnect for content scripts that are listening for the connection event.*/ name?: string; } /** * Connects to the content script(s) in the specified tab. The {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onConnect|runtime.onConnect} event is fired in each content script running in the specified tab for the current extension. For more details, see {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts|Content Script Messaging}.*/ export function connect(tabId: number, connectInfo?: ConnectConnectInfo): runtime.Port; export interface SendMessageOptions { /** * Send a message to a specific document identified by `documentId` instead of all frames in the tab.*/ documentId?: string; /** * Send a message to a specific frame identified by `frameId` instead of all frames in the tab.*/ frameId?: number; } /** * Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessage|runtime.onMessage} event is fired in each content script running in the specified tab for the current extension.*/ export function sendMessage(tabId: number, message: any, options?: SendMessageOptions, responseCallback?: (/** * The JSON response object sent by the handler of the message. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/lastError|runtime.lastError} will be set to the error message.*/ response: any) => void): void; /** * Properties for the new tab. Defaults to an empty tab, if no `url` is provided.*/ export interface CreateCreateProperties { /** * Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see {@link windows.update}). Defaults to `true`.*/ active?: boolean; /** * The {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/contextualIdentities/ContextualIdentity#cookiestoreid|CookieStore} id the new tab should use. Either a custom id created using the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/contextualIdentities|contextualIdentities API}, or a built-in one: `firefox-default`, `firefox-container-1`, `firefox-container-2`, `firefox-container-3`, `firefox-container-4`, `firefox-container-5`.*/ cookieStoreId?: string; /** * The position the tab should take in the window. The provided value will be clamped to between zero and the number of tabs in the window.*/ index?: number; /** * Thunderbird is a mail client, not a browser. It is possible to load a web page, but opening follow-up pages through hyperlinks should be handled by the user's default browser. This property specifies to what extent this behavior should be enforced. The default `balanced` link handler will open links to the same host directly in Thunderbird, everything else will be opened in the user's default browser. A `relaxed` link handler will open all links inside of Thunderbird, a `strict` link handler will open all links in the user's default browser, except links to the same page.*/ linkHandler?: "strict" | "balanced" | "relaxed"; /** * The URL to navigate the tab to initially. If the URL points to a content page (a web page, an extension page or a registered WebExtension protocol handler page), the tab will navigate to the requested page. All other URLs will be opened externally after creating an empty tab. Fully-qualified URLs must include a scheme (i.e. `http://www.google.com`, not `www.google.com`). Relative URLs will be relative to the root of the extension.*/ url?: string; /** * The window to create the new tab in. Defaults to the current window.*/ windowId?: number; } /** * Creates a new content tab. To create message tabs, use the {@link messageDisplay.open}. Only supported in `normal` windows. Same-site links in the loaded page are opened within Thunderbird, all other links are opened in the user's default browser. To override this behavior, add-ons have to register a {@link https://bugzilla.mozilla.org/show_bug.cgi|content script} , capture click events and handle them manually.*/ export function create(/** * Properties for the new tab. Defaults to an empty tab, if no `url` is provided.*/ createProperties: CreateCreateProperties): Promise; /** * Duplicates a tab.*/ export function duplicate(/** * The ID of the tab which is to be duplicated.*/ tabId: number): Promise; export interface QueryQueryInfo { /** * Whether the tabs are active in their windows.*/ active?: boolean; /** * The {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/contextualIdentities/ContextualIdentity#cookiestoreid|CookieStore} id(s) used by the tabs. Either custom ids created using the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/contextualIdentities|contextualIdentities API}, or built-in ones: `firefox-default`, `firefox-container-1`, `firefox-container-2`, `firefox-container-3`, `firefox-container-4`, `firefox-container-5`.*/ cookieStoreId?: string[] | string; /** * Whether the tabs are in the current window.*/ currentWindow?: boolean; /** * Whether the tabs are highlighted. Works as an alias of active.*/ highlighted?: boolean; /** * The position of the tabs within their windows.*/ index?: number; /** * Whether the tabs are in the last focused window.*/ lastFocusedWindow?: boolean; /** * Whether the tab is a Thunderbird 3-pane tab. If specified, the `queryInfo.type` property will be ignored*/ mailTab?: boolean; /** * The id of the space the tabs should belong to.*/ spaceId?: number; /** * Whether the tabs have completed loading.*/ status?: TabStatus; /** * Match page titles against a pattern. The tabs permission is required to use this property.*/ title?: string; /** * Match tabs against the given tab type or types.*/ type?: TabType | TabType[]; /** * Match tabs against one or more {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns|URL Patterns}. Fragment identifiers are not matched. The tabs permission is required to use this property.*/ url?: string | string[]; /** * The ID of the parent window, or $(ref:windows.WINDOW_ID_CURRENT) for the current window.*/ windowId?: number; /** * The type of window the tabs are in.*/ windowType?: WindowType; } /** * Gets all tabs that have the specified properties, or all tabs if no properties are specified.*/ export function query(queryInfo?: QueryQueryInfo): Promise; /** * Properties which should to be updated.*/ export interface UpdateUpdateProperties { /** * Set this to `true`, if the tab should become active. Does not affect whether the window is focused (see {@link windows.update}). Setting this to `false` has no effect.*/ active?: boolean; /** * A URL of a page to load. If the URL points to a content page (a web page, an extension page or a registered WebExtension protocol handler page), the tab will navigate to the requested page. All other URLs will be opened externally without changing the tab.*/ url?: string; } /** * Modifies the properties of a tab. Properties that are not specified in `updateProperties` are not modified.*/ export function update(/** * Defaults to the selected tab of the current window.*/ tabId: number, /** * Properties which should to be updated.*/ updateProperties: UpdateUpdateProperties): Promise; /** * Modifies the properties of a tab. Properties that are not specified in `updateProperties` are not modified.*/ export function update(/** * Properties which should to be updated.*/ updateProperties: UpdateUpdateProperties): Promise; export interface MoveMoveProperties { /** * The position to move the tab to. `-1` will place the tab at the end of the window.*/ index: number; /** * Defaults to the window the tab is currently in.*/ windowId?: number; } /** * Moves one or more tabs to a new position within its current window, or to a different window. Tabs can only be moved to and from windows of type `normal`. The primary mail tab cannot be moved, attempting to actively reposition it will throw an _ExtensionError_. Other tabs also cannot be placed before the primary mail tab, they will automatically be positioned after it, ensuring that the primary mail tab always remains first.*/ export function move(/** * The tab or list of tabs to move.*/ tabIds: number | number[], moveProperties: MoveMoveProperties): Promise; export interface ReloadReloadProperties { /** * Whether using any local cache. Default is false.*/ bypassCache?: boolean; } /** * Reload a tab. Only applicable for tabs which display a content page.*/ export function reload(/** * The ID of the tab to reload; defaults to the selected tab of the current window.*/ tabId?: number, reloadProperties?: ReloadReloadProperties): Promise; /** * Closes one or more tabs.*/ export function remove(/** * The tab or list of tabs to close.*/ tabIds: number | number[]): Promise; /** * Injects JavaScript code into a page. For details, see the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts|programmatic injection} section of the content scripts doc.*/ export function executeScript(/** * The ID of the tab in which to run the script; defaults to the active tab of the current window.*/ tabId: number, /** * Details of the script to run.*/ details: extensionTypes.InjectDetails): Promise; /** * Injects JavaScript code into a page. For details, see the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts|programmatic injection} section of the content scripts doc.*/ export function executeScript(/** * Details of the script to run.*/ details: extensionTypes.InjectDetails): Promise; /** * Injects CSS into a page. For details, see the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts|programmatic injection} section of the content scripts doc.*/ export function insertCSS(/** * The ID of the tab in which to insert the CSS; defaults to the active tab of the current window.*/ tabId: number, /** * Details of the CSS text to insert.*/ details: extensionTypes.InjectDetails): Promise; /** * Injects CSS into a page. For details, see the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts|programmatic injection} section of the content scripts doc.*/ export function insertCSS(/** * Details of the CSS text to insert.*/ details: extensionTypes.InjectDetails): Promise; /** * Removes injected CSS from a page. For details, see the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts|programmatic injection} section of the content scripts doc.*/ export function removeCSS(/** * The ID of the tab from which to remove the injected CSS; defaults to the active tab of the current window.*/ tabId: number, /** * Details of the CSS text to remove.*/ details: extensionTypes.InjectDetails): Promise; /** * Removes injected CSS from a page. For details, see the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts|programmatic injection} section of the content scripts doc.*/ export function removeCSS(/** * Details of the CSS text to remove.*/ details: extensionTypes.InjectDetails): Promise; /** * Fired when a tab is created. The tab may still be loading, with its title being `loading...` and its URL being `about:blank`. To detect when the tab has finished loading, listen to the {@link tabs.onUpdated} event.*/ export const onCreated: WebExtEvent<(/** * Details of the tab that was created.*/ tab: Tab) => void>; /** * Fired when a tab is updated.*/ export const onUpdated: { addListener: (callback: (tabId: number, /** * Lists the changes to the state of the tab that was updated.*/ changeInfo: { /** * The tab's new favicon URL.*/ favIconUrl?: string; /** * The status of the tab. Can be either `loading` or `complete`.*/ status?: string; /** * The tab's URL if it has changed.*/ url?: string; }, /** * Gives the state of the tab that was updated.*/ tab: Tab) => void, filter?: UpdateFilter) => void; removeListener: (callback: (tabId: number, /** * Lists the changes to the state of the tab that was updated.*/ changeInfo: { /** * The tab's new favicon URL.*/ favIconUrl?: string; /** * The status of the tab. Can be either `loading` or `complete`.*/ status?: string; /** * The tab's URL if it has changed.*/ url?: string; }, /** * Gives the state of the tab that was updated.*/ tab: Tab) => void) => void; hasListener: (callback: (tabId: number, /** * Lists the changes to the state of the tab that was updated.*/ changeInfo: { /** * The tab's new favicon URL.*/ favIconUrl?: string; /** * The status of the tab. Can be either `loading` or `complete`.*/ status?: string; /** * The tab's URL if it has changed.*/ url?: string; }, /** * Gives the state of the tab that was updated.*/ tab: Tab) => void) => boolean; }; /** * Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response. This event is not fired when a tab is moved between windows. For that, see {@link tabs.onDetached}.*/ export const onMoved: WebExtEvent<(tabId: number, moveInfo: { fromIndex: number; toIndex: number; windowId: number; }) => void>; /** * Fires when the active tab in a window changes. The tab's URL may not be set at the time this event fired, listen to the {@link tabs.onUpdated} event instead to be notified when a URL is set.*/ export const onActivated: WebExtEvent<(activeInfo: { /** * The ID of the tab that was previously active, if that tab is still open.*/ previousTabId?: number; /** * The ID of the tab that has become active.*/ tabId: number; /** * The ID of the window the active tab changed inside of.*/ windowId: number; }) => void>; /** * Fired when a tab is detached from a window, for example because it is being moved between windows.*/ export const onDetached: WebExtEvent<(tabId: number, detachInfo: { oldPosition: number; oldWindowId: number; }) => void>; /** * Fired when a tab is attached to a window, for example because it was moved between windows.*/ export const onAttached: WebExtEvent<(tabId: number, attachInfo: { newPosition: number; newWindowId: number; }) => void>; /** * Fired when a tab is closed.*/ export const onRemoved: WebExtEvent<(tabId: number, removeInfo: { /** * Is `true` when the tab is being closed because its window is being closed.*/ isWindowClosing: boolean; /** * The window whose tab is closed.*/ windowId: number; }) => void>; /** * An ID which represents the absence of a tab.*/ export const TAB_ID_NONE: -1; } namespace theme { /** * Info provided in the onUpdated listener.*/ export interface ThemeUpdateInfo { /** * The new theme after update*/ theme: manifest.ThemeType; /** * The id of the window the theme has been applied to*/ windowId?: number; } /** * Returns the current theme for the specified window or the last focused window.*/ export function getCurrent(/** * The window for which we want the theme.*/ windowId?: number): Promise; /** * Make complete updates to the theme. Resolves when the update has completed.*/ export function update(/** * The id of the window to update. No id updates all windows.*/ windowId: number, /** * The properties of the theme to update.*/ details: manifest.ThemeType): Promise; /** * Make complete updates to the theme. Resolves when the update has completed.*/ export function update(/** * The properties of the theme to update.*/ details: manifest.ThemeType): Promise; /** * Removes the updates made to the theme.*/ export function reset(/** * The id of the window to reset. No id resets all windows.*/ windowId?: number): Promise; /** * Fired when a new theme has been applied*/ export const onUpdated: WebExtEvent<(/** * Details of the theme update*/ updateInfo: ThemeUpdateInfo) => void>; } namespace types { /** * The scope of the Setting. One of
  • `regular`: setting for the regular profile (which is inherited by the incognito profile if not overridden elsewhere),
  • `regular_only`: setting for the regular profile only (not inherited by the incognito profile),
  • `incognito_persistent`: setting for the incognito profile that survives browser restarts (overrides regular preferences),
  • `incognito_session_only`: setting for the incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular and incognito_persistent preferences).
Only `regular` is supported by Thunderbird at this time.*/ export type SettingScope = "regular" | "regular_only" | "incognito_persistent" | "incognito_session_only"; /** * One of
  • `not_controllable`: cannot be controlled by any extension
  • `controlled_by_other_extensions`: controlled by extensions with higher precedence
  • `controllable_by_this_extension`: can be controlled by this extension
  • `controlled_by_this_extension`: controlled by this extension
*/ export type LevelOfControl = "not_controllable" | "controlled_by_other_extensions" | "controllable_by_this_extension" | "controlled_by_this_extension"; export interface Setting { /** * Gets the value of a setting.*/ get(/** * Which setting to consider.*/ details: { /** * Whether to return the value that applies to the incognito session (default false).*/ incognito?: boolean; }): Promise<{ /** * Whether the effective value is specific to the incognito session.
This property will _only_ be present if the `incognito` property in the `details` parameter of `get()` was true.*/ incognitoSpecific?: boolean; /** * The level of control of the setting.*/ levelOfControl: types.LevelOfControl; /** * The value of the setting.*/ value: any; }>; /** * Sets the value of a setting.*/ set(/** * Which setting to change.*/ details: { /** * Where to set the setting (default: regular).*/ scope?: types.SettingScope; /** * The value of the setting.
Note that every setting has a specific value type, which is described together with the setting. An extension should _not_ set a value of a different type.*/ value: any; }): Promise; /** * Clears the setting, restoring any default value.*/ clear(/** * Which setting to clear.*/ details: { /** * Where to clear the setting (default: regular).*/ scope?: types.SettingScope; }): Promise; } } namespace userScripts { /** * Details of a user script*/ export interface UserScriptOptions { /** * If allFrames is `true`, implies that the JavaScript should be injected into all frames of current page. By default, it's `false` and is only injected into the top frame.*/ allFrames?: boolean; /** * limit the set of matched tabs to those that belong to the given cookie store id*/ cookieStoreId?: string[] | string; excludeGlobs?: string[]; excludeMatches?: manifest.MatchPattern[]; includeGlobs?: string[]; /** * The list of JS files to inject*/ js: extensionTypes.ExtensionFileOrCode[]; /** * If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is `false`.*/ matchAboutBlank?: boolean; matches: manifest.MatchPattern[]; /** * The soonest that the JavaScript will be injected into the tab. Defaults to "document_idle".*/ runAt?: extensionTypes.RunAt; /** * An opaque user script metadata value*/ scriptMetadata?: extensionTypes.PlainJSONValue; } /** * Register a user script programmatically given its {@link userScripts.UserScriptOptions}, and resolves to an object with the unregister() function*/ export function register(userScriptOptions: UserScriptOptions): Promise<{ /** * Unregister a user script registered programmatically*/ unregister: () => Promise; }>; /** * Event called when a new userScript global has been created*/ export const onBeforeScript: WebExtEvent<(userScript: { /** * Exports all the properties of a given plain object as userScript globals*/ defineGlobals: (/** * A plain object whose properties are exported as userScript globals*/ sourceObject: { [key: string]: any; }) => void; /** * Convert a given value to make it accessible to the userScript code*/ export: (/** * A value to convert into an object accessible to the userScript*/ value: any) => any; /** * The userScript global*/ global: any; /** * The userScript metadata (as set in userScripts.register)*/ metadata: any; }) => void>; } namespace webNavigation { /** * Cause of the navigation. The same transition types as defined in the history API are used. These are the same transition types as defined in the $(topic:transition_types)[history API] except with `"start_page"` in place of `"auto_toplevel"` (for backwards compatibility).*/ export type TransitionType = "link" | "typed" | "auto_bookmark" | "auto_subframe" | "manual_subframe" | "generated" | "start_page" | "form_submit" | "reload" | "keyword" | "keyword_generated"; export type TransitionQualifier = "client_redirect" | "server_redirect" | "forward_back" | "from_address_bar"; export interface EventUrlFilters { url: events.UrlFilter[]; } /** * Information about the frame to retrieve information about.*/ export interface GetFrameDetails { /** * The UUID of the document. If provided, tabId and frameId are optional. If all are provided, the frame is only returned if all properties match.*/ documentId?: string; /** * The ID of the frame in the given tab. Must be specified if documentId is not set.*/ frameId?: number; /** * The ID of the process runs the renderer for this tab.*/ processId?: number; /** * The ID of the tab in which the frame is. Must be specified if documentId is not set.*/ tabId?: number; } /** * Retrieves information about the given frame. A frame refers to an <iframe> or a <frame> of a web page and is identified by a tab ID and a frame ID, or by its document ID.*/ export function getFrame(/** * Information about the frame to retrieve information about.*/ details: GetFrameDetails): Promise<{ /** * A UUID of the document loaded.*/ documentId: string; /** * True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired.*/ errorOccurred?: boolean; /** * The ID of the frame. 0 indicates that this is the main frame; a positive value indicates the ID of a subframe.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame. Set to -1 of no parent frame exists.*/ parentFrameId: number; /** * The ID of the tab in which the frame is.*/ tabId: number; /** * The URL currently associated with this frame, if the frame identified by the frameId existed at one point in the given tab. The fact that an URL is associated with a given frameId does not imply that the corresponding frame still exists.*/ url: string; }>; /** * Information about the tab to retrieve all frames from.*/ export interface GetAllFramesDetails { /** * The ID of the tab.*/ tabId: number; } /** * Retrieves information about all frames of a given tab.*/ export function getAllFrames(/** * Information about the tab to retrieve all frames from.*/ details: GetAllFramesDetails): Promise<{ /** * A UUID of the document loaded.*/ documentId: string; /** * True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired.*/ errorOccurred?: boolean; /** * The ID of the frame. 0 indicates that this is the main frame; a positive value indicates the ID of a subframe.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame. Set to -1 of no parent frame exists.*/ parentFrameId: number; /** * The ID of the tab in which the frame is.*/ tabId: number; /** * The URL currently associated with this frame.*/ url: string; }[]>; /** * Fired when a navigation is about to occur.*/ export const onBeforeNavigate: { addListener: (callback: (details: { /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique for a given tab and process.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame. Set to -1 of no parent frame exists.*/ parentFrameId: number; /** * The ID of the tab in which the navigation is about to occur.*/ tabId: number; /** * The time when the browser was about to start the navigation, in milliseconds since the epoch.*/ timeStamp: number; url: string; }) => void, filters?: EventUrlFilters) => void; removeListener: (callback: (details: { /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique for a given tab and process.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame. Set to -1 of no parent frame exists.*/ parentFrameId: number; /** * The ID of the tab in which the navigation is about to occur.*/ tabId: number; /** * The time when the browser was about to start the navigation, in milliseconds since the epoch.*/ timeStamp: number; url: string; }) => void) => void; hasListener: (callback: (details: { /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique for a given tab and process.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame. Set to -1 of no parent frame exists.*/ parentFrameId: number; /** * The ID of the tab in which the navigation is about to occur.*/ tabId: number; /** * The time when the browser was about to start the navigation, in milliseconds since the epoch.*/ timeStamp: number; url: string; }) => void) => boolean; }; /** * Fired when a navigation is committed. The document (and the resources it refers to, such as images and subframes) might still be downloading, but at least part of the document has been received from the server and the browser has decided to switch to the new document.*/ export const onCommitted: { addListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the navigation was committed, in milliseconds since the epoch.*/ timeStamp: number; /** * A list of transition qualifiers.*/ transitionQualifiers: TransitionQualifier[]; /** * Cause of the navigation.*/ transitionType: TransitionType; url: string; }) => void, filters?: EventUrlFilters) => void; removeListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the navigation was committed, in milliseconds since the epoch.*/ timeStamp: number; /** * A list of transition qualifiers.*/ transitionQualifiers: TransitionQualifier[]; /** * Cause of the navigation.*/ transitionType: TransitionType; url: string; }) => void) => void; hasListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the navigation was committed, in milliseconds since the epoch.*/ timeStamp: number; /** * A list of transition qualifiers.*/ transitionQualifiers: TransitionQualifier[]; /** * Cause of the navigation.*/ transitionType: TransitionType; url: string; }) => void) => boolean; }; /** * Fired when the page's DOM is fully constructed, but the referenced resources may not finish loading.*/ export const onDOMContentLoaded: { addListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the page's DOM was fully constructed, in milliseconds since the epoch.*/ timeStamp: number; url: string; }) => void, filters?: EventUrlFilters) => void; removeListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the page's DOM was fully constructed, in milliseconds since the epoch.*/ timeStamp: number; url: string; }) => void) => void; hasListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the page's DOM was fully constructed, in milliseconds since the epoch.*/ timeStamp: number; url: string; }) => void) => boolean; }; /** * Fired when a document, including the resources it refers to, is completely loaded and initialized.*/ export const onCompleted: { addListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the document finished loading, in milliseconds since the epoch.*/ timeStamp: number; url: string; }) => void, filters?: EventUrlFilters) => void; removeListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the document finished loading, in milliseconds since the epoch.*/ timeStamp: number; url: string; }) => void) => void; hasListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the document finished loading, in milliseconds since the epoch.*/ timeStamp: number; url: string; }) => void) => boolean; }; /** * Fired when an error occurs and the navigation is aborted. This can happen if either a network error occurred, or the user aborted the navigation.*/ export const onErrorOccurred: { addListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the error occurred, in milliseconds since the epoch.*/ timeStamp: number; url: string; }) => void, filters?: EventUrlFilters) => void; removeListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the error occurred, in milliseconds since the epoch.*/ timeStamp: number; url: string; }) => void) => void; hasListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the error occurred, in milliseconds since the epoch.*/ timeStamp: number; url: string; }) => void) => boolean; }; /** * Fired when a new window, or a new tab in an existing window, is created to host a navigation.*/ export const onCreatedNavigationTarget: { addListener: (callback: (details: { /** * The ID of the frame with sourceTabId in which the navigation is triggered. 0 indicates the main frame.*/ sourceFrameId: number; /** * The ID of the process runs the renderer for the source tab.*/ sourceProcessId: number; /** * The ID of the tab in which the navigation is triggered.*/ sourceTabId: number; /** * The ID of the tab in which the url is opened*/ tabId: number; /** * The time when the browser was about to create a new view, in milliseconds since the epoch.*/ timeStamp: number; /** * The URL to be opened in the new window.*/ url: string; }) => void, filters?: EventUrlFilters) => void; removeListener: (callback: (details: { /** * The ID of the frame with sourceTabId in which the navigation is triggered. 0 indicates the main frame.*/ sourceFrameId: number; /** * The ID of the process runs the renderer for the source tab.*/ sourceProcessId: number; /** * The ID of the tab in which the navigation is triggered.*/ sourceTabId: number; /** * The ID of the tab in which the url is opened*/ tabId: number; /** * The time when the browser was about to create a new view, in milliseconds since the epoch.*/ timeStamp: number; /** * The URL to be opened in the new window.*/ url: string; }) => void) => void; hasListener: (callback: (details: { /** * The ID of the frame with sourceTabId in which the navigation is triggered. 0 indicates the main frame.*/ sourceFrameId: number; /** * The ID of the process runs the renderer for the source tab.*/ sourceProcessId: number; /** * The ID of the tab in which the navigation is triggered.*/ sourceTabId: number; /** * The ID of the tab in which the url is opened*/ tabId: number; /** * The time when the browser was about to create a new view, in milliseconds since the epoch.*/ timeStamp: number; /** * The URL to be opened in the new window.*/ url: string; }) => void) => boolean; }; /** * Fired when the reference fragment of a frame was updated. All future events for that frame will use the updated URL.*/ export const onReferenceFragmentUpdated: { addListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the navigation was committed, in milliseconds since the epoch.*/ timeStamp: number; /** * A list of transition qualifiers.*/ transitionQualifiers: TransitionQualifier[]; /** * Cause of the navigation.*/ transitionType: TransitionType; url: string; }) => void, filters?: EventUrlFilters) => void; removeListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the navigation was committed, in milliseconds since the epoch.*/ timeStamp: number; /** * A list of transition qualifiers.*/ transitionQualifiers: TransitionQualifier[]; /** * Cause of the navigation.*/ transitionType: TransitionType; url: string; }) => void) => void; hasListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the navigation was committed, in milliseconds since the epoch.*/ timeStamp: number; /** * A list of transition qualifiers.*/ transitionQualifiers: TransitionQualifier[]; /** * Cause of the navigation.*/ transitionType: TransitionType; url: string; }) => void) => boolean; }; /** * Fired when the contents of the tab is replaced by a different (usually previously pre-rendered) tab.*/ export const onTabReplaced: WebExtEvent<(details: { /** * The ID of the tab that was replaced.*/ replacedTabId: number; /** * The ID of the tab that replaced the old tab.*/ tabId: number; /** * The time when the replacement happened, in milliseconds since the epoch.*/ timeStamp: number; }) => void>; /** * Fired when the frame's history was updated to a new URL. All future events for that frame will use the updated URL.*/ export const onHistoryStateUpdated: { addListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the navigation was committed, in milliseconds since the epoch.*/ timeStamp: number; /** * A list of transition qualifiers.*/ transitionQualifiers: TransitionQualifier[]; /** * Cause of the navigation.*/ transitionType: TransitionType; url: string; }) => void, filters?: EventUrlFilters) => void; removeListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the navigation was committed, in milliseconds since the epoch.*/ timeStamp: number; /** * A list of transition qualifiers.*/ transitionQualifiers: TransitionQualifier[]; /** * Cause of the navigation.*/ transitionType: TransitionType; url: string; }) => void) => void; hasListener: (callback: (details: { /** * A UUID of the document loaded.*/ documentId: string; /** * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab.*/ frameId: number; /** * A UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * The ID of the tab in which the navigation occurs.*/ tabId: number; /** * The time when the navigation was committed, in milliseconds since the epoch.*/ timeStamp: number; /** * A list of transition qualifiers.*/ transitionQualifiers: TransitionQualifier[]; /** * Cause of the navigation.*/ transitionType: TransitionType; url: string; }) => void) => boolean; }; } namespace webRequest { export type ResourceType = "main_frame" | "sub_frame" | "stylesheet" | "script" | "image" | "object" | "xmlhttprequest" | "xslt" | "ping" | "beacon" | "xml_dtd" | "font" | "media" | "websocket" | "csp_report" | "imageset" | "web_manifest" | "speculative" | "json" | "other"; export type OnBeforeRequestOptions = "blocking" | "requestBody"; export type OnBeforeSendHeadersOptions = "requestHeaders" | "blocking"; export type OnSendHeadersOptions = "requestHeaders"; export type OnHeadersReceivedOptions = "blocking" | "responseHeaders"; export type OnAuthRequiredOptions = "responseHeaders" | "blocking" | "asyncBlocking"; export type OnResponseStartedOptions = "responseHeaders"; export type OnBeforeRedirectOptions = "responseHeaders"; export type OnCompletedOptions = "responseHeaders"; /** * An object describing filters to apply to webRequest events.*/ export interface RequestFilter { /** * If provided, requests that do not match the incognito state will be filtered out.*/ incognito?: boolean; tabId?: number; /** * A list of request types. Requests that cannot match any of the types will be filtered out.*/ types?: ResourceType[]; /** * A list of URLs or URL patterns. Requests that cannot match any of the URLs will be filtered out.*/ urls: string[]; windowId?: number; } /** * An array of HTTP headers. Each header is represented as a dictionary containing the keys `name` and either `value` or `binaryValue`.*/ type HttpHeaders = { /** * Value of the HTTP header if it cannot be represented by UTF-8, stored as individual byte values (0..255).*/ binaryValue?: number[]; /** * Name of the HTTP header.*/ name: string; /** * Value of the HTTP header if it can be represented by UTF-8.*/ value?: string; }[]; /** * Returns value for event handlers that have the 'blocking' extraInfoSpec applied. Allows the event handler to modify network requests.*/ export interface BlockingResponse { /** * Only used as a response to the onAuthRequired event. If set, the request is made using the supplied credentials.*/ authCredentials?: { password: string; username: string; }; /** * If true, the request is cancelled. Used in onBeforeRequest, this prevents the request from being sent.*/ cancel?: boolean; /** * Only used as a response to the onBeforeRequest and onHeadersReceived events. If set, the original request is prevented from being sent/completed and is instead redirected to the given URL. Redirections to non-HTTP schemes such as data: are allowed. Redirects initiated by a redirect action use the original request method for the redirect, with one exception: If the redirect is initiated at the onHeadersReceived stage, then the redirect will be issued using the GET method.*/ redirectUrl?: string; /** * Only used as a response to the onBeforeSendHeaders event. If set, the request is made with these request headers instead.*/ requestHeaders?: HttpHeaders; /** * Only used as a response to the onHeadersReceived event. If set, the server is assumed to have responded with these response headers instead. Only return `responseHeaders` if you really want to modify the headers in order to limit the number of conflicts (only one extension may modify `responseHeaders` for each request).*/ responseHeaders?: HttpHeaders; /** * Only used as a response to the onBeforeRequest event. If set, the original request is prevented from being sent/completed and is instead upgraded to a secure request. If any extension returns `redirectUrl` during onBeforeRequest, `upgradeToSecure` will have no affect.*/ upgradeToSecure?: boolean; } /** * Contains the certificate properties of the request if it is a secure request.*/ export interface CertificateInfo { fingerprint: { sha1: string; sha256: string; }; isBuiltInRoot: boolean; issuer: string; rawDER?: number[]; serialNumber: string; subject: string; subjectPublicKeyInfoDigest: { sha256: string; }; /** * Contains start and end timestamps.*/ validity: { end: number; start: number; }; } export type CertificateTransparencyStatus = "not_applicable" | "policy_compliant" | "policy_not_enough_scts" | "policy_not_diverse_scts"; export type TransportWeaknessReasons = "cipher"; /** * Contains the security properties of the request (ie. SSL/TLS information).*/ export interface SecurityInfo { /** * Certificate transparency compliance per RFC 6962. See `https://www.certificate-transparency.org/what-is-ct` for more information.*/ certificateTransparencyStatus?: CertificateTransparencyStatus; /** * Certificate data if state is "secure". Will only contain one entry unless `certificateChain` is passed as an option.*/ certificates: CertificateInfo[]; /** * The cipher suite used in this request if state is "secure".*/ cipherSuite?: string; /** * Error message if state is "broken"*/ errorMessage?: string; /** * True if host uses Public Key Pinning and state is "secure".*/ hpkp?: string; /** * True if host uses Strict Transport Security and state is "secure".*/ hsts?: boolean; /** * The domain name does not match the certificate domain.* * @deprecated Please use $(ref:SecurityInfo.overridableErrorCategory).*/ isDomainMismatch?: boolean; isExtendedValidation?: boolean; /** * The certificate is either expired or is not yet valid. See `CertificateInfo.validity` for start and end dates.* * @deprecated Please use $(ref:SecurityInfo.overridableErrorCategory).*/ isNotValidAtThisTime?: boolean; /** * @deprecated Please use $(ref:SecurityInfo.overridableErrorCategory).*/ isUntrusted?: boolean; /** * The key exchange algorithm used in this request if state is "secure".*/ keaGroupName?: string; /** * The type of certificate error that was overridden for this connection, if any.*/ overridableErrorCategory?: "trust_error" | "domain_mismatch" | "expired_or_not_yet_valid"; /** * Protocol version if state is "secure"*/ protocolVersion?: "TLSv1" | "TLSv1.1" | "TLSv1.2" | "TLSv1.3" | "unknown"; /** * The length (in bits) of the secret key.*/ secretKeyLength?: number; /** * The signature scheme used in this request if state is "secure".*/ signatureSchemeName?: string; state: "insecure" | "weak" | "broken" | "secure"; /** * True if the TLS connection used Delegated Credentials.*/ usedDelegatedCredentials?: boolean; /** * True if the TLS connection used Encrypted Client Hello.*/ usedEch?: boolean; /** * True if the TLS connection made OCSP requests.*/ usedOcsp?: boolean; /** * True if the TLS connection used a privacy-preserving DNS transport like DNS-over-HTTPS.*/ usedPrivateDns?: boolean; /** * list of reasons that cause the request to be considered weak, if state is "weak"*/ weaknessReasons?: TransportWeaknessReasons[]; } /** * Contains data uploaded in a URL request.*/ export interface UploadData { /** * An ArrayBuffer with a copy of the data.*/ bytes?: any; /** * A string with the file's path and name.*/ file?: string; } /** * Tracking flags that match our internal tracking classification*/ export type UrlClassificationFlags = "fingerprinting" | "fingerprinting_content" | "cryptomining" | "cryptomining_content" | "emailtracking" | "emailtracking_content" | "tracking" | "tracking_ad" | "tracking_analytics" | "tracking_social" | "tracking_content" | "any_basic_tracking" | "any_strict_tracking" | "any_social_tracking" | "consentmanager" | "antifraud"; /** * If the request has been classified this is an array of {@link UrlClassificationFlags}.*/ type UrlClassificationParty = UrlClassificationFlags[]; export interface UrlClassification { /** * Classification flags if the request has been classified and it is first party.*/ firstParty: UrlClassificationParty; /** * Classification flags if the request has been classified and it or its window hierarchy is third party.*/ thirdParty: UrlClassificationParty; } /** * Needs to be called when the behavior of the webRequest handlers has changed to prevent incorrect handling due to caching. This function call is expensive. Don't call it often.*/ export function handlerBehaviorChanged(): Promise; /** * ...*/ export function filterResponseData(requestId: string): { [key: string]: any; }; export interface GetSecurityInfoOptions { /** * Include the entire certificate chain.*/ certificateChain?: boolean; /** * Include raw certificate data for processing by the extension.*/ rawDER?: boolean; } /** * Retrieves the security information for the request. Returns a promise that will resolve to a SecurityInfo object.*/ export function getSecurityInfo(requestId: string, options?: GetSecurityInfoOptions): Promise; /** * Fired when a request is about to occur.*/ export const onBeforeRequest: { addListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * True for private browsing requests.*/ incognito?: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * Contains the HTTP request body data. Only provided if extraInfoSpec contains 'requestBody'.*/ requestBody?: { /** * Errors when obtaining request body data.*/ error?: string; /** * If the request method is POST and the body is a sequence of key-value pairs encoded in UTF8, encoded as either multipart/form-data, or application/x-www-form-urlencoded, this dictionary is present and for each key contains the list of all values for that key. If the data is of another media type, or if it is malformed, the dictionary is not present. An example value of this dictionary is {'key': ['value1', 'value2']}.*/ formData?: { [key: string]: string[]; }; /** * If the request method is PUT or POST, and the body is not already parsed in formData, then the unparsed request body elements are contained in this array.*/ raw?: UploadData[]; }; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => BlockingResponse, filter: RequestFilter, extraInfoSpec?: OnBeforeRequestOptions[]) => void; removeListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * True for private browsing requests.*/ incognito?: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * Contains the HTTP request body data. Only provided if extraInfoSpec contains 'requestBody'.*/ requestBody?: { /** * Errors when obtaining request body data.*/ error?: string; /** * If the request method is POST and the body is a sequence of key-value pairs encoded in UTF8, encoded as either multipart/form-data, or application/x-www-form-urlencoded, this dictionary is present and for each key contains the list of all values for that key. If the data is of another media type, or if it is malformed, the dictionary is not present. An example value of this dictionary is {'key': ['value1', 'value2']}.*/ formData?: { [key: string]: string[]; }; /** * If the request method is PUT or POST, and the body is not already parsed in formData, then the unparsed request body elements are contained in this array.*/ raw?: UploadData[]; }; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => BlockingResponse) => void; hasListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * True for private browsing requests.*/ incognito?: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * Contains the HTTP request body data. Only provided if extraInfoSpec contains 'requestBody'.*/ requestBody?: { /** * Errors when obtaining request body data.*/ error?: string; /** * If the request method is POST and the body is a sequence of key-value pairs encoded in UTF8, encoded as either multipart/form-data, or application/x-www-form-urlencoded, this dictionary is present and for each key contains the list of all values for that key. If the data is of another media type, or if it is malformed, the dictionary is not present. An example value of this dictionary is {'key': ['value1', 'value2']}.*/ formData?: { [key: string]: string[]; }; /** * If the request method is PUT or POST, and the body is not already parsed in formData, then the unparsed request body elements are contained in this array.*/ raw?: UploadData[]; }; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => BlockingResponse) => boolean; }; /** * Fired before sending an HTTP request, once the request headers are available. This may occur after a TCP connection is made to the server, but before any HTTP data is sent.*/ export const onBeforeSendHeaders: { addListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * True for private browsing requests.*/ incognito?: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The HTTP request headers that are going to be sent out with this request.*/ requestHeaders?: HttpHeaders; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => BlockingResponse, filter: RequestFilter, extraInfoSpec?: OnBeforeSendHeadersOptions[]) => void; removeListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * True for private browsing requests.*/ incognito?: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The HTTP request headers that are going to be sent out with this request.*/ requestHeaders?: HttpHeaders; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => BlockingResponse) => void; hasListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * True for private browsing requests.*/ incognito?: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The HTTP request headers that are going to be sent out with this request.*/ requestHeaders?: HttpHeaders; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => BlockingResponse) => boolean; }; /** * Fired just before a request is going to be sent to the server (modifications of previous onBeforeSendHeaders callbacks are visible by the time onSendHeaders is fired).*/ export const onSendHeaders: { addListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * True for private browsing requests.*/ incognito?: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The HTTP request headers that have been sent out with this request.*/ requestHeaders?: HttpHeaders; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => void, filter: RequestFilter, extraInfoSpec?: OnSendHeadersOptions[]) => void; removeListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * True for private browsing requests.*/ incognito?: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The HTTP request headers that have been sent out with this request.*/ requestHeaders?: HttpHeaders; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => void) => void; hasListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * True for private browsing requests.*/ incognito?: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The HTTP request headers that have been sent out with this request.*/ requestHeaders?: HttpHeaders; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => void) => boolean; }; /** * Fired when HTTP response headers of a request have been received.*/ export const onHeadersReceived: { addListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * True for private browsing requests.*/ incognito?: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The HTTP response headers that have been received with this response.*/ responseHeaders?: HttpHeaders; /** * Standard HTTP status code returned by the server.*/ statusCode: number; /** * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line).*/ statusLine: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => BlockingResponse, filter: RequestFilter, extraInfoSpec?: OnHeadersReceivedOptions[]) => void; removeListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * True for private browsing requests.*/ incognito?: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The HTTP response headers that have been received with this response.*/ responseHeaders?: HttpHeaders; /** * Standard HTTP status code returned by the server.*/ statusCode: number; /** * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line).*/ statusLine: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => BlockingResponse) => void; hasListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * True for private browsing requests.*/ incognito?: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The HTTP response headers that have been received with this response.*/ responseHeaders?: HttpHeaders; /** * Standard HTTP status code returned by the server.*/ statusCode: number; /** * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line).*/ statusLine: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => BlockingResponse) => boolean; }; /** * Fired when an authentication failure is received. The listener has three options: it can provide authentication credentials, it can cancel the request and display the error page, or it can take no action on the challenge. If bad user credentials are provided, this may be called multiple times for the same request.*/ export const onAuthRequired: { addListener: (callback: (details: { /** * The server requesting authentication.*/ challenger: { host: string; port: number; }; /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * True for private browsing requests.*/ incognito?: boolean; /** * True for Proxy-Authenticate, false for WWW-Authenticate.*/ isProxy: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The authentication realm provided by the server, if there is one.*/ realm?: string; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The HTTP response headers that were received along with this response.*/ responseHeaders?: HttpHeaders; /** * The authentication scheme, e.g. Basic or Digest.*/ scheme: string; /** * Standard HTTP status code returned by the server.*/ statusCode: number; /** * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/ statusLine: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }, asyncCallback?: (response: BlockingResponse) => void) => BlockingResponse, filter: RequestFilter, extraInfoSpec?: OnAuthRequiredOptions[]) => void; removeListener: (callback: (details: { /** * The server requesting authentication.*/ challenger: { host: string; port: number; }; /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * True for private browsing requests.*/ incognito?: boolean; /** * True for Proxy-Authenticate, false for WWW-Authenticate.*/ isProxy: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The authentication realm provided by the server, if there is one.*/ realm?: string; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The HTTP response headers that were received along with this response.*/ responseHeaders?: HttpHeaders; /** * The authentication scheme, e.g. Basic or Digest.*/ scheme: string; /** * Standard HTTP status code returned by the server.*/ statusCode: number; /** * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/ statusLine: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }, asyncCallback?: (response: BlockingResponse) => void) => BlockingResponse) => void; hasListener: (callback: (details: { /** * The server requesting authentication.*/ challenger: { host: string; port: number; }; /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * True for private browsing requests.*/ incognito?: boolean; /** * True for Proxy-Authenticate, false for WWW-Authenticate.*/ isProxy: boolean; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The authentication realm provided by the server, if there is one.*/ realm?: string; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The HTTP response headers that were received along with this response.*/ responseHeaders?: HttpHeaders; /** * The authentication scheme, e.g. Basic or Digest.*/ scheme: string; /** * Standard HTTP status code returned by the server.*/ statusCode: number; /** * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/ statusLine: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }, asyncCallback?: (response: BlockingResponse) => void) => BlockingResponse) => boolean; }; /** * Fired when the first byte of the response body is received. For HTTP requests, this means that the status line and response headers are available.*/ export const onResponseStarted: { addListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * Indicates if this response was fetched from disk cache.*/ fromCache: boolean; /** * True for private browsing requests.*/ incognito?: boolean; /** * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address.*/ ip?: string; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The HTTP response headers that were received along with this response.*/ responseHeaders?: HttpHeaders; /** * Standard HTTP status code returned by the server.*/ statusCode: number; /** * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/ statusLine: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => void, filter: RequestFilter, extraInfoSpec?: OnResponseStartedOptions[]) => void; removeListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * Indicates if this response was fetched from disk cache.*/ fromCache: boolean; /** * True for private browsing requests.*/ incognito?: boolean; /** * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address.*/ ip?: string; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The HTTP response headers that were received along with this response.*/ responseHeaders?: HttpHeaders; /** * Standard HTTP status code returned by the server.*/ statusCode: number; /** * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/ statusLine: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => void) => void; hasListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * Indicates if this response was fetched from disk cache.*/ fromCache: boolean; /** * True for private browsing requests.*/ incognito?: boolean; /** * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address.*/ ip?: string; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The HTTP response headers that were received along with this response.*/ responseHeaders?: HttpHeaders; /** * Standard HTTP status code returned by the server.*/ statusCode: number; /** * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/ statusLine: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => void) => boolean; }; /** * Fired when a server-initiated redirect is about to occur.*/ export const onBeforeRedirect: { addListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * Indicates if this response was fetched from disk cache.*/ fromCache: boolean; /** * True for private browsing requests.*/ incognito?: boolean; /** * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address.*/ ip?: string; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The new URL.*/ redirectUrl: string; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The HTTP response headers that were received along with this redirect.*/ responseHeaders?: HttpHeaders; /** * Standard HTTP status code returned by the server.*/ statusCode: number; /** * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/ statusLine: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => void, filter: RequestFilter, extraInfoSpec?: OnBeforeRedirectOptions[]) => void; removeListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * Indicates if this response was fetched from disk cache.*/ fromCache: boolean; /** * True for private browsing requests.*/ incognito?: boolean; /** * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address.*/ ip?: string; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The new URL.*/ redirectUrl: string; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The HTTP response headers that were received along with this redirect.*/ responseHeaders?: HttpHeaders; /** * Standard HTTP status code returned by the server.*/ statusCode: number; /** * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/ statusLine: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => void) => void; hasListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * Indicates if this response was fetched from disk cache.*/ fromCache: boolean; /** * True for private browsing requests.*/ incognito?: boolean; /** * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address.*/ ip?: string; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The new URL.*/ redirectUrl: string; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The HTTP response headers that were received along with this redirect.*/ responseHeaders?: HttpHeaders; /** * Standard HTTP status code returned by the server.*/ statusCode: number; /** * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/ statusLine: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => void) => boolean; }; /** * Fired when a request is completed.*/ export const onCompleted: { addListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * Indicates if this response was fetched from disk cache.*/ fromCache: boolean; /** * True for private browsing requests.*/ incognito?: boolean; /** * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address.*/ ip?: string; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * For http requests, the bytes transferred in the request. Only available in onCompleted.*/ requestSize: number; /** * The HTTP response headers that were received along with this response.*/ responseHeaders?: HttpHeaders; /** * For http requests, the bytes received in the request. Only available in onCompleted.*/ responseSize: number; /** * Standard HTTP status code returned by the server.*/ statusCode: number; /** * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/ statusLine: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification: UrlClassification; }) => void, filter: RequestFilter, extraInfoSpec?: OnCompletedOptions[]) => void; removeListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * Indicates if this response was fetched from disk cache.*/ fromCache: boolean; /** * True for private browsing requests.*/ incognito?: boolean; /** * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address.*/ ip?: string; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * For http requests, the bytes transferred in the request. Only available in onCompleted.*/ requestSize: number; /** * The HTTP response headers that were received along with this response.*/ responseHeaders?: HttpHeaders; /** * For http requests, the bytes received in the request. Only available in onCompleted.*/ responseSize: number; /** * Standard HTTP status code returned by the server.*/ statusCode: number; /** * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/ statusLine: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification: UrlClassification; }) => void) => void; hasListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * Indicates if this response was fetched from disk cache.*/ fromCache: boolean; /** * True for private browsing requests.*/ incognito?: boolean; /** * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address.*/ ip?: string; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * For http requests, the bytes transferred in the request. Only available in onCompleted.*/ requestSize: number; /** * The HTTP response headers that were received along with this response.*/ responseHeaders?: HttpHeaders; /** * For http requests, the bytes received in the request. Only available in onCompleted.*/ responseSize: number; /** * Standard HTTP status code returned by the server.*/ statusCode: number; /** * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/ statusLine: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification: UrlClassification; }) => void) => boolean; }; /** * Fired when an error occurs.*/ export const onErrorOccurred: { addListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request. This value is not present if the request is a navigation of a frame.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The error description. This string is _not_ guaranteed to remain backwards compatible between releases. You must not parse and act based upon its content.*/ error: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * Indicates if this response was fetched from disk cache.*/ fromCache: boolean; /** * True for private browsing requests.*/ incognito?: boolean; /** * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address.*/ ip?: string; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => void, filter: RequestFilter) => void; removeListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request. This value is not present if the request is a navigation of a frame.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The error description. This string is _not_ guaranteed to remain backwards compatible between releases. You must not parse and act based upon its content.*/ error: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * Indicates if this response was fetched from disk cache.*/ fromCache: boolean; /** * True for private browsing requests.*/ incognito?: boolean; /** * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address.*/ ip?: string; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => void) => void; hasListener: (callback: (details: { /** * The cookie store ID of the contextual identity.*/ cookieStoreId?: string; /** * The UUID of the document making the request. This value is not present if the request is a navigation of a frame.*/ documentId?: string; /** * URL of the page into which the requested resource will be loaded.*/ documentUrl?: string; /** * The error description. This string is _not_ guaranteed to remain backwards compatible between releases. You must not parse and act based upon its content.*/ error: string; /** * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab.*/ frameId: number; /** * Indicates if this response was fetched from disk cache.*/ fromCache: boolean; /** * True for private browsing requests.*/ incognito?: boolean; /** * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address.*/ ip?: string; /** * Standard HTTP method.*/ method: string; /** * URL of the resource that triggered this request.*/ originUrl?: string; /** * The UUID of the parent document owning this frame. This is not set if there is no parent.*/ parentDocumentId?: string; /** * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.*/ parentFrameId: number; /** * The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.*/ requestId: string; /** * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab.*/ tabId: number; /** * Indicates if this request and its content window hierarchy is third party.*/ thirdParty: boolean; /** * The time when this signal is triggered, in milliseconds since the epoch.*/ timeStamp: number; /** * How the requested resource will be used.*/ type: ResourceType; url: string; /** * Tracking classification if the request has been classified.*/ urlClassification?: UrlClassification; }) => void) => boolean; }; /** * The maximum number of times that `handlerBehaviorChanged` can be called per 10 minute sustained interval. `handlerBehaviorChanged` is an expensive function call that shouldn't be called often.*/ export const MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES: 20; } namespace windows { /** * The type of a window. Under some circumstances a window may not be assigned a type property.*/ export type WindowType = "normal" | "popup" | "messageCompose" | "messageDisplay"; /** * The state of this window.*/ export type WindowState = "normal" | "minimized" | "maximized" | "fullscreen" | "docked"; export interface Window { /** * Whether the window is set to be always on top.*/ alwaysOnTop: boolean; /** * Whether the window is currently the focused window.*/ focused: boolean; /** * The height of the window, including the frame, in pixels.*/ height?: number; /** * The ID of the window. Window IDs are unique within a session.*/ id?: number; /** * Whether the window is incognito. Since Thunderbird does not support the incognito mode, this is always `false`.*/ incognito: boolean; /** * The offset of the window from the left edge of the screen in pixels.*/ left?: number; /** * The state of this window.*/ state?: WindowState; /** * Array of {@link tabs.Tab} objects representing the current tabs in the window. Only included if requested by {@link windows.get}, {@link windows.getCurrent}, {@link windows.getAll} or {@link windows.getLastFocused}, and the optional {@link windows.GetInfo} parameter has its `populate` member set to `true`.*/ tabs?: tabs.Tab[]; /** * The title of the window. Read-only.*/ title?: string; /** * The offset of the window from the top edge of the screen in pixels.*/ top?: number; /** * The type of window this is.*/ type?: WindowType; /** * The width of the window, including the frame, in pixels.*/ width?: number; } /** * Specifies what type of window to create. Thunderbird does not support `panel` and `detached_panel`, they are interpreted as `popup`.*/ export type CreateType = "normal" | "popup" | "panel" | "detached_panel"; /** * Specifies additional requirements for the returned windows.*/ export interface GetInfo { /** * If true, the {@link windows.Window} returned will have a `tabs` property that contains an array of {@link tabs.Tab} objects representing the tabs inside the window. The {@link tabs.Tab} objects only contain the `url`, `title` and `favIconUrl` properties if the extension's manifest file includes the tabs permission.*/ populate?: boolean; /** * If set, the {@link windows.Window} returned will be filtered based on its type. Supported by {@link windows.getAll} only, ignored in all other functions.*/ windowTypes?: WindowType[]; } /** * Gets details about a window.*/ export function get(windowId: number, getInfo?: GetInfo): Promise; /** * Gets the active or topmost window.*/ export function getCurrent(getInfo?: GetInfo): Promise; /** * Gets the window that was most recently focused — typically the window 'on top'.*/ export function getLastFocused(getInfo?: GetInfo): Promise; /** * Gets all windows.*/ export function getAll(getInfo?: GetInfo): Promise; export interface CreateCreateData { /** * Allow scripts running inside the window to close the window by calling `window.close()`. Defaults to `true` when the given URL points to an extension page (a page included with this extension and loaded with the `moz-extension:` protocol), defaults to `false` otherwise.*/ allowScriptsToClose?: boolean; /** * The {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/contextualIdentities/ContextualIdentity#cookiestoreid|CookieStore} id which all initially opened tabs should use. Either a custom id created using the {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/contextualIdentities|contextualIdentities API}, or a built-in one: `firefox-default`, `firefox-container-1`, `firefox-container-2`, `firefox-container-3`, `firefox-container-4`, `firefox-container-5`.*/ cookieStoreId?: string; /** * The height in pixels of the new window, including the frame. If not specified defaults to a natural height.*/ height?: number; /** * The number of pixels to position the new window from the left edge of the screen. If not specified, the new window is offset naturally from the last focused window.*/ left?: number; /** * Thunderbird is a mail client, not a browser. It is possible to load a web page, but opening follow-up pages through hyperlinks should be handled by the user's default browser. This property specifies to what extent this behavior should be enforced. The default `balanced` link handler will open links to the same host directly in Thunderbird, everything else will be opened in the user's default browser. A `relaxed` link handler will open all links inside of Thunderbird, a `strict` link handler will open all links in the user's default browser, except links to the same page.*/ linkHandler?: "strict" | "balanced" | "relaxed"; /** * The initial state of the window. The `minimized`, `maximized` and `fullscreen` states cannot be combined with `left`, `top`, `width` or `height`.*/ state?: WindowState; /** * The id of the tab for which you want to adopt to the new window.*/ tabId?: number; /** * A string to add to the beginning of the window title.*/ titlePreface?: string; /** * The number of pixels to position the new window from the top edge of the screen. If not specified, the new window is offset naturally from the last focused window.*/ top?: number; /** * Specifies what type of window to create. Thunderbird does not support `panel` and `detached_panel`, they are interpreted as `popup`.*/ type?: CreateType; /** * A URL to be opened in a popup window, ignored in all other window types. This may also be an array, but only the first element is used (popup windows may not have multiple tabs). If the URL points to a content page (a web page, an extension page or a registered WebExtension protocol handler page), the popup window will navigate to the requested page. All other URLs will be opened externally after creating an empty popup window. Fully-qualified URLs must include a scheme (i.e. `http://www.google.com`, not `www.google.com`). Relative URLs will be relative to the root of the extension. Defaults to the New Tab Page.*/ url?: string | string[]; /** * The width in pixels of the new window, including the frame. If not specified defaults to a natural width.*/ width?: number; } /** * Creates (opens) a new window with any optional sizing, position or default URL provided. When loading a page into a popup window, same-site links are opened within the same window, all other links are opened in the user's default browser. To override this behavior, add-ons have to register a {@link https://bugzilla.mozilla.org/show_bug.cgi|content script} , capture click events and handle them manually. Same-site links with targets other than `_self` are opened in a new tab in the most recent `normal` Thunderbird window.*/ export function create(createData?: CreateCreateData): Promise; export interface UpdateUpdateInfo { /** * Setting this to `true` will cause the window to be displayed in a manner that draws the user's attention to the window, without changing the focused window. The effect lasts until the user changes focus to the window. This option has no effect if the window already has focus.*/ drawAttention?: boolean; /** * If true, brings the window to the front. If false, brings the next window in the z-order to the front.*/ focused?: boolean; /** * The height to resize the window to in pixels.*/ height?: number; /** * The offset from the left edge of the screen to move the window to in pixels. This value is ignored for panels.*/ left?: number; /** * The new state of the window. The `minimized`, `maximized` and `fullscreen` states cannot be combined with `left`, `top`, `width` or `height`.*/ state?: WindowState; /** * A string to add to the beginning of the window title.*/ titlePreface?: string; /** * The offset from the top edge of the screen to move the window to in pixels. This value is ignored for panels.*/ top?: number; /** * The width to resize the window to in pixels.*/ width?: number; } /** * Updates the properties of a window. Specify only the properties that you want to change; unspecified properties will be left unchanged.*/ export function update(windowId: number, updateInfo: UpdateUpdateInfo): Promise; /** * Removes (closes) a window, and all the tabs inside it.*/ export function remove(windowId: number): Promise; /** * Opens the provided URL in the default system browser.*/ export function openDefaultBrowser(url: string): Promise; /** * Fired when a window is created.*/ export const onCreated: WebExtEvent<(/** * Details of the window that was created.*/ window: Window) => void>; /** * Fired when a window is removed (closed).*/ export const onRemoved: WebExtEvent<(/** * ID of the removed window.*/ windowId: number) => void>; /** * Fired when the currently focused window changes. Will be $(ref:windows.WINDOW_ID_NONE), if all windows have lost focus.*/ export const onFocusChanged: WebExtEvent<(/** * ID of the newly focused window.*/ windowId: number) => void>; /** * The windowId value that represents the current window.*/ export const WINDOW_ID_CURRENT: -2; /** * The windowId value that represents the absence of a window.*/ export const WINDOW_ID_NONE: -1; } } declare namespace browser { export import manifest = messenger.manifest; export import accounts = messenger.accounts; export import addressBooks = messenger.addressBooks; export import contacts = messenger.contacts; export import mailingLists = messenger.mailingLists; export import alarms = messenger.alarms; export import browserAction = messenger.browserAction; export import browserSettings = messenger.browserSettings; export import browsingData = messenger.browsingData; export import chromeSettingsOverrides = messenger.chromeSettingsOverrides; export import clipboard = messenger.clipboard; export import cloudFile = messenger.cloudFile; export import commands = messenger.commands; export import compose = messenger.compose; export import composeAction = messenger.composeAction; export import contentScripts = messenger.contentScripts; export import contextualIdentities = messenger.contextualIdentities; export import cookies = messenger.cookies; export import declarativeNetRequest = messenger.declarativeNetRequest; export import dns = messenger.dns; export import downloads = messenger.downloads; export import events = messenger.events; export import experiments = messenger.experiments; export import extension = messenger.extension; export import composeScripts = messenger.composeScripts; export import messageDisplayScripts = messenger.messageDisplayScripts; export import protocolHandlers = messenger.protocolHandlers; export import extensionTypes = messenger.extensionTypes; export import folders = messenger.folders; export import i18n = messenger.i18n; export import identities = messenger.identities; export import identity = messenger.identity; export import idle = messenger.idle; export import mailTabs = messenger.mailTabs; export import management = messenger.management; export import menus = messenger.menus; export import messageDisplay = messenger.messageDisplay; export import messageDisplayAction = messenger.messageDisplayAction; export import messages = messenger.messages; export import messengerSettings = messenger.messengerSettings; export import messengerUtilities = messenger.messengerUtilities; export import notifications = messenger.notifications; export import oauthProvider = messenger.oauthProvider; export import permissions = messenger.permissions; export import pkcs11 = messenger.pkcs11; export import privacy = messenger.privacy; export import proxy = messenger.proxy; export import runtime = messenger.runtime; export import scripting = messenger.scripting; export import sessions = messenger.sessions; export import spaces = messenger.spaces; export import spacesToolbar = messenger.spacesToolbar; export import storage = messenger.storage; export import tabs = messenger.tabs; export import theme = messenger.theme; export import types = messenger.types; export import userScripts = messenger.userScripts; export import webNavigation = messenger.webNavigation; export import webRequest = messenger.webRequest; export import windows = messenger.windows; }