Reputation: 1628
I am writing a Firefox Add-on. My boss wants a license agreement to pop up (Got that, it's working), the user can Accept or Decline. I want the Decline button to uninstall the Add-on. Can an Add-on SDK 1.6.1 Add-on uninstall itself?
Thanks in advance.
Upvotes: 4
Views: 250
Reputation: 1628
Ok, I figured it out:
const {Cu} = require("chrome");
let AddonManager = Cu.import("resource://gre/modules/AddonManager.jsm").AddonManager;
...
uninstallExtension(require("self").id);
...
function uninstallExtension(id) {
AddonManager.getAddonByID(id,function(addon){addon.uninstall();});
}
Upvotes: 6