I am currently working on the ffsniff extension code. In this, I must save the data containing the password information to a file on my local system. I wrote my code, but it does not even create a file on my local system. (works in Mozilla firefox)
Here is my code, please help me.
//// here data variable contains all the information var fso = new ActiveXObject("Scripting.FileSystemObject"); varFileObject = fso.OpenTextFile("C:\\logs.txt", 2, true,0); varFileObject.write(data); varFileObject.close();
after that I tried another code:
Components.utils.import("resource://gre/modules/NetUtil.jsm"); Components.utils.import("resource://gre/modules/FileUtils.jsm"); var file = Components.classes["@mozilla.org/file/directory_service;1"]. getService(Components.interfaces.nsIProperties). get("Desk", Components.interfaces.nsIFile); file.append("logs.txt"); var ostream = FileUtils.openSafeFileOutputStream(file) var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]. createInstance(Components.interfaces.nsIScriptableUnicodeConverter); converter.charset = "UTF-8"; var istream = converter.convertToInputStream(data); } });
but none of them work.
source share