Is there a way to uninstall Firefox extension programmatically. If yes - Is it possible to execute this script from some other extension ?
AddonManager.getAddonByIDPERM_CAN_UNINSTALL flag.Addon.uninstall().Example code (you might want to add proper error handling, and so on):
Components.utils.import("resource://gre/modules/AddonManager.jsm");
AddonManager.getAddonByID("some@id", function(addon) {
if (!addon) {
// Add-on not present
return;
}
if (!(addon.permissions & AddonManager.PERM_CAN_UNINSTALL)) {
// Add-on cannot be uninstalled
return;
}
addon.uninstall();
if (addon.pendingOperations & AddonManager.PENDING_UNINSTALL) {
// Need to restart to finish the uninstall.
// Might ask the user to do just that. Or not ask and just do.
// Or just wait until the browser is restarted by the user.
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With