modules/libjar/test/unit/test_bug278262.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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 }

mercurial