]> git.parisson.com Git - pdf.js.git/commitdiff
Unload the pdfstreamconverter on shutdown.
authorBrendan Dahl <brendan.dahl@gmail.com>
Wed, 8 Feb 2012 22:59:30 +0000 (14:59 -0800)
committerBrendan Dahl <brendan.dahl@gmail.com>
Wed, 8 Feb 2012 22:59:30 +0000 (14:59 -0800)
extensions/firefox/bootstrap.js

index fbea7020328b61d705c3863155160a223a4f0b99..dc9d51f369d1cf42184e523c65dd55454bf13576 100644 (file)
@@ -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) {