MDN self-hosted library · e01.org

permissions.remove()

Revokes the permissions listed in a permissions.Permissions object.

Open notebook · 1 cells webextension-api-function upstream source

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

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.

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);

Browser compatibility

[!NOTE] This API is based on Chromium's chrome.permissions API.