[or-cvs] [torbutton/master 04/31] Update the content window mapper to Firefox 4.

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: Sun, 28 Nov 2010 19:16:16 -0800
Subject: Update the content window mapper to Firefox 4.
Commit: 485c95e48d3f811262fc2eb19e1b287a35ebce69

We may not even need this anymore. There is a new Tab manager with new APIs..
---
 src/chrome.manifest             |    3 ++
 src/components/window-mapper.js |   70 ++++++--------------------------------
 2 files changed, 14 insertions(+), 59 deletions(-)

diff --git a/src/chrome.manifest b/src/chrome.manifest
index 2736329..cbcf30a 100644
--- a/src/chrome.manifest
+++ b/src/chrome.manifest
@@ -70,6 +70,9 @@ 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}
 
+component {b985e49c-12cb-4f29-9d14-b62603332ec4} components/window-mapper.js
+contract @torproject.org/content-window-mapper;1 {b985e49c-12cb-4f29-9d14-b62603332ec4}
+
 category content-policy ContentPolicy @torproject.org/cssblocker;1
 category profile-after-change CookieJarSelector @torproject.org/cookie-jar-selector;1
 
diff --git a/src/components/window-mapper.js b/src/components/window-mapper.js
index 58e503a..4724ae5 100644
--- a/src/components/window-mapper.js
+++ b/src/components/window-mapper.js
@@ -49,7 +49,9 @@ ContentWindowMapper.prototype =
   flags: nsIClassInfo.DOM_OBJECT,
 
   // method of nsIClassInfo
-  classDescription: "ContentWindowMapper",
+  classDescription: kMODULE_NAME,
+  classID: kMODULE_CID,
+  contractID: kMODULE_CONTRACTID,
 
   // method of nsIClassInfo
   getInterfaces: function(count) {
@@ -166,61 +168,11 @@ ContentWindowMapper.prototype =
 }
 
 /**
- * JS XPCOM component registration goop:
- *
- * Everything below is boring boilerplate and can probably be ignored.
- */
-
-var ContentWindowMapperInstance = null;
-var ContentWindowMapperFactory = new Object();
-
-ContentWindowMapperFactory.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(ContentWindowMapperInstance == null)
-      ContentWindowMapperInstance = new ContentWindowMapper();
-
-  return ContentWindowMapperInstance;
-}
-
-var ContentWindowMapperModule = new Object();
-
-ContentWindowMapperModule.registerSelf = 
-function (compMgr, fileSpec, location, type)
-{
-  compMgr = compMgr.QueryInterface(nsIComponentRegistrar);
-  compMgr.registerFactoryLocation(kMODULE_CID,
-                                  kMODULE_NAME,
-                                  kMODULE_CONTRACTID,
-                                  fileSpec, 
-                                  location, 
-                                  type);
-}
-
-ContentWindowMapperModule.getClassObject = function (compMgr, cid, iid)
-{
-  if (cid.equals(kMODULE_CID))
-    return ContentWindowMapperFactory;
-
-
-  Components.returnCode = Cr.NS_ERROR_NOT_REGISTERED;
-  return null;
-}
-
-ContentWindowMapperModule.canUnload = function (compMgr)
-{
-  return true;
-}
-
-function NSGetModule(compMgr, fileSpec)
-{
-  return ContentWindowMapperModule;
-}
+* 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([ContentWindowMapper]);
+else
+    var NSGetModule = XPCOMUtils.generateNSGetModule([ContentWindowMapper]);
-- 
1.7.1




More information about the tor-commits mailing list