Sat, 03 Jan 2015 20:18:00 +0100
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 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| michael@0 | 5 | |
| michael@0 | 6 | Components.utils.import("resource://testing-common/httpd.js"); |
| michael@0 | 7 | |
| michael@0 | 8 | const nsIDocumentEncoder = Components.interfaces.nsIDocumentEncoder; |
| michael@0 | 9 | const replacementChar = Components.interfaces.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER; |
| michael@0 | 10 | |
| michael@0 | 11 | function loadContentFile(aFile, aCharset) { |
| michael@0 | 12 | //if(aAsIso == undefined) aAsIso = false; |
| michael@0 | 13 | if(aCharset == undefined) |
| michael@0 | 14 | aCharset = 'UTF-8'; |
| michael@0 | 15 | |
| michael@0 | 16 | var file = do_get_file(aFile); |
| michael@0 | 17 | var ios = Components.classes['@mozilla.org/network/io-service;1'] |
| michael@0 | 18 | .getService(Components.interfaces.nsIIOService); |
| michael@0 | 19 | var chann = ios.newChannelFromURI ( ios.newFileURI (file) ); |
| michael@0 | 20 | chann.contentCharset = aCharset; |
| michael@0 | 21 | |
| michael@0 | 22 | /*var inputStream = Components.classes["@mozilla.org/scriptableinputstream;1"] |
| michael@0 | 23 | .createInstance(Components.interfaces.nsIScriptableInputStream); |
| michael@0 | 24 | inputStream.init(chann.open()); |
| michael@0 | 25 | return inputStream.read(file.fileSize); |
| michael@0 | 26 | */ |
| michael@0 | 27 | |
| michael@0 | 28 | var inputStream = Components.classes["@mozilla.org/intl/converter-input-stream;1"] |
| michael@0 | 29 | .createInstance(Components.interfaces.nsIConverterInputStream); |
| michael@0 | 30 | inputStream.init(chann.open(), aCharset, 1024, replacementChar); |
| michael@0 | 31 | var str = {}, content = ''; |
| michael@0 | 32 | while (inputStream.readString(4096, str) != 0) { |
| michael@0 | 33 | content += str.value; |
| michael@0 | 34 | } |
| michael@0 | 35 | return content; |
| michael@0 | 36 | } |