Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 var valid_URIs = [ "http://[::]/",
2 "http://[::1]/",
3 "http://[1::]/",
4 "http://[::]/",
5 "http://[::1]/",
6 "http://[1::]/",
7 "http://[1:2:3:4:5:6:7::]/",
8 "http://[::1:2:3:4:5:6:7]/",
9 "http://[1:2:a:B:c:D:e:F]/",
10 "http://[1::8]/",
11 "http://[1:2::8]/",
12 "http://[0000:0123:4567:89AB:CDEF:abcd:ef00:0000]/",
13 "http://[::192.168.1.1]/",
14 "http://[1::0.0.0.0]/",
15 "http://[1:2::255.255.255.255]/",
16 "http://[1:2:3::255.255.255.255]/",
17 "http://[1:2:3:4::255.255.255.255]/",
18 "http://[1:2:3:4:5::255.255.255.255]/",
19 "http://[1:2:3:4:5:6:255.255.255.255]/"];
21 var invalid_URIs = [ "http://[1]/",
22 "http://[192.168.1.1]/",
23 "http://[:::]/",
24 "http://[:::1]/",
25 "http://[1:::]/",
26 "http://[::1::]/",
27 "http://[1:2:3:4:5:6:7:]/",
28 "http://[:2:3:4:5:6:7:8]/",
29 "http://[1:2:3:4:5:6:7:8:]/",
30 "http://[:1:2:3:4:5:6:7:8]/",
31 "http://[1:2:3:4:5:6:7:8::]/",
32 "http://[::1:2:3:4:5:6:7:8]/",
33 "http://[1:2:3:4:5:6:7]/",
34 "http://[1:2:3:4:5:6:7:8:9]/",
35 "http://[00001:2:3:4:5:6:7:8]/",
36 "http://[0001:2:3:4:5:6:7:89abc]/",
37 "http://[A:b:C:d:E:f:G:h]/",
38 "http://[::192.168.1]/",
39 "http://[::192.168.1.]/",
40 "http://[::.168.1.1]/",
41 "http://[::192..1.1]/",
42 "http://[::0192.168.1.1]/",
43 "http://[::256.255.255.255]/",
44 "http://[::1x.255.255.255]/",
45 "http://[::192.4294967464.1.1]/",
46 "http://[1:2:3:4:5:6::255.255.255.255]/",
47 "http://[1:2:3:4:5:6:7:255.255.255.255]/"];
49 function run_test() {
50 var ios = Cc["@mozilla.org/network/io-service;1"].
51 getService(Ci.nsIIOService);
53 for (var i=0 ; i<valid_URIs.length ; i++) {
54 try {
55 var uri = ios.newURI(valid_URIs[i], null, null);
56 } catch (e) {
57 do_throw("cannot create URI:" + valid_URIs[i]);
58 }
59 }
61 for (var i=0 ; i<invalid_URIs.length ; i++) {
62 try {
63 var uri = ios.newURI(invalid_URIs[i], null, null);
64 do_throw("should throw: " + invalid_URIs[i]);
65 } catch (e) {
66 do_check_eq(e.result, Cr.NS_ERROR_MALFORMED_URI);
67 }
68 }
69 }