mozilla
Your Search Results

    nsIToolkitProfileService

    The Profile Service manages user profiles.
    Inherits from: 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 / Firefox OS 1.0.1).

     

     

    Method overview

    nsIToolkitProfile createProfile(in nsILocalFile aRootDir, in AUTF8String aName);
    void flush();
    nsIToolkitProfile getProfileByName(in AUTF8String aName);
    nsIProfileLock lockProfilePath(in nsILocalFile aDirectory, in nsILocalFile aTempDirectory);

    Attributes

    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 nsIToolkitProfile 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  

    Methods

    createProfile()

    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
    );
    
    Parameters
    aRootDir
    The profile directory. May be null, in which case a suitable default will be chosen based on the profile name.
    aName
    The name to give the new profile.
    Return value

    An nsIToolkitProfile object representing the newly-created profile.

    Exceptions thrown
    NS_ERROR_UNEXPECTED
    An unexpected error condition occurred.
    NS_ERROR_FILE_NOT_DIRECTORY
    One of the specified directory files is not actually a directory.
    NS_ERROR_OUT_OF_MEMORY
    Unable to allocate the new profile object.

    flush()

    Flushes 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();
    
    Parameters

    None.

    Exceptions thrown
    NS_ERROR_OUT_OF_MEMORY
    An error occurred trying to allocate the memory buffer used to construct the profile list.
    NS_ERROR_UNEXPECTED
    An error occurred writing the profile list file to disk.

    getProfileByName()

    Gets a profile, given the profile's name.

    nsIToolkitProfile getProfileByName(
      in AUTF8String aName
    );
    
    Parameters
    aName
    The profile name to find.
    Return value

    An nsIToolkitProfile object describing the specified profile.

    Exceptions thrown
    NS_ERROR_FAILURE
    No matching profile was found.

    lockProfilePath()

    Locks 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
    );
    
    Parameters
    aDirectory
    The directory to lock as a profile directory.
    aTempDirectory
    The directory to lock as a profile temporary directory.
    Return value

    An nsIProfileLock object representing the locked directory.

    See also

    Document Tags and Contributors

    Last updated by: Sheppy,