michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* vim: set ts=8 sts=4 et sw=4 tw=99: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef __SANDBOXPRIVATE_H__ michael@0: #define __SANDBOXPRIVATE_H__ michael@0: michael@0: #include "nsIGlobalObject.h" michael@0: #include "nsIScriptObjectPrincipal.h" michael@0: #include "nsIPrincipal.h" michael@0: #include "nsWeakReference.h" michael@0: #include "nsWrapperCache.h" michael@0: michael@0: #include "js/RootingAPI.h" michael@0: michael@0: // This interface is public only because it is used in jsd. michael@0: // Once jsd is gone this file should be moved back to xpconnect/src. michael@0: michael@0: class SandboxPrivate : public nsIGlobalObject, michael@0: public nsIScriptObjectPrincipal, michael@0: public nsSupportsWeakReference, michael@0: public nsWrapperCache michael@0: { michael@0: public: michael@0: SandboxPrivate(nsIPrincipal *principal, JSObject *global) michael@0: : mPrincipal(principal) michael@0: { michael@0: SetWrapper(global); michael@0: } michael@0: virtual ~SandboxPrivate() { } michael@0: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(SandboxPrivate, michael@0: nsIGlobalObject) michael@0: michael@0: nsIPrincipal *GetPrincipal() michael@0: { michael@0: return mPrincipal; michael@0: } michael@0: michael@0: JSObject *GetGlobalJSObject() michael@0: { michael@0: return GetWrapper(); michael@0: } michael@0: michael@0: void ForgetGlobalObject() michael@0: { michael@0: ClearWrapper(); michael@0: } michael@0: private: michael@0: nsCOMPtr mPrincipal; michael@0: }; michael@0: michael@0: #endif // __SANDBOXPRIVATE_H__