caps/include/nsNullPrincipal.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:13eb6e977da4
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/. */
5
6 /**
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.
10 */
11
12 #ifndef nsNullPrincipal_h__
13 #define nsNullPrincipal_h__
14
15 #include "nsIPrincipal.h"
16 #include "nsJSPrincipals.h"
17 #include "nsCOMPtr.h"
18 #include "nsIContentSecurityPolicy.h"
19
20 class nsIURI;
21
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"
26
27 #define NS_NULLPRINCIPAL_SCHEME "moz-nullprincipal"
28
29 class nsNullPrincipal : public nsJSPrincipals
30 {
31 public:
32 nsNullPrincipal();
33
34 // Our refcount is managed by nsJSPrincipals. Use this macro to avoid an
35 // extra refcount member.
36
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
41 NS_DECL_NSIPRINCIPAL
42 NS_DECL_NSISERIALIZABLE
43
44 nsresult Init();
45
46 virtual void GetScriptLocation(nsACString &aStr) MOZ_OVERRIDE;
47
48 #ifdef DEBUG
49 virtual void dumpImpl() MOZ_OVERRIDE;
50 #endif
51
52 protected:
53 virtual ~nsNullPrincipal();
54
55 nsCOMPtr<nsIURI> mURI;
56 nsCOMPtr<nsIContentSecurityPolicy> mCSP;
57 };
58
59 #endif // nsNullPrincipal_h__

mercurial