--- a/browser/components/migration/360seProfileMigrator.js
+++ b/browser/components/migration/360seProfileMigrator.js
@@ -39,17 +39,17 @@ function copyToTempUTF8File(file, charse
let out = FileUtils.openAtomicFileOutputStream(tempUTF8File);
try {
let bufferedOut = Cc["@mozilla.org/network/buffered-output-stream;1"]
.createInstance(Ci.nsIBufferedOutputStream);
bufferedOut.init(out, 4096);
try {
let converterOut = Cc["@mozilla.org/intl/converter-output-stream;1"]
.createInstance(Ci.nsIConverterOutputStream);
- converterOut.init(bufferedOut, "utf-8", 0, 0x0000);
+ converterOut.init(bufferedOut, "utf-8");
try {
converterOut.writeString(inputStr || "");
bufferedOut.QueryInterface(Ci.nsISafeOutputStream).finish();
} finally {
converterOut.close();
}
} finally {
bufferedOut.close();
--- a/devtools/client/netmonitor/src/har/har-utils.js
+++ b/devtools/client/netmonitor/src/har/har-utils.js
@@ -85,17 +85,17 @@ var HarUtils = {
let foStream = Cc["@mozilla.org/network/file-output-stream;1"]
.createInstance(Ci.nsIFileOutputStream);
let permFlags = parseInt("0666", 8);
foStream.init(file, openFlags, permFlags, 0);
let convertor = Cc["@mozilla.org/intl/converter-output-stream;1"]
.createInstance(Ci.nsIConverterOutputStream);
- convertor.init(foStream, "UTF-8", 0, 0);
+ convertor.init(foStream, "UTF-8");
// The entire jsonString can be huge so, write the data in chunks.
let chunkLength = 1024 * 1024;
for (let i = 0; i <= jsonString.length; i++) {
let data = jsonString.substr(i, chunkLength + 1);
if (data) {
convertor.writeString(data);
}
--- a/dom/plugins/test/unit/test_bug813245.js
+++ b/dom/plugins/test/unit/test_bug813245.js
@@ -26,17 +26,17 @@ function write_registry(version, info) {
var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
.createInstance(Components.interfaces.nsIFileOutputStream);
// write, create, truncate
foStream.init(registry, 0x02 | 0x08 | 0x20, 0o666, 0);
var charset = "UTF-8"; // Can be any character encoding name that Mozilla supports
var os = Cc["@mozilla.org/intl/converter-output-stream;1"].
createInstance(Ci.nsIConverterOutputStream);
- os.init(foStream, charset, 0, 0x0000);
+ os.init(foStream, charset);
os.writeString(header);
os.writeString(info);
os.close();
}
function run_test() {
allow_all_plugins();
--- a/extensions/cookie/test/unit/test_permmanager_defaults.js
+++ b/extensions/cookie/test/unit/test_permmanager_defaults.js
@@ -28,17 +28,17 @@ add_task(function* do_test() {
file.append("test_default_permissions");
// write our test data to it.
let ostream = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
ostream.init(file, -1, 0o666, 0);
let conv = Cc["@mozilla.org/intl/converter-output-stream;1"].
createInstance(Ci.nsIConverterOutputStream);
- conv.init(ostream, "UTF-8", 0, 0);
+ conv.init(ostream, "UTF-8");
conv.writeString("# this is a comment\n");
conv.writeString("\n"); // a blank line!
conv.writeString("host\t" + TEST_PERMISSION + "\t1\t" + TEST_ORIGIN.host + "\n");
conv.writeString("host\t" + TEST_PERMISSION + "\t1\t" + TEST_ORIGIN_2.host + "\n");
conv.writeString("origin\t" + TEST_PERMISSION + "\t1\t" + TEST_ORIGIN_3.spec + "\n");
conv.writeString("origin\t" + TEST_PERMISSION + "\t1\t" + TEST_ORIGIN.spec + "^appId=1000&inBrowser=1\n");
ostream.close();
--- a/extensions/cookie/test/unit/test_permmanager_removeall.js
+++ b/extensions/cookie/test/unit/test_permmanager_removeall.js
@@ -15,17 +15,17 @@ function run_test() {
do_check_true(file.exists());
// corrupt the file
var ostream = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
ostream.init(file, 0x02, 0o666, 0);
var conv = Cc["@mozilla.org/intl/converter-output-stream;1"].
createInstance(Ci.nsIConverterOutputStream);
- conv.init(ostream, "UTF-8", 0, 0);
+ conv.init(ostream, "UTF-8");
for (var i = 0; i < file.fileSize; ++i)
conv.writeString("a");
conv.close();
// prepare an empty hostperm.1 file so that it can be used for importing
var hostperm = dir.clone();
hostperm.append("hostperm.1");
ostream.init(hostperm, 0x02 | 0x08, 0o666, 0);
--- a/intl/uconv/nsConverterOutputStream.cpp
+++ b/intl/uconv/nsConverterOutputStream.cpp
@@ -20,19 +20,17 @@ NS_IMPL_ISUPPORTS(nsConverterOutputStrea
nsConverterOutputStream::~nsConverterOutputStream()
{
Close();
}
NS_IMETHODIMP
nsConverterOutputStream::Init(nsIOutputStream* aOutStream,
- const char* aCharset,
- uint32_t aBufferSize /* ignored */,
- char16_t aReplacementChar) /* ignored */
+ const char* aCharset)
{
NS_PRECONDITION(aOutStream, "Null output stream!");
const Encoding* encoding;
if (!aCharset) {
encoding = UTF_8_ENCODING;
} else {
encoding = Encoding::ForLabelNoReplacement(MakeStringSpan(aCharset));
--- a/intl/uconv/tests/unit/test_bug321379.js
+++ b/intl/uconv/tests/unit/test_bug321379.js
@@ -13,17 +13,17 @@ function run_test() {
"init");
var storage = new StorageStream(1024, -1, null);
// Output
var outStr = storage.getOutputStream(0);
- var out = new ConverterOutputStream(outStr, "UTF-8", 1024, 0xFFFD);
+ var out = new ConverterOutputStream(outStr, "UTF-8");
out.writeString("Foo.");
out.close();
out.close(); // This line should not crash. It should just do nothing.
// Input
var inStr = storage.newInputStream(0);
var inp = new ConverterInputStream(inStr, "UTF-8", 1024, 0xFFFD);
inp.close();
--- a/intl/uconv/tests/unit/test_charset_conversion.js
+++ b/intl/uconv/tests/unit/test_charset_conversion.js
@@ -64,17 +64,17 @@ const UNICODE_FILES =
"unicode-conversion.utf16be.txt": "UTF-16BE"
};
function test_utf8_1()
{
for (var i = 0; i < UNICODE_STRINGS.length; i++)
{
var pipe = Pipe();
- var conv = new COS(pipe.outputStream, "UTF-8", 1024, 0x0);
+ var conv = new COS(pipe.outputStream, "UTF-8");
do_check_true(conv.writeString(UNICODE_STRINGS[i]));
conv.close();
if (!equalStreams(new UTF8(pipe.inputStream),
stringToCodePoints(UNICODE_STRINGS[i])))
do_throw("UNICODE_STRINGS[" + i + "] not handled correctly");
}
}
--- a/services/common/tests/unit/test_restrequest.js
+++ b/services/common/tests/unit/test_restrequest.js
@@ -184,17 +184,17 @@ add_test(function test_get_utf8() {
let charsetSuffix = "; charset=UTF-8";
let server = httpd_setup({"/resource": function(req, res) {
res.setStatusLine(req.httpVersion, 200, "OK");
res.setHeader("Content-Type", contentType + (charset ? charsetSuffix : ""));
let converter = Cc["@mozilla.org/intl/converter-output-stream;1"]
.createInstance(Ci.nsIConverterOutputStream);
- converter.init(res.bodyOutputStream, "UTF-8", 0, 0x0000);
+ converter.init(res.bodyOutputStream, "UTF-8");
converter.writeString(response);
converter.close();
}});
// Check if charset in Content-Type is propertly interpreted.
let request1 = new RESTRequest(server.baseURI + "/resource");
request1.get(function(error) {
do_check_null(error);
@@ -265,17 +265,17 @@ add_test(function test_charsets() {
let charsetSuffix = "; charset=us-ascii";
let server = httpd_setup({"/resource": function(req, res) {
res.setStatusLine(req.httpVersion, 200, "OK");
res.setHeader("Content-Type", contentType + (charset ? charsetSuffix : ""));
let converter = Cc["@mozilla.org/intl/converter-output-stream;1"]
.createInstance(Ci.nsIConverterOutputStream);
- converter.init(res.bodyOutputStream, "us-ascii", 0, 0x0000);
+ converter.init(res.bodyOutputStream, "us-ascii");
converter.writeString(response);
converter.close();
}});
// Check that provided charset overrides hint.
let request1 = new RESTRequest(server.baseURI + "/resource");
request1.charset = "not-a-charset";
request1.get(function(error) {
--- a/services/sync/tests/unit/test_utils_json.js
+++ b/services/sync/tests/unit/test_utils_json.js
@@ -81,17 +81,17 @@ add_test(function test_load_logging() {
let file = FileUtils.getFile("ProfD", filePath.split("/"), true);
let fos = Cc["@mozilla.org/network/file-output-stream;1"]
.createInstance(Ci.nsIFileOutputStream);
let flags = FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE
| FileUtils.MODE_TRUNCATE;
fos.init(file, flags, FileUtils.PERMS_FILE, fos.DEFER_OPEN);
let stream = Cc["@mozilla.org/intl/converter-output-stream;1"]
.createInstance(Ci.nsIConverterOutputStream);
- stream.init(fos, "UTF-8", 4096, 0x0000);
+ stream.init(fos, "UTF-8");
stream.writeString("invalid json!");
stream.close();
let trace, debug;
let obj = {
_log: {
trace(msg) {
trace = msg;
--- a/services/sync/tps/extensions/tps/resource/logger.jsm
+++ b/services/sync/tps/extensions/tps/resource/logger.jsm
@@ -39,17 +39,17 @@ var Logger = {
this._foStream = Cc["@mozilla.org/network/file-output-stream;1"]
.createInstance(Ci.nsIFileOutputStream);
// If the file already exists, append it, otherwise create it.
var fileflags = exists ? 0x02 | 0x08 | 0x10 : 0x02 | 0x08 | 0x20;
this._foStream.init(this._file, fileflags, 0o666, 0);
this._converter = Cc["@mozilla.org/intl/converter-output-stream;1"]
.createInstance(Ci.nsIConverterOutputStream);
- this._converter.init(this._foStream, "UTF-8", 0, 0);
+ this._converter.init(this._foStream, "UTF-8");
},
write(data) {
if (this._converter == null) {
Cu.reportError(
"TPS Logger.write called with _converter == null!");
return;
}
--- a/testing/specialpowers/content/MozillaLogger.js
+++ b/testing/specialpowers/content/MozillaLogger.js
@@ -93,17 +93,17 @@ MozillaFileLogger.prototype = {
this._file.initWithPath(path);
this._foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
createInstance(Components.interfaces.nsIFileOutputStream);
this._foStream.init(this._file, PR_WRITE_ONLY | PR_CREATE_FILE | PR_APPEND,
436 /* 0664 */, 0);
this._converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"].
createInstance(Components.interfaces.nsIConverterOutputStream);
- this._converter.init(this._foStream, "UTF-8", 0, 0);
+ this._converter.init(this._foStream, "UTF-8");
},
getLogCallback() {
return function(msg) {
var data = formatLogMessage(msg);
if (MozillaFileLogger._converter) {
this._converter.writeString(data);
}
--- a/toolkit/components/places/BookmarkHTMLUtils.jsm
+++ b/toolkit/components/places/BookmarkHTMLUtils.jsm
@@ -1010,17 +1010,17 @@ BookmarkExporter.prototype = {
// We need a buffered output stream for performance. See bug 202477.
let bufferedOut = Cc["@mozilla.org/network/buffered-output-stream;1"]
.createInstance(Ci.nsIBufferedOutputStream);
bufferedOut.init(out, 4096);
try {
// Write bookmarks in UTF-8.
this._converterOut = Cc["@mozilla.org/intl/converter-output-stream;1"]
.createInstance(Ci.nsIConverterOutputStream);
- this._converterOut.init(bufferedOut, "utf-8", 0, 0);
+ this._converterOut.init(bufferedOut, "utf-8");
try {
this._writeHeader();
await this._writeContainer(this._root);
// Retain the target file on success only.
bufferedOut.QueryInterface(Ci.nsISafeOutputStream).finish();
} finally {
this._converterOut.close();
this._converterOut = null;
--- a/toolkit/components/viewsource/content/viewSourceUtils.js
+++ b/toolkit/components/viewsource/content/viewSourceUtils.js
@@ -442,17 +442,17 @@ var gViewSourceUtils = {
// we have to convert from the source charset.
var webNavigation = this.webShell.QueryInterface(Components.interfaces.nsIWebNavigation);
var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
.createInstance(Components.interfaces.nsIFileOutputStream);
foStream.init(this.file, 0x02 | 0x08 | 0x20, -1, 0); // write | create | truncate
var coStream = Components.classes["@mozilla.org/intl/converter-output-stream;1"]
.createInstance(Components.interfaces.nsIConverterOutputStream);
- coStream.init(foStream, this.data.doc.characterSet, 0, null);
+ coStream.init(foStream, this.data.doc.characterSet);
// write the source to the file
coStream.writeString(webNavigation.document.body.textContent);
// clean up
coStream.close();
foStream.close();
--- a/toolkit/crashreporter/CrashSubmit.jsm
+++ b/toolkit/crashreporter/CrashSubmit.jsm
@@ -101,17 +101,17 @@ function writeFile(dirName, fileName, da
path.create(Ci.nsIFile.DIRECTORY_TYPE, parseInt("0700", 8));
path.append(fileName);
var fs = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
// open, write, truncate
fs.init(path, -1, -1, 0);
var os = Cc["@mozilla.org/intl/converter-output-stream;1"].
createInstance(Ci.nsIConverterOutputStream);
- os.init(fs, "UTF-8", 0, 0x0000);
+ os.init(fs, "UTF-8");
os.writeString(data);
os.close();
fs.close();
}
function getPendingMinidump(id) {
let pendingDir = getDir("pending");
let dump = pendingDir.clone();
--- a/toolkit/crashreporter/test/browser/head.js
+++ b/toolkit/crashreporter/test/browser/head.js
@@ -100,17 +100,17 @@ function add_fake_crashes(crD, count) {
function writeDataToFile(file, data) {
var fstream = Cc["@mozilla.org/network/file-output-stream;1"]
.createInstance(Ci.nsIFileOutputStream);
// open, write, truncate
fstream.init(file, -1, -1, 0);
var os = Cc["@mozilla.org/intl/converter-output-stream;1"]
.createInstance(Ci.nsIConverterOutputStream);
- os.init(fstream, "UTF-8", 0, 0x0000);
+ os.init(fstream, "UTF-8");
os.writeString(data);
os.close();
fstream.close();
}
function addPendingCrashreport(crD, date, extra) {
let pendingdir = crD.clone();
pendingdir.append("pending");
--- a/toolkit/modules/Log.jsm
+++ b/toolkit/modules/Log.jsm
@@ -788,19 +788,17 @@ StorageStreamAppender.prototype = {
}
// Wrap the raw stream in an nsIConverterOutputStream. We can reuse
// the instance if we already have one.
if (!this._converterStream) {
this._converterStream = Cc["@mozilla.org/intl/converter-output-stream;1"]
.createInstance(Ci.nsIConverterOutputStream);
}
- this._converterStream.init(
- this._outputStream, "UTF-8", STREAM_SEGMENT_SIZE,
- Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
+ this._converterStream.init(this._outputStream, "UTF-8");
}
return this._converterStream;
},
newOutputStream: function newOutputStream() {
let ss = this._ss = Cc["@mozilla.org/storagestream;1"]
.createInstance(Ci.nsIStorageStream);
ss.init(STREAM_SEGMENT_SIZE, PR_UINT32_MAX, null);
--- a/toolkit/mozapps/extensions/internal/XPIInstall.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIInstall.jsm
@@ -245,17 +245,17 @@ function writeStringToFile(file, string)
createInstance(Ci.nsIFileOutputStream);
let converter = Cc["@mozilla.org/intl/converter-output-stream;1"].
createInstance(Ci.nsIConverterOutputStream);
try {
stream.init(file, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE |
FileUtils.MODE_TRUNCATE, FileUtils.PERMS_FILE,
0);
- converter.init(stream, "UTF-8", 0, 0x0000);
+ converter.init(stream, "UTF-8");
converter.writeString(string);
} finally {
converter.close();
stream.close();
}
}
function EM_R(aProperty) {
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -546,17 +546,17 @@ function writeStringToFile(file, string)
createInstance(Ci.nsIFileOutputStream);
let converter = Cc["@mozilla.org/intl/converter-output-stream;1"].
createInstance(Ci.nsIConverterOutputStream);
try {
stream.init(file, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE |
FileUtils.MODE_TRUNCATE, FileUtils.PERMS_FILE,
0);
- converter.init(stream, "UTF-8", 0, 0x0000);
+ converter.init(stream, "UTF-8");
converter.writeString(string);
} finally {
converter.close();
stream.close();
}
}
/**
--- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
@@ -1284,17 +1284,17 @@ function loadJSON(aFile) {
/**
* Raw save of a JSON blob to file
*/
function saveJSON(aData, aFile) {
do_print("Starting to save JSON file " + aFile.path);
let stream = FileUtils.openSafeFileOutputStream(aFile);
let converter = AM_Cc["@mozilla.org/intl/converter-output-stream;1"].
createInstance(AM_Ci.nsIConverterOutputStream);
- converter.init(stream, "UTF-8", 0, 0x0000);
+ converter.init(stream, "UTF-8");
// XXX pretty print the JSON while debugging
converter.writeString(JSON.stringify(aData, null, 2));
converter.flush();
// nsConverterOutputStream doesn't finish() safe output streams on close()
FileUtils.closeSafeFileOutputStream(stream);
converter.close();
do_print("Done saving JSON file " + aFile.path);
}
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug659772.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug659772.js
@@ -129,17 +129,17 @@ async function run_test_1() {
let stream = AM_Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(AM_Ci.nsIFileOutputStream);
let converter = AM_Cc["@mozilla.org/intl/converter-output-stream;1"].
createInstance(AM_Ci.nsIConverterOutputStream);
stream.init(jsonfile, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE |
FileUtils.MODE_TRUNCATE, FileUtils.PERMS_FILE,
0);
- converter.init(stream, "UTF-8", 0, 0x0000);
+ converter.init(stream, "UTF-8");
converter.writeString(JSON.stringify(addonObj));
converter.close();
stream.close();
Services.prefs.clearUserPref("bootstraptest.install_reason");
Services.prefs.clearUserPref("bootstraptest.uninstall_reason");
await promiseStartupManager(false);
@@ -270,17 +270,17 @@ async function run_test_2() {
let stream = AM_Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(AM_Ci.nsIFileOutputStream);
let converter = AM_Cc["@mozilla.org/intl/converter-output-stream;1"].
createInstance(AM_Ci.nsIConverterOutputStream);
stream.init(jsonfile, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE |
FileUtils.MODE_TRUNCATE, FileUtils.PERMS_FILE,
0);
- converter.init(stream, "UTF-8", 0, 0x0000);
+ converter.init(stream, "UTF-8");
converter.writeString(JSON.stringify(addonObj));
converter.close();
stream.close();
Services.prefs.clearUserPref("bootstraptest.install_reason");
Services.prefs.clearUserPref("bootstraptest.uninstall_reason");
gAppInfo.version = "2";
--- a/xpcom/io/nsIConverterOutputStream.idl
+++ b/xpcom/io/nsIConverterOutputStream.idl
@@ -20,25 +20,11 @@ interface nsIConverterOutputStream : nsI
* must not be null, or you will crash.
*
* @param aOutStream
* The underlying output stream to which the converted strings will
* be written.
* @param aCharset
* The character set to use for encoding the characters. A null
* charset will be interpreted as UTF-8.
- * @param aBufferSize
- * How many bytes to buffer. A value of 0 means that no bytes will be
- * buffered. Implementations not supporting buffering may ignore
- * this parameter.
- * @param aReplacementCharacter
- * The replacement character to use when an unsupported character is found.
- * The character must be encodable in the selected character
- * encoding; otherwise, attempts to write an unsupported character
- * will throw NS_ERROR_LOSS_OF_SIGNIFICANT_DATA.
- *
- * A value of 0x0000 will cause an exception to be thrown upon
- * attempts to write unsupported characters.
*/
- void init(in nsIOutputStream aOutStream, in string aCharset,
- in unsigned long aBufferSize,
- in char16_t aReplacementCharacter);
+ void init(in nsIOutputStream aOutStream, in string aCharset);
};