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 | /* |
michael@0 | 2 | * Copyright © 2011 Google, Inc. |
michael@0 | 3 | * |
michael@0 | 4 | * This is part of HarfBuzz, a text shaping library. |
michael@0 | 5 | * |
michael@0 | 6 | * Permission is hereby granted, without written agreement and without |
michael@0 | 7 | * license or royalty fees, to use, copy, modify, and distribute this |
michael@0 | 8 | * software and its documentation for any purpose, provided that the |
michael@0 | 9 | * above copyright notice and the following two paragraphs appear in |
michael@0 | 10 | * all copies of this software. |
michael@0 | 11 | * |
michael@0 | 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
michael@0 | 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
michael@0 | 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
michael@0 | 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
michael@0 | 16 | * DAMAGE. |
michael@0 | 17 | * |
michael@0 | 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
michael@0 | 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
michael@0 | 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
michael@0 | 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
michael@0 | 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
michael@0 | 23 | * |
michael@0 | 24 | * Google Author(s): Behdad Esfahbod |
michael@0 | 25 | */ |
michael@0 | 26 | |
michael@0 | 27 | #include "hb-private.hh" |
michael@0 | 28 | |
michael@0 | 29 | /* g++ didn't like older gtype.h gcc-only code path. */ |
michael@0 | 30 | #include <glib.h> |
michael@0 | 31 | #if !GLIB_CHECK_VERSION(2,29,16) |
michael@0 | 32 | #undef __GNUC__ |
michael@0 | 33 | #undef __GNUC_MINOR__ |
michael@0 | 34 | #define __GNUC__ 2 |
michael@0 | 35 | #define __GNUC_MINOR__ 6 |
michael@0 | 36 | #endif |
michael@0 | 37 | |
michael@0 | 38 | #include "hb-gobject.h" |
michael@0 | 39 | |
michael@0 | 40 | #define HB_DEFINE_BOXED_TYPE(name,copy_func,free_func) \ |
michael@0 | 41 | GType \ |
michael@0 | 42 | hb_gobject_##name##_get_type (void) \ |
michael@0 | 43 | { \ |
michael@0 | 44 | static gsize type_id = 0; \ |
michael@0 | 45 | if (g_once_init_enter (&type_id)) { \ |
michael@0 | 46 | GType id = g_boxed_type_register_static (g_intern_static_string ("hb_" #name "_t"), \ |
michael@0 | 47 | (GBoxedCopyFunc) copy_func, \ |
michael@0 | 48 | (GBoxedFreeFunc) free_func); \ |
michael@0 | 49 | g_once_init_leave (&type_id, id); \ |
michael@0 | 50 | } \ |
michael@0 | 51 | return type_id; \ |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | #define HB_DEFINE_OBJECT_TYPE(name) \ |
michael@0 | 55 | HB_DEFINE_BOXED_TYPE (name, hb_##name##_reference, hb_##name##_destroy); |
michael@0 | 56 | |
michael@0 | 57 | HB_DEFINE_OBJECT_TYPE (buffer) |
michael@0 | 58 | HB_DEFINE_OBJECT_TYPE (blob) |
michael@0 | 59 | HB_DEFINE_OBJECT_TYPE (face) |
michael@0 | 60 | HB_DEFINE_OBJECT_TYPE (font) |
michael@0 | 61 | HB_DEFINE_OBJECT_TYPE (font_funcs) |
michael@0 | 62 | HB_DEFINE_OBJECT_TYPE (set) |
michael@0 | 63 | HB_DEFINE_OBJECT_TYPE (shape_plan) |
michael@0 | 64 | HB_DEFINE_OBJECT_TYPE (unicode_funcs) |
michael@0 | 65 | |
michael@0 | 66 | |
michael@0 | 67 | static hb_feature_t *feature_reference (hb_feature_t *g) |
michael@0 | 68 | { |
michael@0 | 69 | hb_feature_t *c = (hb_feature_t *) calloc (1, sizeof (hb_feature_t)); |
michael@0 | 70 | if (unlikely (!c)) return NULL; |
michael@0 | 71 | *c = *g; |
michael@0 | 72 | return c; |
michael@0 | 73 | } |
michael@0 | 74 | static void feature_destroy (hb_feature_t *g) { free (g); } |
michael@0 | 75 | HB_DEFINE_BOXED_TYPE (feature, feature_reference, feature_destroy) |
michael@0 | 76 | |
michael@0 | 77 | static hb_glyph_info_t *glyph_info_reference (hb_glyph_info_t *g) |
michael@0 | 78 | { |
michael@0 | 79 | hb_glyph_info_t *c = (hb_glyph_info_t *) calloc (1, sizeof (hb_glyph_info_t)); |
michael@0 | 80 | if (unlikely (!c)) return NULL; |
michael@0 | 81 | *c = *g; |
michael@0 | 82 | return c; |
michael@0 | 83 | } |
michael@0 | 84 | static void glyph_info_destroy (hb_glyph_info_t *g) { free (g); } |
michael@0 | 85 | HB_DEFINE_BOXED_TYPE (glyph_info, glyph_info_reference, glyph_info_destroy) |
michael@0 | 86 | |
michael@0 | 87 | static hb_glyph_position_t *glyph_position_reference (hb_glyph_position_t *g) |
michael@0 | 88 | { |
michael@0 | 89 | hb_glyph_position_t *c = (hb_glyph_position_t *) calloc (1, sizeof (hb_glyph_position_t)); |
michael@0 | 90 | if (unlikely (!c)) return NULL; |
michael@0 | 91 | *c = *g; |
michael@0 | 92 | return c; |
michael@0 | 93 | } |
michael@0 | 94 | static void glyph_position_destroy (hb_glyph_position_t *g) { free (g); } |
michael@0 | 95 | HB_DEFINE_BOXED_TYPE (glyph_position, glyph_position_reference, glyph_position_destroy) |
michael@0 | 96 | |
michael@0 | 97 | static hb_segment_properties_t *segment_properties_reference (hb_segment_properties_t *g) |
michael@0 | 98 | { |
michael@0 | 99 | hb_segment_properties_t *c = (hb_segment_properties_t *) calloc (1, sizeof (hb_segment_properties_t)); |
michael@0 | 100 | if (unlikely (!c)) return NULL; |
michael@0 | 101 | *c = *g; |
michael@0 | 102 | return c; |
michael@0 | 103 | } |
michael@0 | 104 | static void segment_properties_destroy (hb_segment_properties_t *g) { free (g); } |
michael@0 | 105 | HB_DEFINE_BOXED_TYPE (segment_properties, segment_properties_reference, segment_properties_destroy) |
michael@0 | 106 | |
michael@0 | 107 | static hb_user_data_key_t user_data_key_reference (hb_user_data_key_t l) { return l; } |
michael@0 | 108 | static void user_data_key_destroy (hb_user_data_key_t l) { } |
michael@0 | 109 | HB_DEFINE_BOXED_TYPE (user_data_key, user_data_key_reference, user_data_key_destroy) |
michael@0 | 110 | |
michael@0 | 111 | |
michael@0 | 112 | static hb_language_t *language_reference (hb_language_t *l) |
michael@0 | 113 | { |
michael@0 | 114 | hb_language_t *c = (hb_language_t *) calloc (1, sizeof (hb_language_t)); |
michael@0 | 115 | if (unlikely (!c)) return NULL; |
michael@0 | 116 | *c = *l; |
michael@0 | 117 | return c; |
michael@0 | 118 | } |
michael@0 | 119 | static void language_destroy (hb_language_t *l) { free (l); } |
michael@0 | 120 | HB_DEFINE_BOXED_TYPE (language, language_reference, language_destroy) |