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: 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 | #ifndef nsXBLProtoImplMember_h__ |
michael@0 | 7 | #define nsXBLProtoImplMember_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsIAtom.h" |
michael@0 | 10 | #include "nsString.h" |
michael@0 | 11 | #include "nsString.h" |
michael@0 | 12 | #include "nsIServiceManager.h" |
michael@0 | 13 | #include "nsContentUtils.h" // For NS_CONTENT_DELETE_LIST_MEMBER. |
michael@0 | 14 | #include "nsCycleCollectionParticipant.h" |
michael@0 | 15 | |
michael@0 | 16 | class nsIContent; |
michael@0 | 17 | class nsIObjectOutputStream; |
michael@0 | 18 | |
michael@0 | 19 | struct nsXBLTextWithLineNumber |
michael@0 | 20 | { |
michael@0 | 21 | char16_t* mText; |
michael@0 | 22 | uint32_t mLineNumber; |
michael@0 | 23 | |
michael@0 | 24 | nsXBLTextWithLineNumber() : |
michael@0 | 25 | mText(nullptr), |
michael@0 | 26 | mLineNumber(0) |
michael@0 | 27 | { |
michael@0 | 28 | MOZ_COUNT_CTOR(nsXBLTextWithLineNumber); |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | ~nsXBLTextWithLineNumber() { |
michael@0 | 32 | MOZ_COUNT_DTOR(nsXBLTextWithLineNumber); |
michael@0 | 33 | if (mText) { |
michael@0 | 34 | nsMemory::Free(mText); |
michael@0 | 35 | } |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | void AppendText(const nsAString& aText) { |
michael@0 | 39 | if (mText) { |
michael@0 | 40 | char16_t* temp = mText; |
michael@0 | 41 | mText = ToNewUnicode(nsDependentString(temp) + aText); |
michael@0 | 42 | nsMemory::Free(temp); |
michael@0 | 43 | } else { |
michael@0 | 44 | mText = ToNewUnicode(aText); |
michael@0 | 45 | } |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | char16_t* GetText() { |
michael@0 | 49 | return mText; |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | void SetLineNumber(uint32_t aLineNumber) { |
michael@0 | 53 | mLineNumber = aLineNumber; |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | uint32_t GetLineNumber() { |
michael@0 | 57 | return mLineNumber; |
michael@0 | 58 | } |
michael@0 | 59 | }; |
michael@0 | 60 | |
michael@0 | 61 | class nsXBLProtoImplMember |
michael@0 | 62 | { |
michael@0 | 63 | public: |
michael@0 | 64 | nsXBLProtoImplMember(const char16_t* aName) |
michael@0 | 65 | : mNext(nullptr) |
michael@0 | 66 | , mExposeToUntrustedContent(false) |
michael@0 | 67 | { |
michael@0 | 68 | mName = ToNewUnicode(nsDependentString(aName)); |
michael@0 | 69 | } |
michael@0 | 70 | virtual ~nsXBLProtoImplMember() { |
michael@0 | 71 | nsMemory::Free(mName); |
michael@0 | 72 | NS_CONTENT_DELETE_LIST_MEMBER(nsXBLProtoImplMember, this, mNext); |
michael@0 | 73 | } |
michael@0 | 74 | |
michael@0 | 75 | nsXBLProtoImplMember* GetNext() { return mNext; } |
michael@0 | 76 | void SetNext(nsXBLProtoImplMember* aNext) { mNext = aNext; } |
michael@0 | 77 | bool ShouldExposeToUntrustedContent() { return mExposeToUntrustedContent; } |
michael@0 | 78 | void SetExposeToUntrustedContent(bool aExpose) { mExposeToUntrustedContent = aExpose; } |
michael@0 | 79 | const char16_t* GetName() { return mName; } |
michael@0 | 80 | |
michael@0 | 81 | virtual nsresult InstallMember(JSContext* aCx, |
michael@0 | 82 | JS::Handle<JSObject*> aTargetClassObject) = 0; |
michael@0 | 83 | virtual nsresult CompileMember(const nsCString& aClassStr, |
michael@0 | 84 | JS::Handle<JSObject*> aClassObject) = 0; |
michael@0 | 85 | |
michael@0 | 86 | virtual void Trace(const TraceCallbacks& aCallbacks, void *aClosure) = 0; |
michael@0 | 87 | |
michael@0 | 88 | virtual nsresult Write(nsIObjectOutputStream* aStream) |
michael@0 | 89 | { |
michael@0 | 90 | return NS_OK; |
michael@0 | 91 | } |
michael@0 | 92 | |
michael@0 | 93 | protected: |
michael@0 | 94 | nsXBLProtoImplMember* mNext; // The members of an implementation are chained. |
michael@0 | 95 | char16_t* mName; // The name of the field, method, or property. |
michael@0 | 96 | |
michael@0 | 97 | bool mExposeToUntrustedContent; // If this binding is installed on an element |
michael@0 | 98 | // in an untrusted scope, should this |
michael@0 | 99 | // implementation member be accessible to the |
michael@0 | 100 | // content? |
michael@0 | 101 | }; |
michael@0 | 102 | |
michael@0 | 103 | #endif // nsXBLProtoImplMember_h__ |