michael@0: // Regression test for bug 278262 - JAR URIs should resolve relative URIs in the base section. michael@0: michael@0: const Cc = Components.classes; michael@0: const Ci = Components.interfaces; michael@0: const path = "data/test_bug333423.zip"; michael@0: michael@0: function test_relative_sub() { michael@0: var ios = Cc["@mozilla.org/network/io-service;1"]. michael@0: getService(Ci.nsIIOService); michael@0: michael@0: var spec = "jar:" + ios.newFileURI(do_get_file(path)).spec + "!/"; michael@0: var base = ios.newURI(spec, null, null); michael@0: var uri = ios.newURI("../modules/libjar", null, base); michael@0: michael@0: // This is the URI we expect to see. michael@0: var expected = "jar:" + ios.newFileURI(do_get_file(path)).spec + michael@0: "!/modules/libjar"; michael@0: michael@0: do_check_eq(uri.spec, expected); michael@0: } michael@0: michael@0: function test_relative_base() { michael@0: var ios = Cc["@mozilla.org/network/io-service;1"]. michael@0: getService(Ci.nsIIOService); michael@0: michael@0: var base = ios.newFileURI(do_get_file("data/empty")); michael@0: var uri = ios.newURI("jar:../" + path + "!/", null, base); michael@0: michael@0: // This is the URI we expect to see. michael@0: var expected = "jar:" + ios.newFileURI(do_get_file(path)).spec + michael@0: "!/"; michael@0: michael@0: do_check_eq(uri.spec, expected); michael@0: } michael@0: michael@0: function run_test() { michael@0: test_relative_sub(); michael@0: test_relative_base(); michael@0: }