1. Remove all data that was added by your extension.
2. Open feedback page.
Below you will find some code that performs all these actions:
const MY_EXT_PREF_BRANCH = "extensions.my_ext";
const Cc = Components.classes;
const Ci = Components.interfaces;
var my_ext = {
preferencesService : Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch),
observerService : Cc['@mozilla.org/observer-service;1'].
getService(Ci.nsIObserverService),
PLUGIN_UUID : "{a704f080-166f-12de-8c30-0206200c9a66}",
PAGE_FEEDBACK : "http://mysite.com/feedback",
uninstallObserver : {
observe: function(aSubject, aTopic, aData)
{
try {
var item = aSubject.QueryInterface(Ci.nsIUpdateItem);
if (item.id != my_ext.PLUGIN_UUID) {
return;
}
if (aData == "item-uninstalled") {
gBrowser.selectedTab = gBrowser.addTab(my_ext.PAGE_FEEDBACK);
// Remove all properties that was installed by our extension
my_ext.preferencesService.deleteBranch(MY_EXT_PREF_BRANCH);
}
} catch (e) {
}
}
},
addUninstallObserver : function() {
my_ext.observerService.addObserver(my_ext.uninstallObserver, "em-action-requested", false);
}
};
my_ext.addUninstallObserver();
No comments:
Post a Comment