xpcom/reflect/xptcall/src/md/win32/xptcinvoke_x86_64.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 /* Platform specific code to invoke XPCOM methods on native objects */
     8 #include "xptcprivate.h"
    10 extern "C" void
    11 invoke_copy_to_stack(uint64_t* d, uint32_t paramCount, nsXPTCVariant* s)
    12 {
    13    for(; paramCount > 0; paramCount--, d++, s++)
    14     {
    15         if(s->IsPtrData())
    16         {
    17             *((void**)d) = s->ptr;
    18             continue;
    19         }
    21         /*
    22          * AMD64 platform uses 8 bytes align.
    23          */
    25         switch(s->type)
    26         {
    27         case nsXPTType::T_I8     : *((int8_t*)  d) = s->val.i8;          break;
    28         case nsXPTType::T_I16    : *((int16_t*) d) = s->val.i16;         break;
    29         case nsXPTType::T_I32    : *((int32_t*) d) = s->val.i32;         break;
    30         case nsXPTType::T_I64    : *((int64_t*) d) = s->val.i64;         break;
    31         case nsXPTType::T_U8     : *((uint8_t*) d) = s->val.u8;          break;
    32         case nsXPTType::T_U16    : *((uint16_t*)d) = s->val.u16;         break;
    33         case nsXPTType::T_U32    : *((uint32_t*)d) = s->val.u32;         break;
    34         case nsXPTType::T_U64    : *((uint64_t*)d) = s->val.u64;         break;
    35         case nsXPTType::T_FLOAT  : *((float*)   d) = s->val.f;           break;
    36         case nsXPTType::T_DOUBLE : *((double*)  d) = s->val.d;           break;
    37         case nsXPTType::T_BOOL   : *((bool*)  d) = s->val.b;           break;
    38         case nsXPTType::T_CHAR   : *((char*)    d) = s->val.c;           break;
    39         case nsXPTType::T_WCHAR  : *((wchar_t*) d) = s->val.wc;          break;
    40         default:
    41             // all the others are plain pointer types
    42             *((void**)d) = s->val.p;
    43             break;
    44         }
    45     }
    46 }
    48 extern "C" nsresult
    49 XPTC__InvokebyIndex(nsISupports* that, uint32_t methodIndex,
    50                     uint32_t paramCount, nsXPTCVariant* params);
    52 extern "C"
    53 EXPORT_XPCOM_API(nsresult)
    54 NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
    55                    uint32_t paramCount, nsXPTCVariant* params)
    56 {
    57     return XPTC__InvokebyIndex(that, methodIndex, paramCount, params);
    58 }

mercurial