Years ago, I wrote the following function for one of my Firefox add-ons which helps me obtain a platform specific newline character:
GetNewLine: function()
{
    var platform = navigator.platform.toLowerCase();
    if(platform.indexOf('win') != -1) // Windows
        return "\r\n";
    else if(platform.indexOf('mac') != -1) // Mac
        return "\r";
    else // *nix
        return "\n";
}
This seems to work OK, but upon reading the newline Wikipedia article, I noted that recent Apple operating systems (OS X and later) now use the UNIX style \n line ending. As such, my little function may be returning the wrong thing for that case (I don't have a Mac OS on which to test it).
Is there a way I can get Firefox to tell me what the platform-specific newline character is? Perhaps some sort of built-in utility function? I'm using these newlines in the text files my extension writes, and I want to use the platform specific one, so that the files look appropriate across various systems.
Update (2-13-2013): So upon running the navigator.platform.toLowerCase() function call on a Mac-mini (OS X), I get the output value macintel. This would result in my function returning \r instead of \n as it should.