dom/quota/OriginOrPatternString.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: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* vim: set ts=2 et sw=2 tw=80: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     5  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef mozilla_dom_quota_originorpatternstring_h__
     8 #define mozilla_dom_quota_originorpatternstring_h__
    10 #include "mozilla/dom/quota/QuotaCommon.h"
    12 BEGIN_QUOTA_NAMESPACE
    14 class OriginOrPatternString : public nsCString
    15 {
    16 public:
    17   static OriginOrPatternString
    18   FromOrigin(const nsACString& aOrigin)
    19   {
    20     return OriginOrPatternString(aOrigin, true);
    21   }
    23   static OriginOrPatternString
    24   FromPattern(const nsACString& aPattern)
    25   {
    26     return OriginOrPatternString(aPattern, false);
    27   }
    29   static OriginOrPatternString
    30   FromNull()
    31   {
    32     return OriginOrPatternString();
    33   }
    35   bool
    36   IsOrigin() const
    37   {
    38     return mIsOrigin;
    39   }
    41   bool
    42   IsPattern() const
    43   {
    44     return mIsPattern;
    45   }
    47   bool
    48   IsNull() const
    49   {
    50     return mIsNull;
    51   }
    53 private:
    54   OriginOrPatternString(const nsACString& aOriginOrPattern, bool aIsOrigin)
    55   : nsCString(aOriginOrPattern),
    56     mIsOrigin(aIsOrigin), mIsPattern(!aIsOrigin), mIsNull(false)
    57   { }
    59   OriginOrPatternString()
    60   : mIsOrigin(false), mIsPattern(false), mIsNull(true)
    61   { }
    63   bool
    64   operator==(const OriginOrPatternString& aOther) MOZ_DELETE;
    66   bool mIsOrigin;
    67   bool mIsPattern;
    68   bool mIsNull;
    69 };
    71 END_QUOTA_NAMESPACE
    73 #endif // mozilla_dom_quota_originorpatternstring_h__

mercurial