nsISupports
Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)Note: Starting in Gecko 1.9.1, this service is implemented by @mozilla.org/toolkit/profile-service;1. To access the service, you can use the following code:
var toolkitProfileService = Components.classes["@mozilla.org/toolkit/profile-service;1"]
.createInstance(Components.interfaces.nsIToolkitProfileService);
Prior to Gecko 1.9.1 only the built-in profile manager was able to access the toolkit profile service. To access the built-in profile manager in versions of Firefox up to 4.0 and Thunderbird up to 3.3 you can launch with the -profilemanager command line flag. Future versions will require the separate Profile Manager application.
Warning: This service is synchronous so it is recommended that you use OS.File to find the profile directory via OS.Constants.Path.profileDir. OS.File is available from Gecko 18 (Firefox 18.0 / Thunderbird 18.0 / SeaMonkey 2.15).
nsIToolkitProfile createProfile(in nsILocalFile aRootDir, in AUTF8String aName); |
void flush(); |
nsIToolkitProfile getProfileByName(in AUTF8String aName); |
nsIProfileLock lockProfilePath(in nsILocalFile aDirectory, in nsILocalFile aTempDirectory); |
| Attribute | Type | Description |
profileCount |
unsigned long |
The number of user profiles currently in existence. This will always return 0, 1, or 2; if there are more than 2 profiles, 2 is always returned. Read only. |
profiles |
nsISimpleEnumerator |
An enumerator providing access to the list of profiles; each profile is an nsIToolkitProfile object (though you must first call aProfile.QueryInterface(Components.interfaces.nsIToolkitProfile) to get access to its attributes and methods). |
selectedProfile |
|
The profile that is marked as "Default=1" in the Profiles.ini file. (NOT the profile currently in use.) Not sure what happens if you change this setting but someone said: You can change profiles by setting this attribute's value. This may throw an NS_ERROR_FAILURE (0x80004005) when trying to get the current profile if it's unavailable or if permissions restrict access. |
startOffline |
boolean |
|
startWithLastProfile |
boolean |
Creates a new profile.
The profile temporary directory will be chosen based on where the profile directory is located.
nsIToolkitProfile createProfile( in nsILocalFile aRootDir, in AUTF8String aName );
aRootDirnull, in which case a suitable default will be chosen based on the profile name.aNameAn nsIToolkitProfile object representing the newly-created profile.
NS_ERROR_UNEXPECTEDNS_ERROR_FILE_NOT_DIRECTORYNS_ERROR_OUT_OF_MEMORYFlushes the profile list to disk.
The profile list file is constructed in memory, then written out as one large chunk, in order to reduce the risk of the profile list file being corrupted by disk errors.
void flush();
None.
NS_ERROR_OUT_OF_MEMORYNS_ERROR_UNEXPECTEDGets a profile, given the profile's name.
nsIToolkitProfile getProfileByName( in AUTF8String aName );
aNameAn nsIToolkitProfile object describing the specified profile.
NS_ERROR_FAILURELocks an arbitrary path as a profile. If the path does not exist, it is created and the defaults copied from the application directory.
nsIProfileLock lockProfilePath( in nsILocalFile aDirectory, in nsILocalFile aTempDirectory );
aDirectoryaTempDirectoryAn nsIProfileLock object representing the locked directory.