Skip to content

Commit

Permalink
Merge pull request #1193 from brendandahl/amo2
Browse files Browse the repository at this point in the history
Unload the pdfstreamconverter on shutdown.
  • Loading branch information
notmasteryet committed Feb 8, 2012
2 parents 70eca14 + 08d3710 commit 7859ef0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion extensions/firefox/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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);
}
Expand All @@ -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) {
Expand Down

0 comments on commit 7859ef0

Please sign in to comment.