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