mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix for bug 658632 (Provide easy way to add non-leaky classinfo to JS components). r=gavin.
--HG-- extra : rebase_source : 8463c6f8ba1f969278d4e33bfa08495fa3e36071
This commit is contained in:
parent
cede8382a6
commit
ae44770a16
@ -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])
|
||||
};
|
||||
|
@ -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",
|
||||
|
@ -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]);
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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]);
|
||||
|
@ -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() {
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user