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: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * vim: set ts=8 sts=4 et sw=4 tw=99: |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef vm_Compression_h |
michael@0 | 8 | #define vm_Compression_h |
michael@0 | 9 | |
michael@0 | 10 | #ifdef USE_ZLIB |
michael@0 | 11 | |
michael@0 | 12 | #include <zlib.h> |
michael@0 | 13 | |
michael@0 | 14 | #include "jstypes.h" |
michael@0 | 15 | |
michael@0 | 16 | namespace js { |
michael@0 | 17 | |
michael@0 | 18 | class Compressor |
michael@0 | 19 | { |
michael@0 | 20 | /* Number of bytes we should hand to zlib each compressMore() call. */ |
michael@0 | 21 | static const size_t CHUNKSIZE = 2048; |
michael@0 | 22 | z_stream zs; |
michael@0 | 23 | const unsigned char *inp; |
michael@0 | 24 | size_t inplen; |
michael@0 | 25 | size_t outbytes; |
michael@0 | 26 | bool initialized; |
michael@0 | 27 | |
michael@0 | 28 | public: |
michael@0 | 29 | enum Status { |
michael@0 | 30 | MOREOUTPUT, |
michael@0 | 31 | DONE, |
michael@0 | 32 | CONTINUE, |
michael@0 | 33 | OOM |
michael@0 | 34 | }; |
michael@0 | 35 | |
michael@0 | 36 | Compressor(const unsigned char *inp, size_t inplen); |
michael@0 | 37 | ~Compressor(); |
michael@0 | 38 | bool init(); |
michael@0 | 39 | void setOutput(unsigned char *out, size_t outlen); |
michael@0 | 40 | size_t outWritten() const { return outbytes; } |
michael@0 | 41 | /* Compress some of the input. Return true if it should be called again. */ |
michael@0 | 42 | Status compressMore(); |
michael@0 | 43 | }; |
michael@0 | 44 | |
michael@0 | 45 | /* |
michael@0 | 46 | * Decompress a string. The caller must know the length of the output and |
michael@0 | 47 | * allocate |out| to a string of that length. |
michael@0 | 48 | */ |
michael@0 | 49 | bool DecompressString(const unsigned char *inp, size_t inplen, |
michael@0 | 50 | unsigned char *out, size_t outlen); |
michael@0 | 51 | |
michael@0 | 52 | } /* namespace js */ |
michael@0 | 53 | |
michael@0 | 54 | #endif /* USE_ZLIB */ |
michael@0 | 55 | #endif /* vm_Compression_h */ |