tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug278262.js (919B)


      1 // Regression test for bug 278262 - JAR URIs should resolve relative URIs in the base section.
      2 
      3 const path = "data/test_bug333423.zip";
      4 
      5 function test_relative_sub() {
      6  var ios = Services.io;
      7  var spec = "jar:" + ios.newFileURI(do_get_file(path)).spec + "!/";
      8  var base = ios.newURI(spec);
      9  var uri = ios.newURI("../modules/libjar", null, base);
     10 
     11  // This is the URI we expect to see.
     12  var expected =
     13    "jar:" + ios.newFileURI(do_get_file(path)).spec + "!/modules/libjar";
     14 
     15  Assert.equal(uri.spec, expected);
     16 }
     17 
     18 function test_relative_base() {
     19  var ios = Services.io;
     20  var base = ios.newFileURI(do_get_file("data/empty"));
     21  var uri = ios.newURI("jar:../" + path + "!/", null, base);
     22 
     23  // This is the URI we expect to see.
     24  var expected = "jar:" + ios.newFileURI(do_get_file(path)).spec + "!/";
     25 
     26  Assert.equal(uri.spec, expected);
     27 }
     28 
     29 function run_test() {
     30  test_relative_sub();
     31  test_relative_base();
     32 }