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.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef XPC_WRAPPER_H
michael@0 8 #define XPC_WRAPPER_H 1
michael@0 9
michael@0 10 #include "xpcprivate.h"
michael@0 11 #include "jswrapper.h"
michael@0 12
michael@0 13 class nsIScriptSecurityManager;
michael@0 14
michael@0 15 namespace XPCNativeWrapper {
michael@0 16
michael@0 17 // Given an XPCWrappedNative pointer and the name of the function on
michael@0 18 // XPCNativeScriptableFlags corresponding with a flag, returns 'true'
michael@0 19 // if the flag is set.
michael@0 20 // XXX Convert to using GetFlags() and not a macro.
michael@0 21 #define NATIVE_HAS_FLAG(_wn, _flag) \
michael@0 22 ((_wn)->GetScriptableInfo() && \
michael@0 23 (_wn)->GetScriptableInfo()->GetFlags()._flag())
michael@0 24
michael@0 25 bool
michael@0 26 AttachNewConstructorObject(JSContext *aCx, JS::HandleObject aGlobalObject);
michael@0 27
michael@0 28 } // namespace XPCNativeWrapper
michael@0 29
michael@0 30 // This namespace wraps some common functionality between the three existing
michael@0 31 // wrappers. Its main purpose is to allow XPCCrossOriginWrapper to act both
michael@0 32 // as an XPCSafeJSObjectWrapper and as an XPCNativeWrapper when required to
michael@0 33 // do so (the decision is based on the principals of the wrapper and wrapped
michael@0 34 // objects).
michael@0 35 namespace XPCWrapper {
michael@0 36
michael@0 37 /**
michael@0 38 * Returns the script security manager used by XPConnect.
michael@0 39 */
michael@0 40 inline nsIScriptSecurityManager *
michael@0 41 GetSecurityManager()
michael@0 42 {
michael@0 43 return nsXPConnect::gScriptSecurityManager;
michael@0 44 }
michael@0 45
michael@0 46 inline bool
michael@0 47 IsSecurityWrapper(JSObject *wrapper)
michael@0 48 {
michael@0 49 return js::IsWrapper(wrapper);
michael@0 50 }
michael@0 51
michael@0 52 JSObject *
michael@0 53 UnsafeUnwrapSecurityWrapper(JSObject *obj);
michael@0 54
michael@0 55 } // namespace XPCWrapper
michael@0 56
michael@0 57
michael@0 58 #endif

mercurial