intl/uconv/tests/unit/test_bug321379.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 // Tests that calling close on a converter in/output stream doesn't crash
michael@0 2 // (bug 321379)
michael@0 3
michael@0 4 function run_test() {
michael@0 5 var StorageStream = Components.Constructor("@mozilla.org/storagestream;1",
michael@0 6 "nsIStorageStream",
michael@0 7 "init");
michael@0 8 var ConverterInputStream = Components.Constructor("@mozilla.org/intl/converter-input-stream;1",
michael@0 9 "nsIConverterInputStream",
michael@0 10 "init");
michael@0 11 var ConverterOutputStream = Components.Constructor("@mozilla.org/intl/converter-output-stream;1",
michael@0 12 "nsIConverterOutputStream",
michael@0 13 "init");
michael@0 14
michael@0 15
michael@0 16
michael@0 17 var storage = new StorageStream(1024, -1, null);
michael@0 18
michael@0 19 // Output
michael@0 20 var outStr = storage.getOutputStream(0);
michael@0 21 var out = new ConverterOutputStream(outStr, "UTF-8", 1024, 0xFFFD);
michael@0 22 out.writeString("Foo.");
michael@0 23 out.close();
michael@0 24 out.close(); // This line should not crash. It should just do nothing.
michael@0 25
michael@0 26 // Input
michael@0 27 var inStr = storage.newInputStream(0);
michael@0 28 var inp = new ConverterInputStream(inStr, "UTF-8", 1024, 0xFFFD);
michael@0 29 inp.close();
michael@0 30 inp.close(); // This line should not crash. It should just do nothing.
michael@0 31 }

mercurial