Sat, 03 Jan 2015 20:18:00 +0100
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.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
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 | #ifndef nsStringBundle_h__ |
michael@0 | 7 | #define nsStringBundle_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/ReentrantMonitor.h" |
michael@0 | 10 | #include "nsIStringBundle.h" |
michael@0 | 11 | #include "nsCOMPtr.h" |
michael@0 | 12 | #include "nsString.h" |
michael@0 | 13 | #include "nsCOMArray.h" |
michael@0 | 14 | |
michael@0 | 15 | class nsIPersistentProperties; |
michael@0 | 16 | class nsIStringBundleOverride; |
michael@0 | 17 | |
michael@0 | 18 | class nsStringBundle : public nsIStringBundle |
michael@0 | 19 | { |
michael@0 | 20 | public: |
michael@0 | 21 | // init version |
michael@0 | 22 | nsStringBundle(const char* aURLSpec, nsIStringBundleOverride*); |
michael@0 | 23 | nsresult LoadProperties(); |
michael@0 | 24 | virtual ~nsStringBundle(); |
michael@0 | 25 | |
michael@0 | 26 | NS_DECL_THREADSAFE_ISUPPORTS |
michael@0 | 27 | NS_DECL_NSISTRINGBUNDLE |
michael@0 | 28 | |
michael@0 | 29 | nsCOMPtr<nsIPersistentProperties> mProps; |
michael@0 | 30 | |
michael@0 | 31 | protected: |
michael@0 | 32 | // |
michael@0 | 33 | // functional decomposition of the funitions repeatively called |
michael@0 | 34 | // |
michael@0 | 35 | nsresult GetStringFromID(int32_t aID, nsAString& aResult); |
michael@0 | 36 | nsresult GetStringFromName(const nsAString& aName, nsAString& aResult); |
michael@0 | 37 | |
michael@0 | 38 | nsresult GetCombinedEnumeration(nsIStringBundleOverride* aOverrideString, |
michael@0 | 39 | nsISimpleEnumerator** aResult); |
michael@0 | 40 | private: |
michael@0 | 41 | nsCString mPropertiesURL; |
michael@0 | 42 | nsCOMPtr<nsIStringBundleOverride> mOverrideStrings; |
michael@0 | 43 | mozilla::ReentrantMonitor mReentrantMonitor; |
michael@0 | 44 | bool mAttemptedLoad; |
michael@0 | 45 | bool mLoaded; |
michael@0 | 46 | |
michael@0 | 47 | public: |
michael@0 | 48 | static nsresult FormatString(const char16_t *formatStr, |
michael@0 | 49 | const char16_t **aParams, uint32_t aLength, |
michael@0 | 50 | char16_t **aResult); |
michael@0 | 51 | }; |
michael@0 | 52 | |
michael@0 | 53 | /** |
michael@0 | 54 | * An extensible implementation of the StringBundle interface. |
michael@0 | 55 | * |
michael@0 | 56 | * @created 28/Dec/1999 |
michael@0 | 57 | * @author Catalin Rotaru [CATA] |
michael@0 | 58 | */ |
michael@0 | 59 | class nsExtensibleStringBundle : public nsIStringBundle |
michael@0 | 60 | { |
michael@0 | 61 | NS_DECL_ISUPPORTS |
michael@0 | 62 | NS_DECL_NSISTRINGBUNDLE |
michael@0 | 63 | |
michael@0 | 64 | nsresult Init(const char * aCategory, nsIStringBundleService *); |
michael@0 | 65 | private: |
michael@0 | 66 | |
michael@0 | 67 | nsCOMArray<nsIStringBundle> mBundles; |
michael@0 | 68 | bool mLoaded; |
michael@0 | 69 | |
michael@0 | 70 | public: |
michael@0 | 71 | |
michael@0 | 72 | nsExtensibleStringBundle(); |
michael@0 | 73 | virtual ~nsExtensibleStringBundle(); |
michael@0 | 74 | }; |
michael@0 | 75 | |
michael@0 | 76 | |
michael@0 | 77 | |
michael@0 | 78 | #endif |