caps/include/nsNullPrincipal.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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/. */
     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  */
    12 #ifndef nsNullPrincipal_h__
    13 #define nsNullPrincipal_h__
    15 #include "nsIPrincipal.h"
    16 #include "nsJSPrincipals.h"
    17 #include "nsCOMPtr.h"
    18 #include "nsIContentSecurityPolicy.h"
    20 class nsIURI;
    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
    30 {
    31 public:
    32   nsNullPrincipal();
    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
    41   NS_DECL_NSIPRINCIPAL
    42   NS_DECL_NSISERIALIZABLE
    44   nsresult Init();
    46   virtual void GetScriptLocation(nsACString &aStr) MOZ_OVERRIDE;
    48 #ifdef DEBUG
    49   virtual void dumpImpl() MOZ_OVERRIDE;
    50 #endif 
    52  protected:
    53   virtual ~nsNullPrincipal();
    55   nsCOMPtr<nsIURI> mURI;
    56   nsCOMPtr<nsIContentSecurityPolicy> mCSP;
    57 };
    59 #endif // nsNullPrincipal_h__

mercurial