michael@0: // Tests that calling close on a converter in/output stream doesn't crash michael@0: // (bug 321379) michael@0: michael@0: function run_test() { michael@0: var StorageStream = Components.Constructor("@mozilla.org/storagestream;1", michael@0: "nsIStorageStream", michael@0: "init"); michael@0: var ConverterInputStream = Components.Constructor("@mozilla.org/intl/converter-input-stream;1", michael@0: "nsIConverterInputStream", michael@0: "init"); michael@0: var ConverterOutputStream = Components.Constructor("@mozilla.org/intl/converter-output-stream;1", michael@0: "nsIConverterOutputStream", michael@0: "init"); michael@0: michael@0: michael@0: michael@0: var storage = new StorageStream(1024, -1, null); michael@0: michael@0: // Output michael@0: var outStr = storage.getOutputStream(0); michael@0: var out = new ConverterOutputStream(outStr, "UTF-8", 1024, 0xFFFD); michael@0: out.writeString("Foo."); michael@0: out.close(); michael@0: out.close(); // This line should not crash. It should just do nothing. michael@0: michael@0: // Input michael@0: var inStr = storage.newInputStream(0); michael@0: var inp = new ConverterInputStream(inStr, "UTF-8", 1024, 0xFFFD); michael@0: inp.close(); michael@0: inp.close(); // This line should not crash. It should just do nothing. michael@0: }