xpcom/ds/nsSupportsPrimitives.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: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     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 #ifndef nsSupportsPrimitives_h__
     7 #define nsSupportsPrimitives_h__
     9 #include "mozilla/Attributes.h"
    11 #include "nsISupportsPrimitives.h"
    12 #include "nsCOMPtr.h"
    13 #include "nsString.h"
    15 class nsSupportsIDImpl MOZ_FINAL : public nsISupportsID
    16 {
    17 public:
    18     NS_DECL_ISUPPORTS
    19     NS_DECL_NSISUPPORTSPRIMITIVE
    20     NS_DECL_NSISUPPORTSID
    22     nsSupportsIDImpl();
    24 private:
    25     ~nsSupportsIDImpl() { }
    27     nsID *mData;
    28 };
    30 /***************************************************************************/
    32 class nsSupportsCStringImpl MOZ_FINAL : public nsISupportsCString
    33 {
    34 public:
    35     NS_DECL_ISUPPORTS
    36     NS_DECL_NSISUPPORTSPRIMITIVE
    37     NS_DECL_NSISUPPORTSCSTRING
    39     nsSupportsCStringImpl() {}
    41 private:
    42     ~nsSupportsCStringImpl() {}
    44     nsCString mData;
    45 };
    47 /***************************************************************************/
    49 class nsSupportsStringImpl MOZ_FINAL : public nsISupportsString
    50 {
    51 public:
    52     NS_DECL_ISUPPORTS
    53     NS_DECL_NSISUPPORTSPRIMITIVE
    54     NS_DECL_NSISUPPORTSSTRING
    56     nsSupportsStringImpl() {}
    58 private:
    59     ~nsSupportsStringImpl() {}
    61     nsString mData;
    62 };
    64 /***************************************************************************/
    66 class nsSupportsPRBoolImpl MOZ_FINAL : public nsISupportsPRBool
    67 {
    68 public:
    69     NS_DECL_THREADSAFE_ISUPPORTS
    70     NS_DECL_NSISUPPORTSPRIMITIVE
    71     NS_DECL_NSISUPPORTSPRBOOL
    73     nsSupportsPRBoolImpl();
    75 private:
    76     ~nsSupportsPRBoolImpl() {}
    78     bool mData;
    79 };
    81 /***************************************************************************/
    83 class nsSupportsPRUint8Impl MOZ_FINAL : public nsISupportsPRUint8
    84 {
    85 public:
    86     NS_DECL_ISUPPORTS
    87     NS_DECL_NSISUPPORTSPRIMITIVE
    88     NS_DECL_NSISUPPORTSPRUINT8
    90     nsSupportsPRUint8Impl();
    92 private:
    93     ~nsSupportsPRUint8Impl() {}
    95     uint8_t mData;
    96 };
    98 /***************************************************************************/
   100 class nsSupportsPRUint16Impl MOZ_FINAL : public nsISupportsPRUint16
   101 {
   102 public:
   103     NS_DECL_ISUPPORTS
   104     NS_DECL_NSISUPPORTSPRIMITIVE
   105     NS_DECL_NSISUPPORTSPRUINT16
   107     nsSupportsPRUint16Impl();
   109 private:
   110     ~nsSupportsPRUint16Impl() {}
   112     uint16_t mData;
   113 };
   115 /***************************************************************************/
   117 class nsSupportsPRUint32Impl MOZ_FINAL : public nsISupportsPRUint32
   118 {
   119 public:
   120     NS_DECL_ISUPPORTS
   121     NS_DECL_NSISUPPORTSPRIMITIVE
   122     NS_DECL_NSISUPPORTSPRUINT32
   124     nsSupportsPRUint32Impl();
   126 private:
   127     ~nsSupportsPRUint32Impl() {}
   129     uint32_t mData;
   130 };
   132 /***************************************************************************/
   134 class nsSupportsPRUint64Impl MOZ_FINAL : public nsISupportsPRUint64
   135 {
   136 public:
   137     NS_DECL_ISUPPORTS
   138     NS_DECL_NSISUPPORTSPRIMITIVE
   139     NS_DECL_NSISUPPORTSPRUINT64
   141     nsSupportsPRUint64Impl();
   143 private:
   144     ~nsSupportsPRUint64Impl() {}
   146     uint64_t mData;
   147 };
   149 /***************************************************************************/
   151 class nsSupportsPRTimeImpl MOZ_FINAL : public nsISupportsPRTime
   152 {
   153 public:
   154     NS_DECL_ISUPPORTS
   155     NS_DECL_NSISUPPORTSPRIMITIVE
   156     NS_DECL_NSISUPPORTSPRTIME
   158     nsSupportsPRTimeImpl();
   160 private:
   161     ~nsSupportsPRTimeImpl() {}
   163     PRTime mData;
   164 };
   166 /***************************************************************************/
   168 class nsSupportsCharImpl MOZ_FINAL : public nsISupportsChar
   169 {
   170 public:
   171     NS_DECL_ISUPPORTS
   172     NS_DECL_NSISUPPORTSPRIMITIVE
   173     NS_DECL_NSISUPPORTSCHAR
   175     nsSupportsCharImpl();
   177 private:
   178     ~nsSupportsCharImpl() {}
   180     char mData;
   181 };
   183 /***************************************************************************/
   185 class nsSupportsPRInt16Impl MOZ_FINAL : public nsISupportsPRInt16
   186 {
   187 public:
   188     NS_DECL_ISUPPORTS
   189     NS_DECL_NSISUPPORTSPRIMITIVE
   190     NS_DECL_NSISUPPORTSPRINT16
   192     nsSupportsPRInt16Impl();
   194 private:
   195     ~nsSupportsPRInt16Impl() {}
   197     int16_t mData;
   198 };
   200 /***************************************************************************/
   202 class nsSupportsPRInt32Impl MOZ_FINAL : public nsISupportsPRInt32
   203 {
   204 public:
   205     NS_DECL_ISUPPORTS
   206     NS_DECL_NSISUPPORTSPRIMITIVE
   207     NS_DECL_NSISUPPORTSPRINT32
   209     nsSupportsPRInt32Impl();
   211 private:
   212     ~nsSupportsPRInt32Impl() {}
   214     int32_t mData;
   215 };
   217 /***************************************************************************/
   219 class nsSupportsPRInt64Impl MOZ_FINAL : public nsISupportsPRInt64
   220 {
   221 public:
   222     NS_DECL_ISUPPORTS
   223     NS_DECL_NSISUPPORTSPRIMITIVE
   224     NS_DECL_NSISUPPORTSPRINT64
   226     nsSupportsPRInt64Impl();
   228 private:
   229     ~nsSupportsPRInt64Impl() {}
   231     int64_t mData;
   232 };
   234 /***************************************************************************/
   236 class nsSupportsFloatImpl MOZ_FINAL : public nsISupportsFloat
   237 {
   238 public:
   239     NS_DECL_ISUPPORTS
   240     NS_DECL_NSISUPPORTSPRIMITIVE
   241     NS_DECL_NSISUPPORTSFLOAT
   243     nsSupportsFloatImpl();
   245 private:
   246     ~nsSupportsFloatImpl() {}
   248     float mData;
   249 };
   251 /***************************************************************************/
   253 class nsSupportsDoubleImpl MOZ_FINAL : public nsISupportsDouble
   254 {
   255 public:
   256     NS_DECL_ISUPPORTS
   257     NS_DECL_NSISUPPORTSPRIMITIVE
   258     NS_DECL_NSISUPPORTSDOUBLE
   260     nsSupportsDoubleImpl();
   262 private:
   263     ~nsSupportsDoubleImpl() {}
   265     double mData;
   266 };
   268 /***************************************************************************/
   270 class nsSupportsVoidImpl MOZ_FINAL : public nsISupportsVoid
   271 {
   272 public:
   273     NS_DECL_THREADSAFE_ISUPPORTS
   274     NS_DECL_NSISUPPORTSPRIMITIVE
   275     NS_DECL_NSISUPPORTSVOID
   277     nsSupportsVoidImpl();
   279 private:
   280     ~nsSupportsVoidImpl() {}
   282     void* mData;
   283 };
   285 /***************************************************************************/
   287 class nsSupportsInterfacePointerImpl MOZ_FINAL : public nsISupportsInterfacePointer
   288 {
   289 public:
   290     NS_DECL_THREADSAFE_ISUPPORTS
   291     NS_DECL_NSISUPPORTSPRIMITIVE
   292     NS_DECL_NSISUPPORTSINTERFACEPOINTER
   294     nsSupportsInterfacePointerImpl();
   296 private:
   297     ~nsSupportsInterfacePointerImpl();
   299     nsCOMPtr<nsISupports> mData;
   300     nsID *mIID;
   301 };
   303 /***************************************************************************/
   305 /**
   306  * Wraps a static const char* buffer for use with nsISupportsCString
   307  *
   308  * Only use this class with static buffers, or arena-allocated buffers of
   309  * permanent lifetime!
   310  */
   311 class nsSupportsDependentCString MOZ_FINAL : public nsISupportsCString
   312 {
   313 public:
   314   NS_DECL_ISUPPORTS
   315   NS_DECL_NSISUPPORTSPRIMITIVE
   316   NS_DECL_NSISUPPORTSCSTRING
   318   nsSupportsDependentCString(const char* aStr);
   320 private:
   321   ~nsSupportsDependentCString() {}
   323   nsDependentCString mData;
   324 };
   326 #endif /* nsSupportsPrimitives_h__ */

mercurial