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.
michael@0 | 1 | 1e7bf0c636b8cca54dd83456a0f8fa219343e2a1 Bug 608195 - part 2 - extend ToPrecision to tell use whether exponential notation was used |
michael@0 | 2 | diff --git a/mfbt/double-conversion/double-conversion.cc b/mfbt/double-conversion/double-conversion.cc |
michael@0 | 3 | index febba6c..394b6a0 100644 |
michael@0 | 4 | --- a/mfbt/double-conversion/double-conversion.cc |
michael@0 | 5 | +++ b/mfbt/double-conversion/double-conversion.cc |
michael@0 | 6 | @@ -283,7 +283,9 @@ bool DoubleToStringConverter::ToExponential( |
michael@0 | 7 | |
michael@0 | 8 | bool DoubleToStringConverter::ToPrecision(double value, |
michael@0 | 9 | int precision, |
michael@0 | 10 | + bool* used_exponential_notation, |
michael@0 | 11 | StringBuilder* result_builder) const { |
michael@0 | 12 | + *used_exponential_notation = false; |
michael@0 | 13 | if (Double(value).IsSpecial()) { |
michael@0 | 14 | return HandleSpecialValues(value, result_builder); |
michael@0 | 15 | } |
michael@0 | 16 | @@ -325,6 +327,7 @@ bool DoubleToStringConverter::ToPrecision(double value, |
michael@0 | 17 | decimal_rep[i] = '0'; |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | + *used_exponential_notation = true; |
michael@0 | 21 | CreateExponentialRepresentation(decimal_rep, |
michael@0 | 22 | precision, |
michael@0 | 23 | exponent, |
michael@0 | 24 | diff --git a/mfbt/double-conversion/double-conversion.h b/mfbt/double-conversion/double-conversion.h |
michael@0 | 25 | index 0900ba0..957575c 100644 |
michael@0 | 26 | --- a/mfbt/double-conversion/double-conversion.h |
michael@0 | 27 | +++ b/mfbt/double-conversion/double-conversion.h |
michael@0 | 28 | @@ -270,6 +270,7 @@ class DoubleToStringConverter { |
michael@0 | 29 | // exponent character, the exponent's sign, and at most 3 exponent digits). |
michael@0 | 30 | MFBT_API bool ToPrecision(double value, |
michael@0 | 31 | int precision, |
michael@0 | 32 | + bool* used_exponential_notation, |
michael@0 | 33 | StringBuilder* result_builder) const; |
michael@0 | 34 | |
michael@0 | 35 | enum DtoaMode { |