Robert Louis Murphy
Robert Louis Murphy

Reputation: 1628

Firefox Add-on SDK 1.6.1 is it possible to make an uninstall button?

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

Answers (1)

Robert Louis Murphy
Robert Louis Murphy

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

Related Questions