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 nsRDFConMemberTestNode_h__ |
michael@0 | 7 | #define nsRDFConMemberTestNode_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/Attributes.h" |
michael@0 | 10 | #include "nscore.h" |
michael@0 | 11 | #include "nsRDFTestNode.h" |
michael@0 | 12 | #include "nsIRDFDataSource.h" |
michael@0 | 13 | #include "nsXULTemplateQueryProcessorRDF.h" |
michael@0 | 14 | |
michael@0 | 15 | /** |
michael@0 | 16 | * Rule network node that test if a resource is a member of an RDF |
michael@0 | 17 | * container, or is ``contained'' by another resource that refers to |
michael@0 | 18 | * it using a ``containment'' attribute. |
michael@0 | 19 | */ |
michael@0 | 20 | class nsRDFConMemberTestNode : public nsRDFTestNode |
michael@0 | 21 | { |
michael@0 | 22 | public: |
michael@0 | 23 | nsRDFConMemberTestNode(TestNode* aParent, |
michael@0 | 24 | nsXULTemplateQueryProcessorRDF* aProcessor, |
michael@0 | 25 | nsIAtom* aContainerVariable, |
michael@0 | 26 | nsIAtom* aMemberVariable); |
michael@0 | 27 | |
michael@0 | 28 | virtual nsresult FilterInstantiations(InstantiationSet& aInstantiations, |
michael@0 | 29 | bool* aCantHandleYet) const MOZ_OVERRIDE; |
michael@0 | 30 | |
michael@0 | 31 | virtual bool |
michael@0 | 32 | CanPropagate(nsIRDFResource* aSource, |
michael@0 | 33 | nsIRDFResource* aProperty, |
michael@0 | 34 | nsIRDFNode* aTarget, |
michael@0 | 35 | Instantiation& aInitialBindings) const MOZ_OVERRIDE; |
michael@0 | 36 | |
michael@0 | 37 | virtual void |
michael@0 | 38 | Retract(nsIRDFResource* aSource, |
michael@0 | 39 | nsIRDFResource* aProperty, |
michael@0 | 40 | nsIRDFNode* aTarget) const MOZ_OVERRIDE; |
michael@0 | 41 | |
michael@0 | 42 | class Element : public MemoryElement { |
michael@0 | 43 | public: |
michael@0 | 44 | Element(nsIRDFResource* aContainer, |
michael@0 | 45 | nsIRDFNode* aMember) |
michael@0 | 46 | : mContainer(aContainer), |
michael@0 | 47 | mMember(aMember) { |
michael@0 | 48 | MOZ_COUNT_CTOR(nsRDFConMemberTestNode::Element); } |
michael@0 | 49 | |
michael@0 | 50 | virtual ~Element() { MOZ_COUNT_DTOR(nsRDFConMemberTestNode::Element); } |
michael@0 | 51 | |
michael@0 | 52 | virtual const char* Type() const MOZ_OVERRIDE { |
michael@0 | 53 | return "nsRDFConMemberTestNode::Element"; } |
michael@0 | 54 | |
michael@0 | 55 | virtual PLHashNumber Hash() const MOZ_OVERRIDE { |
michael@0 | 56 | return PLHashNumber(NS_PTR_TO_INT32(mContainer.get())) ^ |
michael@0 | 57 | (PLHashNumber(NS_PTR_TO_INT32(mMember.get())) >> 12); } |
michael@0 | 58 | |
michael@0 | 59 | virtual bool Equals(const MemoryElement& aElement) const MOZ_OVERRIDE { |
michael@0 | 60 | if (aElement.Type() == Type()) { |
michael@0 | 61 | const Element& element = static_cast<const Element&>(aElement); |
michael@0 | 62 | return mContainer == element.mContainer && mMember == element.mMember; |
michael@0 | 63 | } |
michael@0 | 64 | return false; } |
michael@0 | 65 | |
michael@0 | 66 | protected: |
michael@0 | 67 | nsCOMPtr<nsIRDFResource> mContainer; |
michael@0 | 68 | nsCOMPtr<nsIRDFNode> mMember; |
michael@0 | 69 | }; |
michael@0 | 70 | |
michael@0 | 71 | protected: |
michael@0 | 72 | nsXULTemplateQueryProcessorRDF* mProcessor; |
michael@0 | 73 | nsCOMPtr<nsIAtom> mContainerVariable; |
michael@0 | 74 | nsCOMPtr<nsIAtom> mMemberVariable; |
michael@0 | 75 | }; |
michael@0 | 76 | |
michael@0 | 77 | #endif // nsRDFConMemberTestNode_h__ |