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.

michael@0 1 // Regression test for bug 278262 - JAR URIs should resolve relative URIs in the base section.
michael@0 2
michael@0 3 const Cc = Components.classes;
michael@0 4 const Ci = Components.interfaces;
michael@0 5 const path = "data/test_bug333423.zip";
michael@0 6
michael@0 7 function test_relative_sub() {
michael@0 8 var ios = Cc["@mozilla.org/network/io-service;1"].
michael@0 9 getService(Ci.nsIIOService);
michael@0 10
michael@0 11 var spec = "jar:" + ios.newFileURI(do_get_file(path)).spec + "!/";
michael@0 12 var base = ios.newURI(spec, null, null);
michael@0 13 var uri = ios.newURI("../modules/libjar", null, base);
michael@0 14
michael@0 15 // This is the URI we expect to see.
michael@0 16 var expected = "jar:" + ios.newFileURI(do_get_file(path)).spec +
michael@0 17 "!/modules/libjar";
michael@0 18
michael@0 19 do_check_eq(uri.spec, expected);
michael@0 20 }
michael@0 21
michael@0 22 function test_relative_base() {
michael@0 23 var ios = Cc["@mozilla.org/network/io-service;1"].
michael@0 24 getService(Ci.nsIIOService);
michael@0 25
michael@0 26 var base = ios.newFileURI(do_get_file("data/empty"));
michael@0 27 var uri = ios.newURI("jar:../" + path + "!/", null, base);
michael@0 28
michael@0 29 // This is the URI we expect to see.
michael@0 30 var expected = "jar:" + ios.newFileURI(do_get_file(path)).spec +
michael@0 31 "!/";
michael@0 32
michael@0 33 do_check_eq(uri.spec, expected);
michael@0 34 }
michael@0 35
michael@0 36 function run_test() {
michael@0 37 test_relative_sub();
michael@0 38 test_relative_base();
michael@0 39 }

mercurial