netwerk/test/unit/test_bug336501.js

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 var Cc = Components.classes;
michael@0 2 var Ci = Components.interfaces;
michael@0 3
michael@0 4 function run_test() {
michael@0 5 var f = do_get_file('test_bug336501.js');
michael@0 6
michael@0 7 var fis =
michael@0 8 Cc["@mozilla.org/network/file-input-stream;1"].
michael@0 9 createInstance(Ci.nsIFileInputStream);
michael@0 10 fis.init(f, -1, -1, 0);
michael@0 11
michael@0 12 var bis =
michael@0 13 Cc["@mozilla.org/network/buffered-input-stream;1"].
michael@0 14 createInstance(Ci.nsIBufferedInputStream);
michael@0 15 bis.init(fis, 32);
michael@0 16
michael@0 17 var sis =
michael@0 18 Cc["@mozilla.org/scriptableinputstream;1"].
michael@0 19 createInstance(Ci.nsIScriptableInputStream);
michael@0 20 sis.init(bis);
michael@0 21
michael@0 22 sis.read(45);
michael@0 23 sis.close();
michael@0 24
michael@0 25 var data = sis.read(45);
michael@0 26 do_check_eq(data.length, 0);
michael@0 27 }

mercurial