1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 * This is the principal that has no rights and can't be accessed by
8 * anything other than itself and chrome; null principals are not
9 * same-origin with anything but themselves.
12 #ifndef nsNullPrincipal_h__
13 #define nsNullPrincipal_h__
15 #include "nsIPrincipal.h"
16 #include "nsJSPrincipals.h"
18 #include "nsIContentSecurityPolicy.h"
22 #define NS_NULLPRINCIPAL_CID \
23 { 0xdd156d62, 0xd26f, 0x4441, \
24 { 0x9c, 0xdb, 0xe8, 0xf0, 0x91, 0x07, 0xc2, 0x73 } }
25 #define NS_NULLPRINCIPAL_CONTRACTID "@mozilla.org/nullprincipal;1"
27 #define NS_NULLPRINCIPAL_SCHEME "moz-nullprincipal"
29 class nsNullPrincipal
: public nsJSPrincipals
34 // Our refcount is managed by nsJSPrincipals. Use this macro to avoid an
35 // extra refcount member.
37 // FIXME: bug 327245 -- I sorta wish there were a clean way to share the
38 // nsJSPrincipals munging code between the various principal classes without
39 // giving up the NS_DECL_NSIPRINCIPAL goodness.
40 NS_DECL_ISUPPORTS_INHERITED
42 NS_DECL_NSISERIALIZABLE
46 virtual void GetScriptLocation(nsACString
&aStr
) MOZ_OVERRIDE
;
49 virtual void dumpImpl() MOZ_OVERRIDE
;
53 virtual ~nsNullPrincipal();
55 nsCOMPtr
<nsIURI
> mURI
;
56 nsCOMPtr
<nsIContentSecurityPolicy
> mCSP
;
59 #endif // nsNullPrincipal_h__