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

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

Issue 285673002: Change value type of timeout and maximumAge in PositionOptions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
Index: Source/bindings/v8/custom/V8GeolocationCustom.cpp
diff --git a/Source/bindings/v8/custom/V8GeolocationCustom.cpp b/Source/bindings/v8/custom/V8GeolocationCustom.cpp
index 33a433b398e51df60f07af8d5ccc34e754116e13..6e4c161aa92dca46f48f229053d78a0f5aba895c 100644
--- a/Source/bindings/v8/custom/V8GeolocationCustom.cpp
+++ b/Source/bindings/v8/custom/V8GeolocationCustom.cpp
@@ -85,13 +85,13 @@ static PassRefPtrWillBeRawPtr<PositionOptions> createPositionOptions(v8::Local<v
double timeoutDouble = timeoutNumber->Value();
// If the value is positive infinity, there's nothing to do.
if (!(std::isinf(timeoutDouble) && timeoutDouble > 0)) {
- v8::Local<v8::Int32> timeoutInt32 = timeoutValue->ToInt32();
- if (timeoutInt32.IsEmpty()) {
+ v8::Local<v8::Uint32> timeoutUint32 = timeoutValue->ToUint32();
+ if (timeoutUint32.IsEmpty()) {
succeeded = false;
return nullptr;
}
// Wrap to int32 and force non-negative to match behavior of window.setTimeout.
Michael van Ouwerkerk 2014/05/13 16:15:17 Update this comment.
kihong 2014/05/14 03:44:25 Done.
- options->setTimeout(max(0, timeoutInt32->Value()));
+ options->setTimeout(std::max<unsigned>(0, timeoutUint32->Value()));
Michael van Ouwerkerk 2014/05/13 16:15:17 The specification specifies [Clamp] so that overfl
}
}
@@ -111,13 +111,13 @@ static PassRefPtrWillBeRawPtr<PositionOptions> createPositionOptions(v8::Local<v
// If the value is positive infinity, clear maximumAge.
options->clearMaximumAge();
} else {
- v8::Local<v8::Int32> maximumAgeInt32 = maximumAgeValue->ToInt32();
- if (maximumAgeInt32.IsEmpty()) {
+ v8::Local<v8::Uint32> maximumAgeUint32 = maximumAgeValue->ToUint32();
+ if (maximumAgeUint32.IsEmpty()) {
succeeded = false;
return nullptr;
}
// Wrap to int32 and force non-negative to match behavior of window.setTimeout.
Michael van Ouwerkerk 2014/05/13 16:15:17 Update comment.
kihong 2014/05/14 03:44:25 Done.
- options->setMaximumAge(max(0, maximumAgeInt32->Value()));
+ options->setMaximumAge(std::max<unsigned>(0, maximumAgeUint32->Value()));
}
}

Powered by Google App Engine
This is Rietveld 408576698