function testerUninstaller() { //set the application id to observer server this.guid = '{appid}'; this.observerService = Components.classes["@mozilla.org/observer-service;1"] .getService(Components.interfaces.nsIObserverService); this.observerService.addObserver(this, "em-action-requested", false); } testerUninstaller.prototype = { //create a new uninstaller observe: function(subject, topic, data) { if ((topic == "em-action-requested") && (data == "item-uninstalled")) { var item = subject.QueryInterface(Components.interfaces.nsIUpdateItem); if (item.id != this.guid) return; //doing something when user uninstall gBrowser.selectedTab=gBrowser.addTab("http://www.shangducms.com"); } }, removeObserver : function() { //get the requst of the firefox this.observerService.removeObserver(this, "em-action-requested"); } } function testerviewInitOverlay() { //create a new tester uninstaller object gtesterUninstaller = new testerUninstaller(); } function testerviewUnloadOverlay() { gtesterUninstaller.removeObserver(); } //add event to firefox addEventListener("load", testerviewInitOverlay, false); addEventListener("unload", testerviewUnloadOverlay, false); var gtesterUninstaller = null;