content/xul/templates/src/nsRDFConInstanceTestNode.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.

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 nsRDFConInstanceTestNode_h__
michael@0 7 #define nsRDFConInstanceTestNode_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 "nsIRDFResource.h"
michael@0 13 #include "nsIRDFDataSource.h"
michael@0 14 #include "nsXULTemplateQueryProcessorRDF.h"
michael@0 15
michael@0 16 /**
michael@0 17 * Rule network node that tests if a resource is an RDF container, or
michael@0 18 * uses multi-attributes to ``contain'' other elements.
michael@0 19 */
michael@0 20 class nsRDFConInstanceTestNode : public nsRDFTestNode
michael@0 21 {
michael@0 22 public:
michael@0 23 enum Test { eFalse, eTrue, eDontCare };
michael@0 24
michael@0 25 nsRDFConInstanceTestNode(TestNode* aParent,
michael@0 26 nsXULTemplateQueryProcessorRDF* aProcessor,
michael@0 27 nsIAtom* aContainerVariable,
michael@0 28 Test aContainer,
michael@0 29 Test aEmpty);
michael@0 30
michael@0 31 virtual nsresult FilterInstantiations(InstantiationSet& aInstantiations,
michael@0 32 bool* aCantHandleYet) const MOZ_OVERRIDE;
michael@0 33
michael@0 34 virtual bool
michael@0 35 CanPropagate(nsIRDFResource* aSource,
michael@0 36 nsIRDFResource* aProperty,
michael@0 37 nsIRDFNode* aTarget,
michael@0 38 Instantiation& aInitialBindings) const MOZ_OVERRIDE;
michael@0 39
michael@0 40 virtual void
michael@0 41 Retract(nsIRDFResource* aSource,
michael@0 42 nsIRDFResource* aProperty,
michael@0 43 nsIRDFNode* aTarget) const MOZ_OVERRIDE;
michael@0 44
michael@0 45
michael@0 46 class Element : public MemoryElement {
michael@0 47 public:
michael@0 48 Element(nsIRDFResource* aContainer,
michael@0 49 Test aContainerTest,
michael@0 50 Test aEmptyTest)
michael@0 51 : mContainer(aContainer),
michael@0 52 mContainerTest(aContainerTest),
michael@0 53 mEmptyTest(aEmptyTest) {
michael@0 54 MOZ_COUNT_CTOR(nsRDFConInstanceTestNode::Element); }
michael@0 55
michael@0 56 virtual ~Element() { MOZ_COUNT_DTOR(nsRDFConInstanceTestNode::Element); }
michael@0 57
michael@0 58 virtual const char* Type() const MOZ_OVERRIDE {
michael@0 59 return "nsRDFConInstanceTestNode::Element"; }
michael@0 60
michael@0 61 virtual PLHashNumber Hash() const MOZ_OVERRIDE {
michael@0 62 return mozilla::HashGeneric(mContainerTest, mEmptyTest, mContainer.get());
michael@0 63 }
michael@0 64
michael@0 65 virtual bool Equals(const MemoryElement& aElement) const MOZ_OVERRIDE {
michael@0 66 if (aElement.Type() == Type()) {
michael@0 67 const Element& element = static_cast<const Element&>(aElement);
michael@0 68 return mContainer == element.mContainer
michael@0 69 && mContainerTest == element.mContainerTest
michael@0 70 && mEmptyTest == element.mEmptyTest;
michael@0 71 }
michael@0 72 return false; }
michael@0 73
michael@0 74 protected:
michael@0 75 nsCOMPtr<nsIRDFResource> mContainer;
michael@0 76 Test mContainerTest;
michael@0 77 Test mEmptyTest;
michael@0 78 };
michael@0 79
michael@0 80 protected:
michael@0 81 nsXULTemplateQueryProcessorRDF* mProcessor;
michael@0 82 nsCOMPtr<nsIAtom> mContainerVariable;
michael@0 83 Test mContainer;
michael@0 84 Test mEmpty;
michael@0 85 };
michael@0 86
michael@0 87 #endif // nsRDFConInstanceTestNode_h__
michael@0 88

mercurial