netwerk/test/unit/test_bug337744.js

changeset 1
ca08bd8f51b2
equal deleted inserted replaced
-1:000000000000 0:fc33fc0a2013
1 /* verify that certain invalid URIs are not parsed by the resource
2 protocol handler */
3
4 const specs = [
5 "resource:////",
6 "resource:///http://www.mozilla.org/",
7 "resource:///file:///",
8 "resource:///..\\",
9 "resource:///..\\..\\",
10 "resource:///..%5C",
11 "resource:///..%5c"
12 ];
13
14 function check_for_exception(spec)
15 {
16 var ios =
17 Cc["@mozilla.org/network/io-service;1"].
18 getService(Ci.nsIIOService);
19
20 try {
21 var channel = ios.newChannel(spec, null, null);
22 }
23 catch (e) {
24 return;
25 }
26
27 do_throw("Successfully opened invalid URI: '" + spec + "'");
28 }
29
30 function run_test() {
31 for each (spec in specs) {
32 check_for_exception(spec);
33 }
34 }

mercurial