OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2009, The Android Open Source Project | 2 * Copyright 2009, The Android Open Source Project |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * * Redistributions of source code must retain the above copyright | 7 * * Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * * Redistributions in binary form must reproduce the above copyright | 9 * * Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 succeeded = false; | 98 succeeded = false; |
99 return nullptr; | 99 return nullptr; |
100 } | 100 } |
101 if (!maximumAgeValue->IsUndefined()) { | 101 if (!maximumAgeValue->IsUndefined()) { |
102 v8::Local<v8::Number> maximumAgeNumber = maximumAgeValue->ToNumber(); | 102 v8::Local<v8::Number> maximumAgeNumber = maximumAgeValue->ToNumber(); |
103 if (maximumAgeNumber.IsEmpty()) { | 103 if (maximumAgeNumber.IsEmpty()) { |
104 succeeded = false; | 104 succeeded = false; |
105 return nullptr; | 105 return nullptr; |
106 } | 106 } |
107 double maximumAgeDouble = maximumAgeNumber->Value(); | 107 double maximumAgeDouble = maximumAgeNumber->Value(); |
108 if (std::isinf(maximumAgeDouble) && maximumAgeDouble > 0) { | 108 if ((std::isinf(maximumAgeDouble) && maximumAgeDouble > 0) || maximumAge Double <= 0) { |
109 // If the value is positive infinity, clear maximumAge. | 109 // If the value is positive infinity or negative |
Nils Barth (inactive)
2014/05/26 01:20:43
???
If the value of maximumAge is set to positive
kihong
2014/05/26 04:23:43
You are right.
I will change this with next patch.
| |
110 options->clearMaximumAge(); | 110 options->setMaximumAge(0); |
111 } else { | 111 } else { |
112 if (maximumAgeDouble <= 0) { | 112 options->setMaximumAge(toUInt32(maximumAgeValue, Clamp, exceptionSta te)); |
113 options->setMaximumAge(0); | |
114 } else { | |
115 options->setMaximumAge(toUInt32(maximumAgeValue, Clamp, exceptio nState)); | |
116 } | |
117 } | 113 } |
118 } | 114 } |
119 | 115 |
120 return options.release(); | 116 return options.release(); |
121 } | 117 } |
122 | 118 |
123 void V8Geolocation::getCurrentPositionMethodCustom(const v8::FunctionCallbackInf o<v8::Value>& info) | 119 void V8Geolocation::getCurrentPositionMethodCustom(const v8::FunctionCallbackInf o<v8::Value>& info) |
124 { | 120 { |
125 bool succeeded = false; | 121 bool succeeded = false; |
126 | 122 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 if (!succeeded) | 161 if (!succeeded) |
166 return; | 162 return; |
167 ASSERT(positionOptions); | 163 ASSERT(positionOptions); |
168 | 164 |
169 Geolocation* geolocation = V8Geolocation::toNative(info.Holder()); | 165 Geolocation* geolocation = V8Geolocation::toNative(info.Holder()); |
170 int watchId = geolocation->watchPosition(positionCallback.release(), positio nErrorCallback.release(), positionOptions.release()); | 166 int watchId = geolocation->watchPosition(positionCallback.release(), positio nErrorCallback.release(), positionOptions.release()); |
171 v8SetReturnValue(info, watchId); | 167 v8SetReturnValue(info, watchId); |
172 } | 168 } |
173 | 169 |
174 } // namespace WebCore | 170 } // namespace WebCore |
OLD | NEW |