Firefox can be run without a named profile.
firefox -profile c:\foo
That makes firefox simply store its profile data under c:\foo. There is no entry created for this directory in the profiles.ini file, so there is no name associated with the profile. Now, granted this is not the usual way that firefox is invoked, but it is an interesting case to consider.
-Darin
Lev Serebryakov wrote:
My extension need to know name (only name!) of current profile. It should work in Mozilla (1.7.x) and fireFox.
I've wrote this code:
==============================================================
_init: function()
{
......
this._profileManager = null;
this._profileMethod = '';
if ( "@mozilla.org/profile/manager;1" in Components.classes )
{
try
{
this._profileManager = Components.classes[ "@mozilla.org/profile/manager;1" ].getService(Components.interfaces.nsIProfile);
this._profileMethod = 'old';
}
catch( ex )
{
dump( "[MyExt] Can not get old profile manager\n" );
}
}
else if( "@mozilla.org/toolkit/profile-service;1" in Components.classes )
{
try
{
this._profileManager = Components.classes[ "@mozilla.org/toolkit/profile-service;1" ].getService(Components.interfaces.nsIToolkitProfileService);
this._profileMethod = 'new';
}
catch( ex )
{
dump( "[MyExt] Can not get new profile manager\n" );
}
}
else
{
dump( "[MyExt] No old nor new profile manager found :(\n" );
}
......
},
......
_getProfileName: function()
{
switch( this._profileMethod )
{
case 'old':
return this._profileManager.currentProfile;
case 'new':
return this._profileManager.selectedProfile.name;
default:
break;
}
return '';
},
...
==============================================================
And I ALWAYS get "No old nor new profile manager found :(" under FireFox! How could I know current profile name in browser?
Lev Serebryakov Programmer JetBrains, Inc http://www.jetbrains.com "Develop with pleasure!"
_______________________________________________ Mozilla-xpcom mailing list [email protected] http://mail.mozilla.org/listinfo/mozilla-xpcom
_______________________________________________ Mozilla-xpcom mailing list [email protected] http://mail.mozilla.org/listinfo/mozilla-xpcom
