diff --git a/browser/components/feeds/src/FeedWriter.js b/browser/components/feeds/src/FeedWriter.js index ffa24840794..4f4040cad5e 100644 --- a/browser/components/feeds/src/FeedWriter.js +++ b/browser/components/feeds/src/FeedWriter.js @@ -47,6 +47,9 @@ const Cu = Components.utils; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +const FEEDWRITER_CID = Components.ID("{49bb6593-3aff-4eb3-a068-2712c28bd58e}"); +const FEEDWRITER_CONTRACTID = "@mozilla.org/browser/feeds/result-writer;1"; + function LOG(str) { var prefB = Cc["@mozilla.org/preferences-service;1"]. getService(Ci.nsIPrefBranch); @@ -1377,17 +1380,12 @@ FeedWriter.prototype = { }); }, - // nsIClassInfo - getInterfaces: function FW_getInterfaces(countRef) { - var interfaces = [Ci.nsIFeedWriter, Ci.nsIClassInfo, Ci.nsISupports]; - countRef.value = interfaces.length; - return interfaces; - }, - getHelperForLanguage: function FW_getHelperForLanguage(language) null, - classID: Components.ID("{49bb6593-3aff-4eb3-a068-2712c28bd58e}"), - implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT, - flags: Ci.nsIClassInfo.DOM_OBJECT, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIFeedWriter, Ci.nsIClassInfo, + classID: FEEDWRITER_CID, + classInfo: XPCOMUtils.generateCI({classID: FEEDWRITER_CID, + contractID: FEEDWRITER_CONTRACTID, + interfaces: [Ci.nsIFeedWriter], + flags: Ci.nsIClassInfo.DOM_OBJECT}), + QueryInterface: XPCOMUtils.generateQI([Ci.nsIFeedWriter, Ci.nsIDOMEventListener, Ci.nsIObserver, Ci.nsINavHistoryObserver]) }; diff --git a/browser/components/feeds/src/WebContentConverter.js b/browser/components/feeds/src/WebContentConverter.js index 4e3c8f2d39a..78f61eb28d0 100644 --- a/browser/components/feeds/src/WebContentConverter.js +++ b/browser/components/feeds/src/WebContentConverter.js @@ -911,23 +911,14 @@ WebContentConverterRegistrar.prototype = { return this.QueryInterface(iid); }, - /** - * See nsIClassInfo - */ - getInterfaces: function WCCR_getInterfaces(countRef) { - var interfaces = - [Ci.nsIWebContentConverterService, Ci.nsIWebContentHandlerRegistrar, - Ci.nsIObserver, Ci.nsIClassInfo, Ci.nsIFactory, Ci.nsISupports]; - countRef.value = interfaces.length; - return interfaces; - }, - getHelperForLanguage: function WCCR_getHelperForLanguage(language) { - return null; - }, classID: WCCR_CLASSID, - implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT, - flags: Ci.nsIClassInfo.DOM_OBJECT, - + classInfo: XPCOMUtils.generateCI({classID: WCCR_CLASSID, + contractID: WCCR_CONTRACTID, + interfaces: [Ci.nsIWebContentConverterService, + Ci.nsIWebContentHandlerRegistrar, + Ci.nsIObserver, Ci.nsIFactory], + flags: Ci.nsIClassInfo.DOM_OBJECT}), + /** * See nsISupports */ @@ -935,9 +926,7 @@ WebContentConverterRegistrar.prototype = { [Ci.nsIWebContentConverterService, Ci.nsIWebContentHandlerRegistrar, Ci.nsIObserver, - Ci.nsIClassInfo, - Ci.nsIFactory, - Ci.nsISupports]), + Ci.nsIFactory]), _xpcom_categories: [{ category: "app-startup", diff --git a/browser/components/sidebar/src/nsSidebar.js b/browser/components/sidebar/src/nsSidebar.js index b2654cb73a3..4cd31b2ba21 100644 --- a/browser/components/sidebar/src/nsSidebar.js +++ b/browser/components/sidebar/src/nsSidebar.js @@ -46,8 +46,8 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); const DEBUG = false; /* set to false to suppress debug messages */ +const SIDEBAR_CONTRACTID = "@mozilla.org/sidebar;1"; const SIDEBAR_CID = Components.ID("{22117140-9c6e-11d3-aaf1-00805f8a4905}"); -const nsISupports = Components.interfaces.nsISupports; const nsISidebar = Components.interfaces.nsISidebar; const nsISidebarExternal = Components.interfaces.nsISidebarExternal; const nsIClassInfo = Components.interfaces.nsIClassInfo; @@ -214,32 +214,13 @@ function (aSearchURL) return 0; } -// property of nsIClassInfo -nsSidebar.prototype.flags = nsIClassInfo.DOM_OBJECT; +nsSidebar.prototype.classInfo = XPCOMUtils.generateCI({classID: SIDEBAR_CID, + contractID: SIDEBAR_CONTRACTID, + classDescription: "Sidebar", + interfaces: [nsISidebar, nsISidebarExternal], + flags: nsIClassInfo.DOM_OBJECT}); -// property of nsIClassInfo -nsSidebar.prototype.classDescription = "Sidebar"; - -// method of nsIClassInfo -nsSidebar.prototype.getInterfaces = function(count) { - var interfaceList = [nsISidebar, nsISidebarExternal, nsIClassInfo]; - count.value = interfaceList.length; - return interfaceList; -} - -// method of nsIClassInfo -nsSidebar.prototype.getHelperForLanguage = function(count) {return null;} - -nsSidebar.prototype.QueryInterface = -function (iid) { - if (iid.equals(nsISidebar) || - iid.equals(nsISidebarExternal) || - iid.equals(nsIClassInfo) || - iid.equals(nsISupports)) - return this; - - throw Components.results.NS_ERROR_NO_INTERFACE; -}; +nsSidebar.prototype.QueryInterface = XPCOMUtils.generateQI([nsISidebar, nsISidebarExternal]); var NSGetFactory = XPCOMUtils.generateNSGetFactory([nsSidebar]); diff --git a/browser/fuel/src/fuelApplication.js b/browser/fuel/src/fuelApplication.js index 6310af5501b..8d7ec94d24b 100644 --- a/browser/fuel/src/fuelApplication.js +++ b/browser/fuel/src/fuelApplication.js @@ -40,6 +40,9 @@ const Cc = Components.classes; Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); +const APPLICATION_CID = Components.ID("fe74cf80-aa2d-11db-abbd-0800200c9a66"); +const APPLICATION_CONTRACTID = "@mozilla.org/fuel/application;1"; + //================================================= // Singleton that holds services and utilities var Utilities = { @@ -668,21 +671,22 @@ function Application() { // Application implementation Application.prototype = { // for nsIClassInfo + XPCOMUtils - classID: Components.ID("fe74cf80-aa2d-11db-abbd-0800200c9a66"), + classID: APPLICATION_CID, // redefine the default factory for XPCOMUtils _xpcom_factory: ApplicationFactory, // for nsISupports QueryInterface : XPCOMUtils.generateQI([Ci.fuelIApplication, Ci.extIApplication, - Ci.nsIObserver, Ci.nsIClassInfo]), + Ci.nsIObserver]), - getInterfaces : function app_gi(aCount) { - var interfaces = [Ci.fuelIApplication, Ci.extIApplication, Ci.nsIObserver, - Ci.nsIClassInfo]; - aCount.value = interfaces.length; - return interfaces; - }, + // for nsIClassInfo + classInfo: XPCOMUtils.generateCI({classID: APPLICATION_CID, + contractID: APPLICATION_CONTRACTID, + interfaces: [Ci.fuelIApplication, + Ci.extIApplication, + Ci.nsIObserver], + flags: Ci.nsIClassInfo.SINGLETON}), // for nsIObserver observe: function app_observe(aSubject, aTopic, aData) { diff --git a/content/xslt/src/xslt/txEXSLTRegExFunctions.js b/content/xslt/src/xslt/txEXSLTRegExFunctions.js index 4807cbc4ca9..e257d16df5a 100644 --- a/content/xslt/src/xslt/txEXSLTRegExFunctions.js +++ b/content/xslt/src/xslt/txEXSLTRegExFunctions.js @@ -40,8 +40,8 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); const EXSLT_REGEXP_CID = Components.ID("{18a03189-067b-4978-b4f1-bafe35292ed6}"); +const EXSLT_REGEXP_CONTRACTID = "@mozilla.org/exslt/regexp;1"; -const CATMAN_CONTRACTID = "@mozilla.org/categorymanager;1"; const NODESET_CONTRACTID = "@mozilla.org/transformiix-nodeset;1"; const Ci = Components.interfaces; @@ -55,32 +55,11 @@ var SingletonInstance = null; txEXSLTRegExFunctions.prototype = { classID: EXSLT_REGEXP_CID, - QueryInterface: function(iid) { - if (iid.equals(Ci.nsISupports) || - iid.equals(Ci.nsIClassInfo) || - iid.equals(Ci.txIEXSLTRegExFunctions)) - return this; - - throw Components.results.NS_ERROR_NO_INTERFACE; - }, - - // nsIClassInfo - getInterfaces: function(countRef) { - var interfaces = [ - Ci.txIEXSLTRegExFunctions - ]; - countRef.value = interfaces.length; - - return interfaces; - }, - - getHelperForLanguage: function(language) { - return null; - }, - - implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT, - flags: 0, + QueryInterface: XPCOMUtils.generateQI([Ci.txIEXSLTRegExFunctions]), + classInfo: XPCOMUtils.generateCI({classID: EXSLT_REGEXP_CID, + contractID: EXSLT_REGEXP_CONTRACTID, + interfaces: [Ci.txIEXSLTRegExFunctions]}), // txIEXSLTRegExFunctions match: function(context, str, regex, flags) { diff --git a/dom/system/GPSDGeolocationProvider.js b/dom/system/GPSDGeolocationProvider.js index a0e1469e2c5..f2f9bd0ecb6 100644 --- a/dom/system/GPSDGeolocationProvider.js +++ b/dom/system/GPSDGeolocationProvider.js @@ -68,21 +68,12 @@ function GeoPositionCoordsObject(latitude, longitude, altitude, accuracy, altitu GeoPositionCoordsObject.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPositionCoords, Ci.nsIClassInfo]), + QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPositionCoords]), // Class Info is required to be able to pass objects back into the DOM. - getInterfaces: function(countRef) { - var interfaces = [Ci.nsIDOMGeoPositionCoords, Ci.nsIClassInfo, Ci.nsISupports]; - countRef.value = interfaces.length; - return interfaces; - }, - - getHelperForLanguage: function(language) null, - contractID: null, - classDescription: "Geoposition Coordinate Object", - classID: null, - implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT, - flags: Ci.nsIClassInfo.DOM_OBJECT, + classInfo: XPCOMUtils.generateCI({interfaces: [Ci.nsIDOMGeoPositionCoords], + flags: Ci.nsIClassInfo.DOM_OBJECT, + classDescription: "Geoposition Coordinate Object"}), latitude: null, longitude: null, @@ -101,21 +92,12 @@ function GeoPositionObject(latitude, longitude, altitude, accuracy, altitudeAccu GeoPositionObject.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPosition, Ci.nsIClassInfo]), + QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPosition]), // Class Info is required to be able to pass objects back into the DOM. - getInterfaces: function(countRef) { - var interfaces = [Ci.nsIDOMGeoPosition, Ci.nsIClassInfo, Ci.nsISupports]; - countRef.value = interfaces.length; - return interfaces; - }, - - getHelperForLanguage: function(language) null, - contractID: null, - classDescription: "Geoposition Object", - classID: null, - implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT, - flags: Ci.nsIClassInfo.DOM_OBJECT, + classInfo: XPCOMUtils.generateCI({interfaces: [Ci.nsIDOMGeoPosition], + flags: Ci.nsIClassInfo.DOM_OBJECT, + classDescription: "Geoposition Object"}), coords: null, timestamp: null, diff --git a/dom/system/NetworkGeolocationProvider.js b/dom/system/NetworkGeolocationProvider.js index fe48420f4b4..8762d8ca70c 100755 --- a/dom/system/NetworkGeolocationProvider.js +++ b/dom/system/NetworkGeolocationProvider.js @@ -35,17 +35,10 @@ function WifiGeoAddressObject(streetNumber, street, premises, city, county, regi WifiGeoAddressObject.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPositionAddress, Ci.nsIClassInfo]), + QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPositionAddress]), - getInterfaces: function(countRef) { - var interfaces = [Ci.nsIDOMGeoPositionAddress, Ci.nsIClassInfo, Ci.nsISupports]; - countRef.value = interfaces.length; - return interfaces; - }, - - getHelperForLanguage: function(language) null, - implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT, - flags: Ci.nsIClassInfo.DOM_OBJECT, + classInfo: XPCOMUtils.generateCI({interfaces: [Ci.nsIDOMGeoPositionAddress], + flags: Ci.nsIClassInfo.DOM_OBJECT}) }; function WifiGeoCoordsObject(lat, lon, acc, alt, altacc) { @@ -58,18 +51,11 @@ function WifiGeoCoordsObject(lat, lon, acc, alt, altacc) { WifiGeoCoordsObject.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPositionCoords, Ci.nsIClassInfo]), + QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPositionCoords]), - getInterfaces: function(countRef) { - var interfaces = [Ci.nsIDOMGeoPositionCoords, Ci.nsIClassInfo, Ci.nsISupports]; - countRef.value = interfaces.length; - return interfaces; - }, - - getHelperForLanguage: function(language) null, - classDescription: "wifi geo position coords object", - implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT, - flags: Ci.nsIClassInfo.DOM_OBJECT, + classInfo: XPCOMUtils.generateCI({interfaces: [Ci.nsIDOMGeoPositionCoords], + flags: Ci.nsIClassInfo.DOM_OBJECT, + classDescription: "wifi geo position coords object"}), latitude: 0, longitude: 0, @@ -107,19 +93,12 @@ function WifiGeoPositionObject(location) { WifiGeoPositionObject.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPosition, Ci.nsIClassInfo]), + QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPosition]), // Class Info is required to be able to pass objects back into the DOM. - getInterfaces: function(countRef) { - var interfaces = [Ci.nsIDOMGeoPosition, Ci.nsIClassInfo, Ci.nsISupports]; - countRef.value = interfaces.length; - return interfaces; - }, - - getHelperForLanguage: function(language) null, - classDescription: "wifi geo location position object", - implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT, - flags: Ci.nsIClassInfo.DOM_OBJECT, + classInfo: XPCOMUtils.generateCI({interfaces: [Ci.nsIDOMGeoPosition], + flags: Ci.nsIClassInfo.DOM_OBJECT, + classDescription: "wifi geo location position object"}), coords: null, timestamp: 0, diff --git a/js/src/xpconnect/loader/XPCOMUtils.jsm b/js/src/xpconnect/loader/XPCOMUtils.jsm index 42787ef847b..0b4d2e51fe8 100644 --- a/js/src/xpconnect/loader/XPCOMUtils.jsm +++ b/js/src/xpconnect/loader/XPCOMUtils.jsm @@ -68,6 +68,19 @@ * "nsIFoo", * "nsIBar" ]), * + * // [optional] classInfo implementation, e.g. using the generateCI helper. + * // Will be automatically returned from QueryInterface if that was + * // generated with the generateQI helper. + * classInfo: XPCOMUtils.generateCI( + * {classID: Components.ID("{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"), + * contractID: "@example.com/xxx;1", + * classDescription: "unique text description", + * interfaces: [Components.interfaces.nsIObserver, + * Components.interfaces.nsIMyInterface, + * "nsIFoo", + * "nsIBar"], + * flags: Ci.nsIClassInfo.SINGLETON}), + * * // The following properties were used prior to Mozilla 2, but are no * // longer supported. They may still be included for compatibility with * // prior versions of XPCOMUtils. In Mozilla 2, this information is @@ -122,12 +135,44 @@ var XPCOMUtils = { * assigned to the 'QueryInterface' property of a JS object. When invoked on * that object, it checks if the given iid is listed in the |interfaces| * param, and if it is, returns |this| (the object it was called on). + * If the JS object has a classInfo property it'll be returned for the + * nsIClassInfo IID, generateCI can be used to generate the classInfo + * property. */ generateQI: function XPCU_generateQI(interfaces) { /* Note that Ci[Ci.x] == Ci.x for all x */ return makeQI([Ci[i].name for each (i in interfaces) if (Ci[i])]); }, + /** + * Generate a ClassInfo implementation for a component. The returned object + * must be assigned to the 'classInfo' property of a JS object. The first and + * only argument should be an object that contains a number of optional + * properties: "interfaces", "contractID", "classDescription", "classID" and + * "flags". The values of the properties will be returned as the values of the + * various properties of the nsIClassInfo implementation. + */ + generateCI: function XPCU_generateCI(classInfo) + { + if (QueryInterface in classInfo) + throw Error("In generateCI, don't use a component for generating classInfo"); + /* Note that Ci[Ci.x] == Ci.x for all x */ + var _interfaces = [Ci[i] for each (i in classInfo.interfaces) if (Ci[i])]; + return { + getInterfaces: function XPCU_getInterfaces(countRef) { + countRef.value = _interfaces.length; + return _interfaces; + }, + getHelperForLanguage: function XPCU_getHelperForLanguage(language) null, + contractID: classInfo.contractID, + classDescription: classInfo.classDescription, + classID: classInfo.classID, + implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT, + flags: classInfo.flags, + QueryInterface: this.generateQI([Ci.nsIClassInfo]) + }; + }, + /** * Generate a NSGetFactory function given an array of components. */ @@ -281,6 +326,8 @@ function makeQI(interfaceNames) { return function XPCOMUtils_QueryInterface(iid) { if (iid.equals(Ci.nsISupports)) return this; + if (iid.equals(Ci.nsIClassInfo) && "classInfo" in this) + return this.classInfo; for each(let interfaceName in interfaceNames) { if (Ci[interfaceName].equals(iid)) return this; diff --git a/js/src/xpconnect/tests/unit/test_xpcomutils.js b/js/src/xpconnect/tests/unit/test_xpcomutils.js index 7d337bb4a9b..c9ab5b2e767 100644 --- a/js/src/xpconnect/tests/unit/test_xpcomutils.js +++ b/js/src/xpconnect/tests/unit/test_xpcomutils.js @@ -76,6 +76,31 @@ function test_generateQI_string_names() } +function test_generateCI() +{ + const classID = Components.ID("562dae2e-7cff-432b-995b-3d4c03fa2b89"); + const classDescription = "generateCI test component"; + const flags = Components.interfaces.nsIClassInfo.DOM_OBJECT; + var x = { + QueryInterface: XPCOMUtils.generateQI([]), + classInfo: XPCOMUtils.generateCI({classID: classID, + interfaces: [], + flags: flags, + classDescription: classDescription}) + }; + + try { + var ci = x.QueryInterface(Components.interfaces.nsIClassInfo); + ci = ci.QueryInterface(Components.interfaces.nsISupports); + ci = ci.QueryInterface(Components.interfaces.nsIClassInfo); + do_check_eq(ci.classID, classID); + do_check_eq(ci.flags, flags); + do_check_eq(ci.classDescription, classDescription); + } catch(e) { + do_throw("Classinfo for x should not be missing or broken"); + } +} + function test_defineLazyGetter() { let accessCount = 0; @@ -186,6 +211,7 @@ function test_categoryRegistration() let tests = [ test_generateQI_string_names, + test_generateCI, test_defineLazyGetter, test_defineLazyServiceGetter, test_categoryRegistration, diff --git a/mobile/components/Sidebar.js b/mobile/components/Sidebar.js index dadfb374a37..7aa66741b82 100644 --- a/mobile/components/Sidebar.js +++ b/mobile/components/Sidebar.js @@ -48,6 +48,9 @@ const Cu = Components.utils; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); +const SIDEBAR_CID = Components.ID("{22117140-9c6e-11d3-aaf1-00805f8a4905}"); +const SIDEBAR_CONTRACTID = "@mozilla.org/sidebar;1"; + function Sidebar() { // Depending on if we are in the parent or child, prepare to remote // certain calls @@ -167,24 +170,19 @@ Sidebar.prototype = { }, // =========================== nsIClassInfo =========================== - flags: Ci.nsIClassInfo.DOM_OBJECT, - classDescription: "Sidebar", - getInterfaces: function getInterfaces(count) { - var interfaceList = [Ci.nsISidebar, Ci.nsISidebarExternal, Ci.nsIClassInfo]; - count.value = interfaceList.length; - return interfaceList; - }, - getHelperForLanguage: function getHelperForLanguage(count) { - return null; - }, + classInfo: XPCOMUtils.generateCI({classID: SIDEBAR_CID, + contractID: SIDEBAR_CONTRACTID, + interfaces: [Ci.nsISidebar, + Ci.nsISidebarExternal], + flags: Ci.nsIClassInfo.DOM_OBJECT, + classDescription: "Sidebar"}), // =========================== nsISupports =========================== QueryInterface: XPCOMUtils.generateQI([Ci.nsISidebar, - Ci.nsISidebarExternal, - Ci.nsIClassInfo]), + Ci.nsISidebarExternal]), // XPCOMUtils stuff - classID: Components.ID("{22117140-9c6e-11d3-aaf1-00805f8a4905}"), + classID: SIDEBAR_CID, }; const NSGetFactory = XPCOMUtils.generateNSGetFactory([Sidebar]); diff --git a/toolkit/components/exthelper/extApplication.js b/toolkit/components/exthelper/extApplication.js index d1a96e39f1a..f5d026c74b1 100644 --- a/toolkit/components/exthelper/extApplication.js +++ b/toolkit/components/exthelper/extApplication.js @@ -556,19 +556,9 @@ extApplication.prototype = { this._registered = {"unload": true}; }, - // for nsIClassInfo - flags : Ci.nsIClassInfo.SINGLETON, - implementationLanguage : Ci.nsIProgrammingLanguage.JAVASCRIPT, - - getInterfaces : function app_gi(aCount) { - var interfaces = [Ci.extIApplication, Ci.nsIObserver, Ci.nsIClassInfo]; - aCount.value = interfaces.length; - return interfaces; - }, - - getHelperForLanguage : function app_ghfl(aCount) { - return null; - }, + classInfo: XPCOMUtils.generateCI({interfaces: [Ci.extIApplication, + Ci.nsIObserver], + flags: Ci.nsIClassInfo.SINGLETON}), // extIApplication get id() { diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js index 9a0845295c1..3a5c3d7431b 100644 --- a/toolkit/mozapps/update/nsUpdateService.js +++ b/toolkit/mozapps/update/nsUpdateService.js @@ -51,6 +51,9 @@ const Cc = Components.classes; const Ci = Components.interfaces; const Cr = Components.results; +const UPDATESERVICE_CID = Components.ID("{B3C290A6-3943-4B89-8BBE-C01EB7B3B311}"); +const UPDATESERVICE_CONTRACTID = "@mozilla.org/updates/update-service;1"; + const PREF_APP_UPDATE_ALTWINDOWTYPE = "app.update.altwindowtype"; const PREF_APP_UPDATE_AUTO = "app.update.auto"; const PREF_APP_UPDATE_BACKGROUND_INTERVAL = "app.update.download.backgroundInterval"; @@ -1778,19 +1781,14 @@ UpdateService.prototype = { return this._downloader && this._downloader.isBusy; }, - // nsIClassInfo - flags: Ci.nsIClassInfo.SINGLETON, - implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT, - getHelperForLanguage: function(language) null, - getInterfaces: function AUS_getInterfaces(count) { - var interfaces = [Ci.nsIApplicationUpdateService, - Ci.nsITimerCallback, - Ci.nsIObserver]; - count.value = interfaces.length; - return interfaces; - }, + classID: UPDATESERVICE_CID, + classInfo: XPCOMUtils.generateCI({classID: UPDATESERVICE_CID, + contractID: UPDATESERVICE_CONTRACTID, + interfaces: [Ci.nsIApplicationUpdateService, + Ci.nsITimerCallback, + Ci.nsIObserver], + flags: Ci.nsIClassInfo.SINGLETON}), - classID: Components.ID("{B3C290A6-3943-4B89-8BBE-C01EB7B3B311}"), _xpcom_factory: UpdateServiceFactory, QueryInterface: XPCOMUtils.generateQI([Ci.nsIApplicationUpdateService, Ci.nsIAddonUpdateCheckListener,