permissions.remove()

Revokes the permissions listed in a permissions.Permissions object.

Permissions must come from those defined in the extension's optional_permissions key or gecko.data_collection_permissions.optional property of the browser_specific_settings key of its manifest.json file.

Syntax

js
let removing = browser.permissions.remove(
  permissions                // Permissions object
)

Parameters

permissions

A permissions.Permissions object.

Return value

A Promise fulfilled with true if the browser is no longer granting the permissions listed in the permissions argument to the extension, or false otherwise.

Examples

This code adds a click handler that removes a permission.

js
const permissionToRemove = {
  permissions: ["history"],
};

async function remove() {
  console.log("removing");
  const removed = await browser.permissions.remove(permissionToRemove);
  console.log(removed);
}

document.querySelector("#remove").addEventListener("click", remove);

Example extensions

Browser compatibility

Note: This API is based on Chromium's chrome.permissions API.