Firefox Add-on SDK 1.6.1是否可以制作卸载按钮?

时间:2021-05-26 19:34:31

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?

我正在写一个Firefox附加组件。我的老板想要一个许可协议弹出(知道,它正在工作),用户可以接受或拒绝。我想要Decline按钮来卸载Add-on。附加SDK 1.6.1附加组件可以自行卸载吗?

Thanks in advance.

提前致谢。

1 个解决方案

#1


6  

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();});
}

#1


6  

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();});
}