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 | diff --git a/gfx/ots/include/opentype-sanitiser.h b/gfx/ots/include/opentype-sanitiser.h |
michael@0 | 2 | --- a/gfx/ots/include/opentype-sanitiser.h |
michael@0 | 3 | +++ b/gfx/ots/include/opentype-sanitiser.h |
michael@0 | 4 | @@ -1,15 +1,35 @@ |
michael@0 | 5 | // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
michael@0 | 6 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 7 | // found in the LICENSE file. |
michael@0 | 8 | |
michael@0 | 9 | #ifndef OPENTYPE_SANITISER_H_ |
michael@0 | 10 | #define OPENTYPE_SANITISER_H_ |
michael@0 | 11 | |
michael@0 | 12 | +#if defined(_WIN32) || defined(__CYGWIN__) |
michael@0 | 13 | + #define OTS_DLL_IMPORT __declspec(dllimport) |
michael@0 | 14 | + #define OTS_DLL_EXPORT __declspec(dllexport) |
michael@0 | 15 | +#else |
michael@0 | 16 | + #if __GNUC__ >= 4 |
michael@0 | 17 | + #define OTS_DLL_IMPORT __attribute__((visibility ("default"))) |
michael@0 | 18 | + #define OTS_DLL_EXPORT __attribute__((visibility ("default"))) |
michael@0 | 19 | + #endif |
michael@0 | 20 | +#endif |
michael@0 | 21 | + |
michael@0 | 22 | +#ifdef OTS_DLL |
michael@0 | 23 | + #ifdef OTS_DLL_EXPORTS |
michael@0 | 24 | + #define OTS_API OTS_DLL_EXPORT |
michael@0 | 25 | + #else |
michael@0 | 26 | + #define OTS_API OTS_DLL_IMPORT |
michael@0 | 27 | + #endif |
michael@0 | 28 | +#else |
michael@0 | 29 | + #define OTS_API |
michael@0 | 30 | +#endif |
michael@0 | 31 | + |
michael@0 | 32 | #if defined(_WIN32) |
michael@0 | 33 | #include <stdlib.h> |
michael@0 | 34 | typedef signed char int8_t; |
michael@0 | 35 | typedef unsigned char uint8_t; |
michael@0 | 36 | typedef short int16_t; |
michael@0 | 37 | typedef unsigned short uint16_t; |
michael@0 | 38 | typedef int int32_t; |
michael@0 | 39 | typedef unsigned int uint32_t; |
michael@0 | 40 | @@ -182,45 +202,45 @@ class OTSStream { |
michael@0 | 41 | // ----------------------------------------------------------------------------- |
michael@0 | 42 | // Process a given OpenType file and write out a sanitised version |
michael@0 | 43 | // output: a pointer to an object implementing the OTSStream interface. The |
michael@0 | 44 | // sanitisied output will be written to this. In the even of a failure, |
michael@0 | 45 | // partial output may have been written. |
michael@0 | 46 | // input: the OpenType file |
michael@0 | 47 | // length: the size, in bytes, of |input| |
michael@0 | 48 | // ----------------------------------------------------------------------------- |
michael@0 | 49 | -bool Process(OTSStream *output, const uint8_t *input, size_t length); |
michael@0 | 50 | +bool OTS_API Process(OTSStream *output, const uint8_t *input, size_t length); |
michael@0 | 51 | |
michael@0 | 52 | // Signature of the function to be provided by the client in order to report errors. |
michael@0 | 53 | // The return type is a boolean so that it can be used within an expression, |
michael@0 | 54 | // but the actual value is ignored. (Suggested convention is to always return 'false'.) |
michael@0 | 55 | #ifdef __GCC__ |
michael@0 | 56 | #define MSGFUNC_FMT_ATTR __attribute__((format(printf, 2, 3))) |
michael@0 | 57 | #else |
michael@0 | 58 | #define MSGFUNC_FMT_ATTR |
michael@0 | 59 | #endif |
michael@0 | 60 | typedef bool (*MessageFunc)(void *user_data, const char *format, ...) MSGFUNC_FMT_ATTR; |
michael@0 | 61 | |
michael@0 | 62 | // Set a callback function that will be called when OTS is reporting an error. |
michael@0 | 63 | -void SetMessageCallback(MessageFunc func, void *user_data); |
michael@0 | 64 | +void OTS_API SetMessageCallback(MessageFunc func, void *user_data); |
michael@0 | 65 | |
michael@0 | 66 | enum TableAction { |
michael@0 | 67 | TABLE_ACTION_DEFAULT, // Use OTS's default action for that table |
michael@0 | 68 | TABLE_ACTION_SANITIZE, // Sanitize the table, potentially droping it |
michael@0 | 69 | TABLE_ACTION_PASSTHRU, // Serialize the table unchanged |
michael@0 | 70 | TABLE_ACTION_DROP // Drop the table |
michael@0 | 71 | }; |
michael@0 | 72 | |
michael@0 | 73 | // Signature of the function to be provided by the client to decide what action |
michael@0 | 74 | // to do for a given table. |
michael@0 | 75 | typedef TableAction (*TableActionFunc)(uint32_t tag, void *user_data); |
michael@0 | 76 | |
michael@0 | 77 | // Set a callback function that will be called when OTS needs to decide what to |
michael@0 | 78 | // do for a font table. |
michael@0 | 79 | -void SetTableActionCallback(TableActionFunc func, void *user_data); |
michael@0 | 80 | +void OTS_API SetTableActionCallback(TableActionFunc func, void *user_data); |
michael@0 | 81 | |
michael@0 | 82 | // Force to disable debug output even when the library is compiled with |
michael@0 | 83 | // -DOTS_DEBUG. |
michael@0 | 84 | void DisableDebugOutput(); |
michael@0 | 85 | |
michael@0 | 86 | // Enable WOFF2 support(experimental). |
michael@0 | 87 | void EnableWOFF2(); |
michael@0 | 88 |