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/. */
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())
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
35 namespace XPCWrapper
{
38 IsSecurityWrapper(JSObject
* wrapper
)
40 return js::IsWrapper(wrapper
);
44 UnsafeUnwrapSecurityWrapper(JSObject
* obj
);
46 } // namespace XPCWrapper