All pastes #46578 Raw Edit

Unnamed

public text v1 · immutable
#46578 ·published 2006-03-22 10:18 UTC
rendered paste body
Index: nsSearchService.js
===================================================================
RCS file: /cvsroot/mozilla/browser/components/search/nsSearchService.js,v
retrieving revision 1.7
diff -u -r1.7 nsSearchService.js
--- nsSearchService.js	19 Mar 2006 06:54:29 -0000	1.7
+++ nsSearchService.js	22 Mar 2006 10:13:15 -0000
@@ -2044,6 +2050,15 @@
   _className: "Browser Search Service",
   _contractID: "@mozilla.org/browser/search-service;1",
 
+  // nsIFactory
+  _factory: {
+    createInstance: function (outer, iid) {
+      if (outer != null)
+        throw Cr.NS_ERROR_NO_AGGREGATION;
+      return (new SearchService()).QueryInterface(iid);
+    }
+  },
+
   registerSelf: function (componentManager, fileSpec, location, type) {
     componentManager.QueryInterface(Ci.nsIComponentRegistrar);
     componentManager.registerFactoryLocation(this._classID,
@@ -2055,7 +2070,8 @@
   getClassObject: function (componentManager, cid, iid) {
     if (!iid.equals(Ci.nsIFactory))
       throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-    return this;
+    return this._factory;
+    //return this;
   },
 
   createInstance: function (outer, iid) {