management.uninstall()
Uninstalls an add-on, given its ID.
This API requires the "management" API permission.
This is an asynchronous function that returns a Promise
.
Syntax
let uninstalling = browser.management.uninstall(
id, // string
options // object
)
Parameters
id
-
string
. ID of the add-on to uninstall. options
Optional-
object
. Object which may contain a single property,showConfirmDialog
. IfshowConfirmDialog
istrue
, the browser will show a dialog asking the user to confirm that the add-on should be uninstalled.
- If
id
is the calling add-on's ID,showConfirmDialog
defaults tofalse
. - If
id
is the ID of a different add-on, theshowConfirmDialog
option is ignored and the confirmation dialog is always shown.
Return value
A Promise
that will be rejected with an error message if the user canceled the uninstallation.
Browser compatibility
BCD tables only load in the browser
Examples
Uninstall the add-on whose ID is "addon-id" and ask the user to confirm. In the callback, we check whether the user canceled the uninstallation or if the operation succeeded.
let id = "addon-id";
function onCanceled(error) {
console.log(`Canceled: ${error}`);
}
function onUninstalled() {
console.log("Uninstalled");
}
let uninstalling = browser.management.uninstall(id);
uninstalling.then(onUninstalled, onCanceled);
Note:
This API is based on Chromium's chrome.management
API. This documentation is derived from management.json
in the Chromium code.