contextualIdentities.getSupportedIcons()

Returns the icons supported by the browser for contextual identities.

Syntax

js
let icons = browser.contextualIdentities.getSupportedIcons()

Parameters

None.

Return value

A Promise fulfilled with an array of objects, one for each supported icon. Each object has these properties:

icon

string. The name of the icon (for example, "fingerprint"). This is the value used in the icon property of contextualIdentities.ContextualIdentity.

iconUrl

string. A resource:// URL pointing to the icon's SVG file (for example, "resource://usercontext-content/fingerprint.svg").

If the contextual identities feature is not enabled, the promise is rejected with an error message.

Examples

Retrieve all supported icons and log their names and URLs:

js
function onGot(icons) {
  for (const { icon, iconUrl } of icons) {
    console.log(`${icon}: ${iconUrl}`);
  }
}

function onError(error) {
  console.error(error);
}

browser.contextualIdentities.getSupportedIcons().then(onGot, onError);

Browser compatibility