js/xpconnect/src/XPCLog.h

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 /* vim: set ts=8 sts=4 et sw=4 tw=99: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 /* Debug Logging support. */
     9 #ifndef xpclog_h___
    10 #define xpclog_h___
    12 #include "prlog.h"
    14 /*
    15  * This uses prlog.h See prlog.h for environment settings for output.
    16  * The module name used here is 'xpclog'. These environment settings
    17  * should work...
    18  *
    19  * SET NSPR_LOG_MODULES=xpclog:5
    20  * SET NSPR_LOG_FILE=logfile.txt
    21  *
    22  * usage:
    23  *   XPC_LOG_ERROR(("my comment number %d", 5))   // note the double parens
    24  *
    25  */
    27 #ifdef DEBUG
    28 #define XPC_LOG_INTERNAL(number,_args)  \
    29     do{if (XPC_Log_Check(number)){XPC_Log_print _args;}}while (0)
    31 #define XPC_LOG_ALWAYS(_args)   XPC_LOG_INTERNAL(1,_args)
    32 #define XPC_LOG_ERROR(_args)    XPC_LOG_INTERNAL(2,_args)
    33 #define XPC_LOG_WARNING(_args)  XPC_LOG_INTERNAL(3,_args)
    34 #define XPC_LOG_DEBUG(_args)    XPC_LOG_INTERNAL(4,_args)
    35 #define XPC_LOG_FLUSH()         PR_LogFlush()
    36 #define XPC_LOG_INDENT()        XPC_Log_Indent()
    37 #define XPC_LOG_OUTDENT()       XPC_Log_Outdent()
    38 #define XPC_LOG_CLEAR_INDENT()  XPC_Log_Clear_Indent()
    39 #define XPC_LOG_FINISH()        XPC_Log_Finish()
    41 extern "C" {
    43 void   XPC_Log_print(const char *fmt, ...);
    44 bool   XPC_Log_Check(int i);
    45 void   XPC_Log_Indent();
    46 void   XPC_Log_Outdent();
    47 void   XPC_Log_Clear_Indent();
    48 void   XPC_Log_Finish();
    50 } // extern "C"
    52 #else
    54 #define XPC_LOG_ALWAYS(_args)  ((void)0)
    55 #define XPC_LOG_ERROR(_args)   ((void)0)
    56 #define XPC_LOG_WARNING(_args) ((void)0)
    57 #define XPC_LOG_DEBUG(_args)   ((void)0)
    58 #define XPC_LOG_FLUSH()        ((void)0)
    59 #define XPC_LOG_INDENT()       ((void)0)
    60 #define XPC_LOG_OUTDENT()      ((void)0)
    61 #define XPC_LOG_CLEAR_INDENT() ((void)0)
    62 #define XPC_LOG_FINISH()       ((void)0)
    63 #endif
    65 #endif /* xpclog_h___ */

mercurial