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 // 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 = "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 +
17 "!/modules/libjar";
19 do_check_eq(uri.spec, expected);
20 }
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("data/empty"));
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 +
31 "!/";
33 do_check_eq(uri.spec, expected);
34 }
36 function run_test() {
37 test_relative_sub();
38 test_relative_base();
39 }