I try to build my addon, but when I have commented code from this page
writing to a file example
I got XPI not built.
This is code, which I have commented:
/*
function saveFile(file, data)
{
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
var ostream = FileUtils.openSafeFileOutputStream(file)
var converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
var istream = converter.convertToInputStream(data);
// The last argument (the callback) is optional.
NetUtil.asyncCopy(istream, ostream, function(status) {
if (!Components.isSuccessCode(status)) {
// Handle error!
return;
}
// Data has been written to the file.
});
}
*/
If I remove this code (or whole comment block) build will succeed.
Here is link to this addon: addon
What’s the problem?
Thank you.
Edit:
I have Firefox 15.0.1. Update to 16.0.1 doesn’t help.
The problem was through keyword
Components. I’ve solved this problem, replacing this word withC, but I’ve added C as required chrome:Now I can compile addon and execute commented function.