I am seeking to create a custom Firefox extension that can retrieve the windows username and store it as a variable for a webpage's access. This will be utilized for an internal website to validate users and assign different permissions based on their identity. The snippet I am considering using is:
Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get('USERNAME')
Testing this code within the Add-On builder at displays the correct username in the error console.
However, I am unsure how to proceed with actually developing an add-on that mimics the behavior of the error console output. Simply adding the code as a variable and installing the add-on results in an XPI build error. Any suggestions or guidance would be greatly appreciated.