xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_rhapsody.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: 4; 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" uint32_t
    11 invoke_count_words(uint32_t paramCount, nsXPTCVariant* s)
    12 {
    13     uint32_t result = 0;
    14     /*    fprintf(stderr,"invoke_count_words(%d,%p)\n",paramCount, s);*/
    16     for(uint32_t i = 0; i < paramCount; i++, s++)
    17     {
    18         if(s->IsPtrData())
    19         {
    20             result++;
    21             continue;
    22         }
    23         switch(s->type)
    24         {
    25         case nsXPTType::T_I8     :
    26         case nsXPTType::T_I16    :
    27         case nsXPTType::T_I32    :
    28             result++;
    29             break;
    30         case nsXPTType::T_I64    :
    31             result+=2;
    32             break;
    33         case nsXPTType::T_U8     :
    34         case nsXPTType::T_U16    :
    35         case nsXPTType::T_U32    :
    36             result++;
    37             break;
    38         case nsXPTType::T_U64    :
    39             result+=2;
    40             break;
    41         case nsXPTType::T_FLOAT  :
    42             result++;
    43             break;
    44         case nsXPTType::T_DOUBLE :
    45             result+=2;
    46             break;
    47         case nsXPTType::T_BOOL   :
    48         case nsXPTType::T_CHAR   :
    49         case nsXPTType::T_WCHAR  :
    50             result++;
    51             break;
    52         default:
    53             // all the others are plain pointer types
    54             result++;
    55             break;
    56         }
    57     }
    58     return result;
    59 }
    61 extern "C" void
    62 invoke_copy_to_stack(uint32_t* d, uint32_t paramCount, nsXPTCVariant* s, double *fprData)
    63 {
    64 	uint32_t fpCount = 0;
    66     /*    fprintf(stderr,"invoke_copy_to_stack(%p, %d, %p, %p)\n", d, paramCount, s, fprData);*/
    68     for(uint32_t i = 0; i < paramCount; i++, d++, s++)
    69     {
    70         if(s->IsPtrData())
    71         {
    72             *((void**)d) = s->ptr;
    73             continue;
    74         }
    75         switch(s->type)
    76         {
    77         case nsXPTType::T_I8     : *((int32_t*) d) = s->val.i8;          break;
    78         case nsXPTType::T_I16    : *((int32_t*) d) = s->val.i16;         break;
    79         case nsXPTType::T_I32    : *((int32_t*) d) = s->val.i32;         break;
    80         case nsXPTType::T_I64    : *((int64_t*) d) = s->val.i64; d++;    break;
    81         case nsXPTType::T_U8     : *((uint32_t*) d) = s->val.u8;          break;
    82         case nsXPTType::T_U16    : *((uint32_t*)d) = s->val.u16;         break;
    83         case nsXPTType::T_U32    : *((uint32_t*)d) = s->val.u32;         break;
    84         case nsXPTType::T_U64    : *((uint64_t*)d) = s->val.u64; d++;    break;
    85         case nsXPTType::T_FLOAT  : *((float*)   d) = s->val.f;
    86         			   if (fpCount < 13)
    87         		               fprData[fpCount++] = s->val.f;
    88         			   break;
    89         case nsXPTType::T_DOUBLE : *((double*)  d) = s->val.d;   d++;
    90         			   if (fpCount < 13)
    91         			       fprData[fpCount++] = s->val.d;
    92         			   break;
    93         case nsXPTType::T_BOOL   : *((uint32_t*) d) = s->val.b;          break;
    94         case nsXPTType::T_CHAR   : *((int32_t*)  d) = s->val.c;          break;
    95         case nsXPTType::T_WCHAR  : *((uint32_t*) d) = s->val.wc;         break;
    96         default:
    97             // all the others are plain pointer types
    98             *((void**)d) = s->val.p;
    99             break;
   100         }
   101     }
   102 }
   104 extern "C" nsresult _NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
   105                                       uint32_t paramCount, 
   106                                       nsXPTCVariant* params);
   108 EXPORT_XPCOM_API(nsresult)
   109 NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
   110                  uint32_t paramCount, nsXPTCVariant* params)
   111 {
   112     return _NS_InvokeByIndex(that, methodIndex, paramCount, params);
   113 }    

mercurial