caps/include/nsNullPrincipal.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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

mercurial