michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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: /** michael@0: * This is the principal that has no rights and can't be accessed by michael@0: * anything other than itself and chrome; null principals are not michael@0: * same-origin with anything but themselves. michael@0: */ michael@0: michael@0: #ifndef nsNullPrincipal_h__ michael@0: #define nsNullPrincipal_h__ michael@0: michael@0: #include "nsIPrincipal.h" michael@0: #include "nsJSPrincipals.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIContentSecurityPolicy.h" michael@0: michael@0: class nsIURI; michael@0: michael@0: #define NS_NULLPRINCIPAL_CID \ michael@0: { 0xdd156d62, 0xd26f, 0x4441, \ michael@0: { 0x9c, 0xdb, 0xe8, 0xf0, 0x91, 0x07, 0xc2, 0x73 } } michael@0: #define NS_NULLPRINCIPAL_CONTRACTID "@mozilla.org/nullprincipal;1" michael@0: michael@0: #define NS_NULLPRINCIPAL_SCHEME "moz-nullprincipal" michael@0: michael@0: class nsNullPrincipal : public nsJSPrincipals michael@0: { michael@0: public: michael@0: nsNullPrincipal(); michael@0: michael@0: // Our refcount is managed by nsJSPrincipals. Use this macro to avoid an michael@0: // extra refcount member. michael@0: michael@0: // FIXME: bug 327245 -- I sorta wish there were a clean way to share the michael@0: // nsJSPrincipals munging code between the various principal classes without michael@0: // giving up the NS_DECL_NSIPRINCIPAL goodness. michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: NS_DECL_NSIPRINCIPAL michael@0: NS_DECL_NSISERIALIZABLE michael@0: michael@0: nsresult Init(); michael@0: michael@0: virtual void GetScriptLocation(nsACString &aStr) MOZ_OVERRIDE; michael@0: michael@0: #ifdef DEBUG michael@0: virtual void dumpImpl() MOZ_OVERRIDE; michael@0: #endif michael@0: michael@0: protected: michael@0: virtual ~nsNullPrincipal(); michael@0: michael@0: nsCOMPtr mURI; michael@0: nsCOMPtr mCSP; michael@0: }; michael@0: michael@0: #endif // nsNullPrincipal_h__