[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [torbutton/master 03/31] Update logger to Firefox 4.



Author: Mike Perry <mikeperry-git@xxxxxxxxxx>
Date: Sun, 28 Nov 2010 19:06:47 -0800
Subject: Update logger to Firefox 4.
Commit: 3b1db374edeb1a9e5f9c08a7d7128d1d067d2b4e

---
 src/chrome.manifest                |    3 ++
 src/components/torbutton-logger.js |   64 ++++++-----------------------------
 2 files changed, 14 insertions(+), 53 deletions(-)

diff --git a/src/chrome.manifest b/src/chrome.manifest
index 9d8682d..2736329 100644
--- a/src/chrome.manifest
+++ b/src/chrome.manifest
@@ -67,6 +67,9 @@ contract @torproject.org/cookie-jar-selector;1 {e6204253-b690-4159-bfe8-d4eedab6
 component {23f4d9ba-023a-94ab-eb75-67aed7562a18} components/cssblocker.js
 contract @torproject.org/cssblocker;1 {23f4d9ba-023a-94ab-eb75-67aed7562a18}
 
+component {f36d72c9-9718-4134-b550-e109638331d7} components/torbutton-logger.js
+contract @torproject.org/torbutton-logger;1 {f36d72c9-9718-4134-b550-e109638331d7}
+
 category content-policy ContentPolicy @torproject.org/cssblocker;1
 category profile-after-change CookieJarSelector @torproject.org/cookie-jar-selector;1
 
diff --git a/src/components/torbutton-logger.js b/src/components/torbutton-logger.js
index 0f23278..cdd611e 100644
--- a/src/components/torbutton-logger.js
+++ b/src/components/torbutton-logger.js
@@ -78,6 +78,8 @@ TorbuttonLogger.prototype =
 
   // method of nsIClassInfo
   classDescription: "TorbuttonLogger",
+  classID: kMODULE_CID,
+  contractID: kMODULE_CONTRACTID,
 
   // method of nsIClassInfo
   getInterfaces: function(count) {
@@ -157,56 +159,12 @@ TorbuttonLogger.prototype =
   }
 }
 
-var TorbuttonLoggerInstance = null;
-var TorbuttonLoggerFactory = new Object();
-
-TorbuttonLoggerFactory.createInstance = function (outer, iid)
-{
-  if (outer != null) {
-    Components.returnCode = Cr.NS_ERROR_NO_AGGREGATION;
-    return null;
-  }
-  if (!iid.equals(nsIClassInfo) &&
-      !iid.equals(nsISupports)) {
-    Components.returnCode = Cr.NS_ERROR_NO_INTERFACE;
-    return null;
-  }
-  if(TorbuttonLoggerInstance == null)
-      TorbuttonLoggerInstance = new TorbuttonLogger();
-
-  return TorbuttonLoggerInstance;
-}
-
-var TorbuttonLoggerModule = new Object();
-
-TorbuttonLoggerModule.registerSelf = 
-function (compMgr, fileSpec, location, type)
-{
-  compMgr = compMgr.QueryInterface(nsIComponentRegistrar);
-  compMgr.registerFactoryLocation(kMODULE_CID,
-                                  kMODULE_NAME,
-                                  kMODULE_CONTRACTID,
-                                  fileSpec, 
-                                  location, 
-                                  type);
-}
-
-TorbuttonLoggerModule.getClassObject = function (compMgr, cid, iid)
-{
-  if (cid.equals(kMODULE_CID))
-    return TorbuttonLoggerFactory;
-
-
-  Components.returnCode = Cr.NS_ERROR_NOT_REGISTERED;
-  return null;
-}
-
-TorbuttonLoggerModule.canUnload = function (compMgr)
-{
-  return true;
-}
-
-function NSGetModule(compMgr, fileSpec)
-{
-  return TorbuttonLoggerModule;
-}
+/**
+* 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([TorbuttonLogger]);
+else
+    var NSGetModule = XPCOMUtils.generateNSGetModule([TorbuttonLogger]);
-- 
1.7.1