Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Unified Diff: Source/bindings/v8/custom/V8GeolocationCustom.cpp

Issue 297143003: Set default values for timeout and maximumAge of PositionOptions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change <limits> to <limits.h> Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/modules/geolocation/Geolocation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/custom/V8GeolocationCustom.cpp
diff --git a/Source/bindings/v8/custom/V8GeolocationCustom.cpp b/Source/bindings/v8/custom/V8GeolocationCustom.cpp
index 713940d083cf4859364624a6202ed999d40e5024..b73095ddd3a70b8a96b945ab9bdd7d91637dd1b7 100644
--- a/Source/bindings/v8/custom/V8GeolocationCustom.cpp
+++ b/Source/bindings/v8/custom/V8GeolocationCustom.cpp
@@ -82,15 +82,10 @@ static PassRefPtrWillBeRawPtr<PositionOptions> createPositionOptions(v8::Local<v
succeeded = false;
return nullptr;
}
- double timeoutDouble = timeoutNumber->Value();
- // If the value is positive infinity, there's nothing to do.
- if (!(std::isinf(timeoutDouble) && timeoutDouble > 0)) {
- if (timeoutDouble <= 0) {
- options->setTimeout(0);
- } else {
- options->setTimeout(toUInt32(timeoutValue, Clamp, exceptionState));
- }
- }
+ if (timeoutNumber->Value() <= 0)
+ options->setTimeout(0);
+ else
+ options->setTimeout(toUInt32(timeoutValue, Clamp, exceptionState));
}
v8::Local<v8::Value> maximumAgeValue = object->Get(v8AtomicString(isolate, "maximumAge"));
@@ -104,17 +99,10 @@ static PassRefPtrWillBeRawPtr<PositionOptions> createPositionOptions(v8::Local<v
succeeded = false;
return nullptr;
}
- double maximumAgeDouble = maximumAgeNumber->Value();
- if (std::isinf(maximumAgeDouble) && maximumAgeDouble > 0) {
- // If the value is positive infinity, clear maximumAge.
- options->clearMaximumAge();
- } else {
- if (maximumAgeDouble <= 0) {
- options->setMaximumAge(0);
- } else {
- options->setMaximumAge(toUInt32(maximumAgeValue, Clamp, exceptionState));
- }
- }
+ if (maximumAgeNumber->Value() <= 0)
+ options->setMaximumAge(0);
+ else
+ options->setMaximumAge(toUInt32(maximumAgeValue, Clamp, exceptionState));
}
return options.release();
« no previous file with comments | « no previous file | Source/modules/geolocation/Geolocation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698