[or-cvs] [torbutton/master 07/31] Update external-app-blocker to Firefox 4 registration style.

mikeperry at torproject.org mikeperry at torproject.org
Tue Jan 4 07:02:18 UTC 2011


Author: Mike Perry <mikeperry-git at fscked.org>
Date: Wed, 1 Dec 2010 03:37:39 -0800
Subject: Update external-app-blocker to Firefox 4 registration style.
Commit: 9ab194ce80370f736132576f5ea57f738cb0c3af

---
 src/chrome.manifest                    |    5 +++++
 src/components/external-app-blocker.js |   15 ++++++++++++---
 src/components/ignore-history.js       |    4 +++-
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/chrome.manifest b/src/chrome.manifest
index a849c90..4fdd6c2 100644
--- a/src/chrome.manifest
+++ b/src/chrome.manifest
@@ -61,6 +61,11 @@ skin torbutton classic/1.0 chrome/skin/
 style chrome://global/content/customizeToolbar.xul chrome://torbutton/skin/torbutton.css
 
 # Firefox 4-style component registration
+component {3da0269f-fc29-4e9e-a678-c3b1cafcf13f} components/external-app-blocker.js
+contract @mozilla.org/mime;1 {3da0269f-fc29-4e9e-a678-c3b1cafcf13f}
+contract @mozilla.org/uriloader/external-protocol-service;1 {3da0269f-fc29-4e9e-a678-c3b1cafcf13f}
+contract @mozilla.org/uriloader/external-helper-app-service;1 {3da0269f-fc29-4e9e-a678-c3b1cafcf13f}
+
 component {e6204253-b690-4159-bfe8-d4eedab6b3be} components/cookie-jar-selector.js
 contract @torproject.org/cookie-jar-selector;1 {e6204253-b690-4159-bfe8-d4eedab6b3be}
 
diff --git a/src/components/external-app-blocker.js b/src/components/external-app-blocker.js
index dfaf588..f8f7ea5 100644
--- a/src/components/external-app-blocker.js
+++ b/src/components/external-app-blocker.js
@@ -266,8 +266,17 @@ ExternalWrapperModule.canUnload = function (compMgr)
   return true;
 };
 
-function NSGetModule(compMgr, fileSpec)
-{
-  return ExternalWrapperModule;
+/**
+* XPCOMUtils.generateNSGetFactory was introduced in Mozilla 2 (Firefox 4).
+* XPCOMUtils.generateNSGetModule is for Mozilla 1.9.2 (Firefox 3.6).
+*/
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+if (XPCOMUtils.generateNSGetFactory) {
+    var NSGetFactory = XPCOMUtils.generateNSGetFactory([ExternalWrapper]);
+} else {
+    function NSGetModule(compMgr, fileSpec)
+    {
+      return ExternalWrapperModule;
+    }
 }
 
diff --git a/src/components/ignore-history.js b/src/components/ignore-history.js
index 4d9f4f6..a0d0725 100644
--- a/src/components/ignore-history.js
+++ b/src/components/ignore-history.js
@@ -356,8 +356,10 @@ HistoryWrapperModule.canUnload = function (compMgr)
   return true;
 };
 
+// We only need to support Firefox 3.x here. Firefox 4's history behavior
+// is now tunable into a safe state for Tor that actually matches
+// our own internal options. Yay, progress.
 function NSGetModule(compMgr, fileSpec)
 {
   return HistoryWrapperModule;
 }
-
-- 
1.7.1




More information about the tor-commits mailing list