From 08d3710bfc1dc76ecb66f0fab5aee4850c0ae4d3 Mon Sep 17 00:00:00 2001 From: Brendan Dahl Date: Wed, 8 Feb 2012 14:59:30 -0800 Subject: [PATCH] Unload the pdfstreamconverter on shutdown. --- extensions/firefox/bootstrap.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/extensions/firefox/bootstrap.js b/extensions/firefox/bootstrap.js index fbea7020328b6..dc9d51f369d1c 100644 --- a/extensions/firefox/bootstrap.js +++ b/extensions/firefox/bootstrap.js @@ -49,6 +49,8 @@ let Factory = { } }; +let pdfStreamConverterUrl = null; + // As of Firefox 13 bootstrapped add-ons don't support automatic registering and // unregistering of resource urls and components/contracts. Until then we do // it programatically. See ManifestDirective ManifestParser.cpp for support. @@ -67,7 +69,9 @@ function startup(aData, aReason) { resProt.setSubstitution(RESOURCE_NAME, aliasURI); // Load the component and register it. - Cu.import(aData.resourceURI.spec + 'components/PdfStreamConverter.js'); + pdfStreamConverterUrl = aData.resourceURI.spec + + 'components/PdfStreamConverter.js'; + Cu.import(pdfStreamConverterUrl); Factory.register(PdfStreamConverter); Services.prefs.setBoolPref('extensions.pdf.js.active', true); } @@ -82,6 +86,11 @@ function shutdown(aData, aReason) { resProt.setSubstitution(RESOURCE_NAME, null); // Remove the contract/component. Factory.unregister(); + // Unload the converter + if (pdfStreamConverterUrl) { + Cu.unload(pdfStreamConverterUrl); + pdfStreamConverterUrl = null; + } } function install(aData, aReason) {