| Index: Source/bindings/core/v8/V8Binding.cpp
|
| diff --git a/Source/bindings/core/v8/V8Binding.cpp b/Source/bindings/core/v8/V8Binding.cpp
|
| index 866ef4f527700fb9958e424ac46f1d93eff70408..712c6454a3202caab6b5123db75a49d3c3f85b2b 100644
|
| --- a/Source/bindings/core/v8/V8Binding.cpp
|
| +++ b/Source/bindings/core/v8/V8Binding.cpp
|
| @@ -519,6 +519,18 @@ float toFloat(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
|
| return static_cast<float>(toDouble(value, exceptionState));
|
| }
|
|
|
| +float toRestrictedFloat(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
|
| +{
|
| + float numberValue = toFloat(value, exceptionState);
|
| + if (exceptionState.hadException())
|
| + return 0;
|
| + if (!std::isfinite(numberValue)) {
|
| + exceptionState.throwTypeError("The provided float value is non-finite.");
|
| + return 0;
|
| + }
|
| + return numberValue;
|
| +}
|
| +
|
| double toDouble(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
|
| {
|
| if (value->IsNumber())
|
| @@ -534,6 +546,18 @@ double toDouble(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
|
| return numberObject->NumberValue();
|
| }
|
|
|
| +double toRestrictedDouble(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
|
| +{
|
| + double numberValue = toDouble(value, exceptionState);
|
| + if (exceptionState.hadException())
|
| + return 0;
|
| + if (!std::isfinite(numberValue)) {
|
| + exceptionState.throwTypeError("The provided double value is non-finite.");
|
| + return 0;
|
| + }
|
| + return numberValue;
|
| +}
|
| +
|
| String toByteString(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
|
| {
|
| // Handle null default value.
|
|
|