files/en-us/mozilla/add-ons/webextensions/api/permissions/remove/index.md
Revokes the permissions listed in a {{WebExtAPIRef("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.
let removing = browser.permissions.remove(
permissions // Permissions object
)
permissions
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.
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);
{{WebExtExamples}}
{{Compat}}
[!NOTE] This API is based on Chromium's
chrome.permissionsAPI.