1 // Regression test for bug 278262 - JAR URIs should resolve relative URIs in the base section.
3 const Cc
= Components
.classes
;
4 const Ci
= Components
.interfaces
;
5 const path
= "modules/libjar/test/unit/data/test_bug333423.zip";
7 function test_relative_sub() {
8 var ios
= Cc
["@mozilla.org/network/io-service;1"].
9 getService(Ci
.nsIIOService
);
11 var spec
= "jar:" + ios
.newFileURI(do_get_file(path
)).spec
+ "!/";
12 var base
= ios
.newURI(spec
, null, null);
13 var uri
= ios
.newURI("../modules/libjar", null, base
);
15 // This is the URI we expect to see.
16 var expected
= "jar:" + ios
.newFileURI(do_get_file(path
)).spec
+
19 do_check_eq(uri
.spec
, expected
);
22 function test_relative_base() {
23 var ios
= Cc
["@mozilla.org/network/io-service;1"].
24 getService(Ci
.nsIIOService
);
26 var base
= ios
.newFileURI(do_get_file("netwerk/Makefile.in"));
27 var uri
= ios
.newURI("jar:../" + path
+ "!/", null, base
);
29 // This is the URI we expect to see.
30 var expected
= "jar:" + ios
.newFileURI(do_get_file(path
)).spec
+
33 do_check_eq(uri
.spec
, expected
);