mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
bug 378618. r=gavin. removed singleton member from factory to remove a leak
This commit is contained in:
parent
1fcb5c8236
commit
f5d2f3b13d
@ -663,25 +663,18 @@ Application.prototype = {
|
||||
//=================================================
|
||||
// Factory - Treat Application as a singleton
|
||||
var ApplicationFactory = {
|
||||
singleton: null,
|
||||
|
||||
createInstance: function af_ci(aOuter, aIID)
|
||||
{
|
||||
createInstance: function af_ci(aOuter, aIID) {
|
||||
if (aOuter != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
if (this.singleton == null)
|
||||
this.singleton = new Application();
|
||||
|
||||
return this.singleton.QueryInterface(aIID);
|
||||
return (new Application()).QueryInterface(aIID);
|
||||
}
|
||||
};
|
||||
|
||||
//=================================================
|
||||
// Module
|
||||
var ApplicationModule = {
|
||||
registerSelf: function am_rs(aCompMgr, aFileSpec, aLocation, aType)
|
||||
{
|
||||
registerSelf: function am_rs(aCompMgr, aFileSpec, aLocation, aType) {
|
||||
aCompMgr = aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
aCompMgr.registerFactoryLocation(CLASS_ID, CLASS_NAME, CONTRACT_ID, aFileSpec, aLocation, aType);
|
||||
|
||||
@ -694,8 +687,7 @@ var ApplicationModule = {
|
||||
categoryManager.addCategoryEntry("JavaScript global property", "Application", CONTRACT_ID, true, true);
|
||||
},
|
||||
|
||||
unregisterSelf: function am_us(aCompMgr, aLocation, aType)
|
||||
{
|
||||
unregisterSelf: function am_us(aCompMgr, aLocation, aType) {
|
||||
aCompMgr = aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
aCompMgr.unregisterFactoryLocation(CLASS_ID, aLocation);
|
||||
|
||||
@ -706,8 +698,7 @@ var ApplicationModule = {
|
||||
categoryManager.deleteCategoryEntry("JavaScript global property", CONTRACT_ID, true);
|
||||
},
|
||||
|
||||
getClassObject: function am_gco(aCompMgr, aCID, aIID)
|
||||
{
|
||||
getClassObject: function am_gco(aCompMgr, aCID, aIID) {
|
||||
if (!aIID.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user