I\'m writing a Firefox extension that needs to know what the username of the currently logged in user is in Windows, Mac, or Linux. So if I\'m logged into my machine as \"br
The flagged correct answer works fine. I use this in our extension on Firefox 38. I also use events so that the page can communicate with the extension and retrieve windows properties from the extension.
getWindowsProperty: function(prop){ return Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get(prop); },