Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "mozilla/FloatingPoint.h"
9 #include "txExpr.h"
10 #include "txExprResult.h"
11 #include "txSingleNodeContext.h"
13 bool
14 txUnionNodeTest::matches(const txXPathNode& aNode,
15 txIMatchContext* aContext)
16 {
17 uint32_t i, len = mNodeTests.Length();
18 for (i = 0; i < len; ++i) {
19 if (mNodeTests[i]->matches(aNode, aContext)) {
20 return true;
21 }
22 }
24 return false;
25 }
27 double
28 txUnionNodeTest::getDefaultPriority()
29 {
30 NS_ERROR("Don't call getDefaultPriority on txUnionPattern");
31 return mozilla::UnspecifiedNaN<double>();
32 }
34 bool
35 txUnionNodeTest::isSensitiveTo(Expr::ContextSensitivity aContext)
36 {
37 uint32_t i, len = mNodeTests.Length();
38 for (i = 0; i < len; ++i) {
39 if (mNodeTests[i]->isSensitiveTo(aContext)) {
40 return true;
41 }
42 }
44 return false;
45 }
47 #ifdef TX_TO_STRING
48 void
49 txUnionNodeTest::toString(nsAString& aDest)
50 {
51 aDest.AppendLiteral("(");
52 for (uint32_t i = 0; i < mNodeTests.Length(); ++i) {
53 if (i != 0) {
54 aDest.AppendLiteral(" | ");
55 }
56 mNodeTests[i]->toString(aDest);
57 }
58 aDest.AppendLiteral(")");
59 }
60 #endif