js/xpconnect/src/XPCWrapper.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: 2 -*- */
     2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
     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 #ifndef XPC_WRAPPER_H
     8 #define XPC_WRAPPER_H 1
    10 #include "xpcprivate.h"
    11 #include "jswrapper.h"
    13 class nsIScriptSecurityManager;
    15 namespace XPCNativeWrapper {
    17 // Given an XPCWrappedNative pointer and the name of the function on
    18 // XPCNativeScriptableFlags corresponding with a flag, returns 'true'
    19 // if the flag is set.
    20 // XXX Convert to using GetFlags() and not a macro.
    21 #define NATIVE_HAS_FLAG(_wn, _flag)                                           \
    22   ((_wn)->GetScriptableInfo() &&                                              \
    23    (_wn)->GetScriptableInfo()->GetFlags()._flag())
    25 bool
    26 AttachNewConstructorObject(JSContext *aCx, JS::HandleObject aGlobalObject);
    28 } // namespace XPCNativeWrapper
    30 // This namespace wraps some common functionality between the three existing
    31 // wrappers. Its main purpose is to allow XPCCrossOriginWrapper to act both
    32 // as an XPCSafeJSObjectWrapper and as an XPCNativeWrapper when required to
    33 // do so (the decision is based on the principals of the wrapper and wrapped
    34 // objects).
    35 namespace XPCWrapper {
    37 /**
    38  * Returns the script security manager used by XPConnect.
    39  */
    40 inline nsIScriptSecurityManager *
    41 GetSecurityManager()
    42 {
    43   return nsXPConnect::gScriptSecurityManager;
    44 }
    46 inline bool
    47 IsSecurityWrapper(JSObject *wrapper)
    48 {
    49   return js::IsWrapper(wrapper);
    50 }
    52 JSObject *
    53 UnsafeUnwrapSecurityWrapper(JSObject *obj);
    55 } // namespace XPCWrapper
    58 #endif

mercurial