Bumping manifests a=b2g-bump
[gecko.git] / js / xpconnect / src / XPCWrapper.h
blob597b8027d9ea8df462912e4f726b0ca6cae26415
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 inline bool
38 IsSecurityWrapper(JSObject* wrapper)
40 return js::IsWrapper(wrapper);
43 JSObject*
44 UnsafeUnwrapSecurityWrapper(JSObject* obj);
46 } // namespace XPCWrapper
49 #endif