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 | #include <stdio.h> |
michael@0 | 2 | #include <stdlib.h> |
michael@0 | 3 | #include <string.h> |
michael@0 | 4 | |
michael@0 | 5 | #include "libdis.h" |
michael@0 | 6 | #include "ia32_insn.h" |
michael@0 | 7 | #include "ia32_reg.h" /* for ia32_reg wrapper */ |
michael@0 | 8 | #include "ia32_settings.h" |
michael@0 | 9 | extern ia32_settings_t ia32_settings; |
michael@0 | 10 | |
michael@0 | 11 | #ifdef _MSC_VER |
michael@0 | 12 | #define snprintf _snprintf |
michael@0 | 13 | #define inline __inline |
michael@0 | 14 | #endif |
michael@0 | 15 | |
michael@0 | 16 | |
michael@0 | 17 | /* =========================================================== INIT/TERM */ |
michael@0 | 18 | static DISASM_REPORTER __x86_reporter_func = NULL; |
michael@0 | 19 | static void * __x86_reporter_arg = NULL; |
michael@0 | 20 | |
michael@0 | 21 | int x86_init( enum x86_options options, DISASM_REPORTER reporter, void * arg ) |
michael@0 | 22 | { |
michael@0 | 23 | ia32_settings.options = options; |
michael@0 | 24 | __x86_reporter_func = reporter; |
michael@0 | 25 | __x86_reporter_arg = arg; |
michael@0 | 26 | |
michael@0 | 27 | return 1; |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | void x86_set_reporter( DISASM_REPORTER reporter, void * arg ) { |
michael@0 | 31 | __x86_reporter_func = reporter; |
michael@0 | 32 | __x86_reporter_arg = arg; |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | void x86_set_options( enum x86_options options ){ |
michael@0 | 36 | ia32_settings.options = options; |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | enum x86_options x86_get_options( void ) { |
michael@0 | 40 | return ia32_settings.options; |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | int x86_cleanup( void ) |
michael@0 | 44 | { |
michael@0 | 45 | return 1; |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | /* =========================================================== ERRORS */ |
michael@0 | 49 | void x86_report_error( enum x86_report_codes code, void *data ) { |
michael@0 | 50 | if ( __x86_reporter_func ) { |
michael@0 | 51 | (*__x86_reporter_func)(code, data, __x86_reporter_arg); |
michael@0 | 52 | } |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | |
michael@0 | 56 | /* =========================================================== MISC */ |
michael@0 | 57 | unsigned int x86_endian(void) { return ia32_settings.endian; } |
michael@0 | 58 | unsigned int x86_addr_size(void) { return ia32_settings.sz_addr; } |
michael@0 | 59 | unsigned int x86_op_size(void) { return ia32_settings.sz_oper; } |
michael@0 | 60 | unsigned int x86_word_size(void) { return ia32_settings.sz_word; } |
michael@0 | 61 | unsigned int x86_max_insn_size(void) { return ia32_settings.max_insn; } |
michael@0 | 62 | unsigned int x86_sp_reg(void) { return ia32_settings.id_sp_reg; } |
michael@0 | 63 | unsigned int x86_fp_reg(void) { return ia32_settings.id_fp_reg; } |
michael@0 | 64 | unsigned int x86_ip_reg(void) { return ia32_settings.id_ip_reg; } |
michael@0 | 65 | unsigned int x86_flag_reg(void) { return ia32_settings.id_flag_reg; } |
michael@0 | 66 | |
michael@0 | 67 | /* wrapper function to hide the IA32 register fn */ |
michael@0 | 68 | void x86_reg_from_id( unsigned int id, x86_reg_t * reg ) { |
michael@0 | 69 | ia32_handle_register( reg, id ); |
michael@0 | 70 | return; |
michael@0 | 71 | } |