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

mercurial