netwerk/test/unit/test_bug580508.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 let ioService = Cc["@mozilla.org/network/io-service;1"]
michael@0 2 .getService(Ci.nsIIOService);
michael@0 3 let resProt = ioService.getProtocolHandler("resource")
michael@0 4 .QueryInterface(Ci.nsIResProtocolHandler);
michael@0 5
michael@0 6 function run_test() {
michael@0 7 // Define a resource:// alias that points to another resource:// URI.
michael@0 8 let greModulesURI = ioService.newURI("resource://gre/modules/", null, null);
michael@0 9 resProt.setSubstitution("my-gre-modules", greModulesURI);
michael@0 10
michael@0 11 // When we ask for the alias, we should not get the resource://
michael@0 12 // URI that we registered it for but the original file URI.
michael@0 13 let greFileSpec = ioService.newURI("modules/", null,
michael@0 14 resProt.getSubstitution("gre")).spec;
michael@0 15 let aliasURI = resProt.getSubstitution("my-gre-modules");
michael@0 16 do_check_eq(aliasURI.spec, greFileSpec);
michael@0 17
michael@0 18 // Resolving URIs using the original resource path and the alias
michael@0 19 // should yield the same result.
michael@0 20 let greNetUtilURI = ioService.newURI("resource://gre/modules/NetUtil.jsm",
michael@0 21 null, null);
michael@0 22 let myNetUtilURI = ioService.newURI("resource://my-gre-modules/NetUtil.jsm",
michael@0 23 null, null);
michael@0 24 do_check_eq(resProt.resolveURI(greNetUtilURI),
michael@0 25 resProt.resolveURI(myNetUtilURI));
michael@0 26 }

mercurial