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

Unified Diff: Source/bindings/core/v8/V8Binding.h

Issue 860353002: IDL: Add toRestricted{Float,Double}() helpers to V8Binding.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add FIXME comment Created 5 years, 11 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/core/v8/V8Binding.h
diff --git a/Source/bindings/core/v8/V8Binding.h b/Source/bindings/core/v8/V8Binding.h
index f970537cedeea2703d77c79e186c9b8399261075..7becc4029284d98cddec34f5c0a3e4ddef99b875 100644
--- a/Source/bindings/core/v8/V8Binding.h
+++ b/Source/bindings/core/v8/V8Binding.h
@@ -468,6 +468,9 @@ uint64_t toUInt64(v8::Handle<v8::Value>);
// Convert a value to a single precision float, which might fail.
float toFloat(v8::Handle<v8::Value>, ExceptionState&);
+// Convert a value to a single precision float, throwing on non-finite values.
+float toRestrictedFloat(v8::Handle<v8::Value>, ExceptionState&);
+
// Convert a value to a single precision float assuming the conversion cannot fail.
inline float toFloat(v8::Local<v8::Value> value)
{
@@ -477,6 +480,9 @@ inline float toFloat(v8::Local<v8::Value> value)
// Convert a value to a double precision float, which might fail.
double toDouble(v8::Handle<v8::Value>, ExceptionState&);
+// Convert a value to a double precision float, throwing on non-finite values.
+double toRestrictedDouble(v8::Handle<v8::Value>, ExceptionState&);
+
// Converts a value to a String, throwing if any code unit is outside 0-255.
String toByteString(v8::Handle<v8::Value>, ExceptionState&);

Powered by Google App Engine
This is Rietveld 408576698