Merge pull request #1193 from brendandahl/amo2

Unload the pdfstreamconverter on shutdown.
This commit is contained in:
notmasteryet 2012-02-08 15:19:15 -08:00
commit 7859ef0f04

View File

@ -49,6 +49,8 @@ let Factory = {
} }
}; };
let pdfStreamConverterUrl = null;
// As of Firefox 13 bootstrapped add-ons don't support automatic registering and // As of Firefox 13 bootstrapped add-ons don't support automatic registering and
// unregistering of resource urls and components/contracts. Until then we do // unregistering of resource urls and components/contracts. Until then we do
// it programatically. See ManifestDirective ManifestParser.cpp for support. // it programatically. See ManifestDirective ManifestParser.cpp for support.
@ -67,7 +69,9 @@ function startup(aData, aReason) {
resProt.setSubstitution(RESOURCE_NAME, aliasURI); resProt.setSubstitution(RESOURCE_NAME, aliasURI);
// Load the component and register it. // 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); Factory.register(PdfStreamConverter);
Services.prefs.setBoolPref('extensions.pdf.js.active', true); Services.prefs.setBoolPref('extensions.pdf.js.active', true);
} }
@ -82,6 +86,11 @@ function shutdown(aData, aReason) {
resProt.setSubstitution(RESOURCE_NAME, null); resProt.setSubstitution(RESOURCE_NAME, null);
// Remove the contract/component. // Remove the contract/component.
Factory.unregister(); Factory.unregister();
// Unload the converter
if (pdfStreamConverterUrl) {
Cu.unload(pdfStreamConverterUrl);
pdfStreamConverterUrl = null;
}
} }
function install(aData, aReason) { function install(aData, aReason) {