Thu, 15 Jan 2015 15:59:08 +0100
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.
1 function test_not_too_long() {
2 var ios = Cc["@mozilla.org/network/io-service;1"].
3 getService(Ci.nsIIOService);
5 var spec = "jar:http://example.com/bar.jar!/";
6 try {
7 var newURI = ios.newURI(spec, null, null);
8 }
9 catch (e) {
10 do_throw("newURI threw even though it wasn't passed a large nested URI?");
11 }
12 }
14 function test_too_long() {
15 var ios = Cc["@mozilla.org/network/io-service;1"].
16 getService(Ci.nsIIOService);
18 var i;
19 var prefix = "jar:";
20 for (i = 0; i < 16; i++) {
21 prefix = prefix + prefix;
22 }
23 var suffix = "!/";
24 for (i = 0; i < 16; i++) {
25 suffix = suffix + suffix;
26 }
28 var spec = prefix + "http://example.com/bar.jar" + suffix;
29 try {
30 // The following will produce a recursive call that if
31 // unchecked would lead to a stack overflow. If we
32 // do not crash here and thus an exception is caught
33 // we have passed the test.
34 var newURI = ios.newURI(spec, null, null);
35 }
36 catch (e) {
37 return;
38 }
39 }
41 function run_test() {
42 test_not_too_long();
43 test_too_long();
44 }