1 const Cc = Components.classes;
2 const Ci = Components.interfaces;
4 function test_not_too_long() {
5 var ios = Cc["@mozilla.org/network/io-service;1"].
6 getService(Ci.nsIIOService);
8 var spec = "jar:http://example.com/bar.jar!/";
10 var newURI = ios.newURI(spec, null, null);
13 do_throw("newURI threw even though it wasn't passed a large nested URI?");
17 function test_too_long() {
18 var ios = Cc["@mozilla.org/network/io-service;1"].
19 getService(Ci.nsIIOService);
23 for (i = 0; i < 16; i++) {
24 prefix = prefix + prefix;
27 for (i = 0; i < 16; i++) {
28 suffix = suffix + suffix;
31 var spec = prefix + "http://example.com/bar.jar" + suffix;
33 // The following will produce a recursive call that if
34 // unchecked would lead to a stack overflow. If we
35 // do not crash here and thus an exception is caught
36 // we have passed the test.
37 var newURI = ios.newURI(spec, null, null);