content/xul/templates/src/nsTemplateMatch.cpp

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 #include "nsTemplateMatch.h"
     7 #include "nsTemplateRule.h"
     9 #ifdef NEED_CPP_UNUSED_IMPLEMENTATIONS
    10 nsTemplateMatch::nsTemplateMatch(const nsTemplateMatch& aMatch) {}
    11 void nsTemplateMatch::operator=(const nsTemplateMatch& aMatch) {}
    12 #endif
    14 // static
    15 void
    16 nsTemplateMatch::Destroy(nsTemplateMatch*& aMatch, bool aRemoveResult)
    17 {
    18     if (aRemoveResult && aMatch->mResult)
    19         aMatch->mResult->HasBeenRemoved();
    20     ::delete aMatch;
    21     aMatch = nullptr;
    22 }
    24 nsresult
    25 nsTemplateMatch::RuleMatched(nsTemplateQuerySet* aQuerySet,
    26                              nsTemplateRule* aRule,
    27                              int16_t aRuleIndex,
    28                              nsIXULTemplateResult* aResult)
    29 {
    30     // assign the rule index, used to indicate that a match is active, and
    31     // so the tree builder can get the right action body to generate
    32     mRuleIndex = aRuleIndex;
    34     nsCOMPtr<nsIDOMNode> rulenode;
    35     aRule->GetRuleNode(getter_AddRefs(rulenode));
    36     if (rulenode)
    37         return aResult->RuleMatched(aQuerySet->mCompiledQuery, rulenode);
    39     return NS_OK;
    40 }

mercurial