content/base/test/bug638112.sjs

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 function getInputStream(path)
michael@0 2 {
michael@0 3 var file = Components.classes["@mozilla.org/file/directory_service;1"].
michael@0 4 getService(Components.interfaces.nsIProperties).
michael@0 5 get("CurWorkD", Components.interfaces.nsILocalFile);
michael@0 6 var fis = Components.classes['@mozilla.org/network/file-input-stream;1'].
michael@0 7 createInstance(Components.interfaces.nsIFileInputStream);
michael@0 8 var split = path.split("/");
michael@0 9 for(var i = 0; i < split.length; ++i) {
michael@0 10 file.append(split[i]);
michael@0 11 }
michael@0 12 fis.init(file, -1, -1, false);
michael@0 13 return fis;
michael@0 14 }
michael@0 15
michael@0 16
michael@0 17
michael@0 18 function handleRequest(request, response)
michael@0 19 {
michael@0 20 var inputStream = getInputStream("tests/content/base/test/bug638112-response.txt")
michael@0 21 response.seizePower();
michael@0 22 response.bodyOutputStream.writeFrom(inputStream,
michael@0 23 inputStream.available());
michael@0 24 response.finish();
michael@0 25 inputStream.close();
michael@0 26 }

mercurial