Is there any XPCOM API to get user-name and browser profile-id? - Mozilla

This is a discussion on Is there any XPCOM API to get user-name and browser profile-id? - Mozilla ; Hi, I looking for some way to access the logged-in user name and browser profile-id using Javascript. How do get those information? Are there any XPCOM API that I can invoke in a OS-independent way? Thanks. -- Subrata...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Is there any XPCOM API to get user-name and browser profile-id?

  1. Is there any XPCOM API to get user-name and browser profile-id?

    Hi,
    I looking for some way to access the logged-in user name and browser
    profile-id using Javascript.
    How do get those information? Are there any XPCOM API that I can invoke
    in a OS-independent way?
    Thanks.
    --
    Subrata

  2. Re: Is there any XPCOM API to get user-name and browser profile-id?

    Subrata Mazumdar wrote:
    > Hi,
    > I looking for some way to access the logged-in user name and browser
    > profile-id using Javascript.
    > How do get those information? Are there any XPCOM API that I can invoke
    > in a OS-independent way?


    The username may be available on nsIUserInfo:

    http://mxr.mozilla.org/mozilla-centr...sIUserInfo.idl

    The profile name is not available, because the user may not be using a named
    profile, (e.g. they are using the -profile flag).

    --BDS

  3. Re: Is there any XPCOM API to get user-name and browser profile-id?



    Benjamin Smedberg wrote:
    > Subrata Mazumdar wrote:
    >
    >> Hi,
    >> I looking for some way to access the logged-in user name and browser
    >> profile-id using Javascript.
    >> How do get those information? Are there any XPCOM API that I can invoke
    >> in a OS-independent way?
    >>

    >
    > The username may be available on nsIUserInfo:
    >
    > http://mxr.mozilla.org/mozilla-centr...sIUserInfo.idl
    >
    > The profile name is not available, because the user may not be using a named
    > profile, (e.g. they are using the -profile flag).
    >
    > --BDS
    >

    Thanks.

    Any hint where to look for Profile info if I want to write my own XPCOM
    interface.

    I would like to derive the profile name from the profile directory path
    (ProfD) but I need access to
    information in profiles.ini file. The profile chooser XUL dialog already
    access the info in the profiles.ini file.
    Which is interface profile chooser uses to display the profiles.ini file.
    Any help in identifying source file for processing the profiles.ini file
    is greatly appreciated.
    --
    Subrata

  4. Re: Is there any XPCOM API to get user-name and browser profile-id?



    Subrata Mazumdar wrote:
    >
    >
    > Benjamin Smedberg wrote:
    >> Subrata Mazumdar wrote:
    >>
    >>> Hi,
    >>> I looking for some way to access the logged-in user name and browser
    >>> profile-id using Javascript.
    >>> How do get those information? Are there any XPCOM API that I can invoke
    >>> in a OS-independent way?
    >>>

    >>
    >> The username may be available on nsIUserInfo:
    >>
    >> http://mxr.mozilla.org/mozilla-centr...sIUserInfo.idl
    >>
    >>
    >> The profile name is not available, because the user may not be using
    >> a named
    >> profile, (e.g. they are using the -profile flag).
    >>
    >> --BDS
    >>

    > Thanks.
    >
    > Any hint where to look for Profile info if I want to write my own
    > XPCOM interface.
    >
    > I would like to derive the profile name from the profile directory
    > path (ProfD) but I need access to
    > information in profiles.ini file. The profile chooser XUL dialog
    > already access the info in the profiles.ini file.
    > Which is interface profile chooser uses to display the profiles.ini file.
    > Any help in identifying source file for processing the profiles.ini
    > file is greatly appreciated.
    > --
    > Subrata

    Found the profile manager interface:
    http://mxr.mozilla.org/mozilla-centr...nsIProfile.idl
    --
    Subrata

  5. Re: Is there any XPCOM API to get user-name and browser profile-id?

    Subrata Mazumdar wrote:

    > Found the profile manager interface:
    > http://mxr.mozilla.org/mozilla-centr...nsIProfile.idl


    That interface is not implemented or supported. The information you want is
    really not available at all. The only way you'd get at it is by reading
    profiles.ini yourself and matching the name up with the current ProfD.

    I do not recommend getting or using the profile name for anything. Needing
    it is the sign of a design error of some sort.

    --BDS

  6. Re: Is there any XPCOM API to get user-name and browser profile-id?

    Hi,


    Benjamin Smedberg wrote:
    > Subrata Mazumdar wrote:
    >
    >
    >> Found the profile manager interface:
    >> http://mxr.mozilla.org/mozilla-centr...nsIProfile.idl
    >>

    >
    > That interface is not implemented or supported. The information you want is
    > really not available at all. The only way you'd get at it is by reading
    > profiles.ini yourself and matching the name up with the current ProfD.
    >
    >

    I have realized that it does not work - thanks for confirming it.
    > I do not recommend getting or using the profile name for anything. Needing
    > it is the sign of a design error of some sort.
    >


    I use a number development profiles - one for each project. I would
    just like to show the profile name
    in the status bar just indicate which profile a particular browser
    instance is using.
    I would also like to create a scratch directory for per profile per user
    in the OS specific temp directory.
    These are mostly related to keeping testing data of my add-on- nothing
    to do with actual operation of the add-ons. I could also use
    leaf-name of the profile directory path to avoid any issues with
    obtaining profile-name.
    Thanks for help.
    --
    Subrata


    > --BDS
    >


  7. Re: Is there any XPCOM API to get user-name and browser profile-id?

    Subrata Mazumdar wrote:
    >
    > I use a number development profiles - one for each project. I would
    > just like to show the profile name
    > in the status bar just indicate which profile a particular browser
    > instance is using.
    > I would also like to create a scratch directory for per profile per user
    > in the OS specific temp directory.


    You can probably just show the value of ProfD then:
    http://developer.mozilla.org/en/Code.../File_I%2F%2FO

    jjb

+ Reply to Thread