Unregister mimeTypeHandler and version header on Zotero shutdown

This commit is contained in:
Simon Kornblith 2012-02-20 02:26:41 -05:00
parent 549fa4a508
commit 99d65926bf
2 changed files with 7 additions and 1 deletions

View file

@ -39,6 +39,11 @@ Zotero.MIMETypeHandler = new function () {
getService(Components.interfaces.nsIObserverService).
addObserver(_Observer, "http-on-examine-response", false);
this.initializeHandlers();
Zotero.addShutdownListener(function() {
Components.classes["@mozilla.org/observer-service;1"].
getService(Components.interfaces.nsIObserverService).
removeObserver(_Observer, "http-on-examine-response", false);
});
}
/**

View file

@ -2234,6 +2234,7 @@ Zotero.VersionHeader = {
if (Zotero.Prefs.get("zoteroDotOrgVersionHeader")) {
this.register();
}
Zotero.addShutdownListener(this.unregister);
},
// Called from this.init() and Zotero.Prefs.observe()
@ -2258,7 +2259,7 @@ Zotero.VersionHeader = {
unregister: function () {
var observerService = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
observerService.removeObserver(this, "http-on-modify-request");
observerService.removeObserver(Zotero.VersionHeader, "http-on-modify-request");
}
}