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: 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 /**
7 * StringResult
8 * Represents a String as a Result of evaluating an Expr
9 **/
10 #include "txExprResult.h"
12 /**
13 * Default Constructor
14 **/
15 StringResult::StringResult(txResultRecycler* aRecycler)
16 : txAExprResult(aRecycler)
17 {
18 }
20 /**
21 * Creates a new StringResult with the value of the given String parameter
22 * @param str the String to use for initialization of this StringResult's value
23 **/
24 StringResult::StringResult(const nsAString& aValue, txResultRecycler* aRecycler)
25 : txAExprResult(aRecycler), mValue(aValue)
26 {
27 }
29 /*
30 * Virtual Methods from ExprResult
31 */
33 short StringResult::getResultType() {
34 return txAExprResult::STRING;
35 } //-- getResultType
37 void
38 StringResult::stringValue(nsString& aResult)
39 {
40 aResult.Append(mValue);
41 }
43 const nsString*
44 StringResult::stringValuePointer()
45 {
46 return &mValue;
47 }
49 bool StringResult::booleanValue() {
50 return !mValue.IsEmpty();
51 } //-- booleanValue
53 double StringResult::numberValue() {
54 return txDouble::toDouble(mValue);
55 } //-- numberValue