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