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

Unified Diff: Source/modules/geolocation/PositionOptions.cpp

Issue 382443002: maximumAge and timeout should be used after initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/geolocation/PositionOptions.cpp
diff --git a/Source/modules/geolocation/PositionOptions.cpp b/Source/modules/geolocation/PositionOptions.cpp
index d6f79d04a7754f53a5f09206f83207f1020a76f8..2236306e4172102b9c2110a0e62106d9661be5cf 100644
--- a/Source/modules/geolocation/PositionOptions.cpp
+++ b/Source/modules/geolocation/PositionOptions.cpp
@@ -20,27 +20,32 @@ PositionOptions::PositionOptions(const Dictionary& options)
, m_maximumAge(0)
, m_timeout(std::numeric_limits<unsigned>::max())
{
- if (options.hasProperty("enableHighAccuracy"))
- options.get("enableHighAccuracy", m_highAccuracy);
+ if (options.hasProperty("enableHighAccuracy")) {
+ bool highAccuracy;
+ if (options.get("enableHighAccuracy", highAccuracy))
+ m_highAccuracy = highAccuracy;
+ }
if (options.hasProperty("maximumAge")) {
double maximumAge;
- options.get("maximumAge", maximumAge);
- if (maximumAge < 0)
- m_maximumAge = 0;
- else if (maximumAge > std::numeric_limits<unsigned>::max())
- m_maximumAge = std::numeric_limits<unsigned>::max();
- else
- m_maximumAge = maximumAge;
+ if (options.get("maximumAge", maximumAge)) {
+ if (maximumAge < 0)
+ m_maximumAge = 0;
+ else if (maximumAge > std::numeric_limits<unsigned>::max())
+ m_maximumAge = std::numeric_limits<unsigned>::max();
+ else
+ m_maximumAge = maximumAge;
+ }
}
if (options.hasProperty("timeout")) {
double timeout;
- options.get("timeout", timeout);
- if (timeout < 0)
- m_timeout = 0;
- else if (timeout > std::numeric_limits<unsigned>::max())
- m_timeout = std::numeric_limits<unsigned>::max();
- else
- m_timeout = timeout;
+ if (options.get("timeout", timeout)) {
+ if (timeout < 0)
+ m_timeout = 0;
+ else if (timeout > std::numeric_limits<unsigned>::max())
+ m_timeout = std::numeric_limits<unsigned>::max();
+ else
+ m_timeout = timeout;
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698