From 99d65926bf37687584027eed07a698c0bc08c921 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 20 Feb 2012 02:26:41 -0500 Subject: [PATCH] Unregister mimeTypeHandler and version header on Zotero shutdown --- chrome/content/zotero/xpcom/mimeTypeHandler.js | 5 +++++ chrome/content/zotero/xpcom/zotero.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/mimeTypeHandler.js b/chrome/content/zotero/xpcom/mimeTypeHandler.js index d5467e6a6d..b299e47da6 100644 --- a/chrome/content/zotero/xpcom/mimeTypeHandler.js +++ b/chrome/content/zotero/xpcom/mimeTypeHandler.js @@ -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); + }); } /** diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 33272ed47e..d74e541331 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -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"); } }