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

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..213fab7ee502c910f022a8721af11e1af59734f1 100644
--- a/Source/bindings/v8/custom/V8GeolocationCustom.cpp
+++ b/Source/bindings/v8/custom/V8GeolocationCustom.cpp
@@ -37,7 +37,7 @@ using namespace WTF;
namespace WebCore {
-static PassRefPtrWillBeRawPtr<PositionOptions> createPositionOptions(v8::Local<v8::Value> value, v8::Isolate* isolate, bool& succeeded)
+static PassRefPtrWillBeRawPtr<PositionOptions> createPositionOptions(v8::Local<v8::Value> value, v8::Isolate* isolate, bool& succeeded, ExceptionState& exceptionState)
{
succeeded = true;
@@ -85,13 +85,11 @@ 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()) {
- succeeded = false;
- return nullptr;
+ if (timeoutDouble <= 0) {
+ options->setTimeout(0);
+ } else {
+ options->setTimeout(toUInt32(timeoutValue, Clamp, exceptionState));
}
- // Wrap to int32 and force non-negative to match behavior of window.setTimeout.
- options->setTimeout(max(0, timeoutInt32->Value()));
}
}
@@ -111,13 +109,11 @@ 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()) {
- succeeded = false;
- return nullptr;
+ if (maximumAgeDouble <= 0) {
+ options->setMaximumAge(0);
+ } else {
+ options->setMaximumAge(toUInt32(maximumAgeValue, Clamp, exceptionState));
}
- // Wrap to int32 and force non-negative to match behavior of window.setTimeout.
- options->setMaximumAge(max(0, maximumAgeInt32->Value()));
}
}
@@ -140,7 +136,7 @@ void V8Geolocation::getCurrentPositionMethodCustom(const v8::FunctionCallbackInf
if (!succeeded)
return;
- RefPtrWillBeRawPtr<PositionOptions> positionOptions = createPositionOptions(info[2], info.GetIsolate(), succeeded);
+ RefPtrWillBeRawPtr<PositionOptions> positionOptions = createPositionOptions(info[2], info.GetIsolate(), succeeded, exceptionState);
if (!succeeded)
return;
ASSERT(positionOptions);
@@ -165,7 +161,7 @@ void V8Geolocation::watchPositionMethodCustom(const v8::FunctionCallbackInfo<v8:
if (!succeeded)
return;
- RefPtrWillBeRawPtr<PositionOptions> positionOptions = createPositionOptions(info[2], info.GetIsolate(), succeeded);
+ RefPtrWillBeRawPtr<PositionOptions> positionOptions = createPositionOptions(info[2], info.GetIsolate(), succeeded, exceptionState);
if (!succeeded)
return;
ASSERT(positionOptions);

Powered by Google App Engine
This is Rietveld 408576698