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

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

Issue 121113004: Improve handling of failed integer type conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 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
« no previous file with comments | « Source/bindings/v8/ExceptionState.cpp ('k') | Source/bindings/v8/V8Binding.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/V8Binding.h
diff --git a/Source/bindings/v8/V8Binding.h b/Source/bindings/v8/V8Binding.h
index 0dce307d76318c7b7573c94fc0e5dd8000b2e5ed..684e1f743ec0340cba1f95ebfe206cd006c70f15 100644
--- a/Source/bindings/v8/V8Binding.h
+++ b/Source/bindings/v8/V8Binding.h
@@ -47,6 +47,7 @@ namespace WebCore {
class DOMWindow;
class Document;
+ class ExceptionState;
class Frame;
class NodeFilter;
class ExecutionContext;
@@ -297,105 +298,103 @@ namespace WebCore {
// Convert a value to a 8-bit signed integer. The conversion fails if the
// value cannot be converted to a number or the range violated per WebIDL:
// http://www.w3.org/TR/WebIDL/#es-byte
- int8_t toInt8(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& ok);
- inline int8_t toInt8(v8::Handle<v8::Value> value, bool& ok) { return toInt8(value, NormalConversion, ok); }
-
- // Convert a value to a 8-bit integer assuming the conversion cannot fail.
- inline int8_t toInt8(v8::Handle<v8::Value> value)
+ int8_t toInt8(v8::Handle<v8::Value>, IntegerConversionConfiguration, ExceptionState&);
+ inline int8_t toInt8(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
{
- bool ok;
- return toInt8(value, NormalConversion, ok);
+ return toInt8(value, NormalConversion, exceptionState);
}
+ // Convert a value to a 8-bit integer assuming the conversion cannot fail.
+ int8_t toInt8(v8::Handle<v8::Value>);
+
// Convert a value to a 8-bit unsigned integer. The conversion fails if the
// value cannot be converted to a number or the range violated per WebIDL:
// http://www.w3.org/TR/WebIDL/#es-octet
- uint8_t toUInt8(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& ok);
- inline uint8_t toUInt8(v8::Handle<v8::Value> value, bool& ok) { return toUInt8(value, NormalConversion, ok); }
-
- // Convert a value to a 8-bit unsigned integer assuming the conversion cannot fail.
- inline uint8_t toUInt8(v8::Handle<v8::Value> value)
+ uint8_t toUInt8(v8::Handle<v8::Value>, IntegerConversionConfiguration, ExceptionState&);
+ inline uint8_t toUInt8(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
{
- bool ok;
- return toUInt8(value, NormalConversion, ok);
+ return toUInt8(value, NormalConversion, exceptionState);
}
+ // Convert a value to a 8-bit unsigned integer assuming the conversion cannot fail.
+ uint8_t toUInt8(v8::Handle<v8::Value>);
+
// Convert a value to a 16-bit signed integer. The conversion fails if the
// value cannot be converted to a number or the range violated per WebIDL:
// http://www.w3.org/TR/WebIDL/#es-short
- int16_t toInt16(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& ok);
- inline int16_t toInt16(v8::Handle<v8::Value> value, bool& ok) { return toInt16(value, NormalConversion, ok); }
-
- // Convert a value to a 16-bit integer assuming the conversion cannot fail.
- inline int16_t toInt16(v8::Handle<v8::Value> value)
+ int16_t toInt16(v8::Handle<v8::Value>, IntegerConversionConfiguration, ExceptionState&);
+ inline int16_t toInt16(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
{
- bool ok;
- return toInt16(value, NormalConversion, ok);
+ return toInt16(value, NormalConversion, exceptionState);
}
+ // Convert a value to a 16-bit integer assuming the conversion cannot fail.
+ int16_t toInt16(v8::Handle<v8::Value>);
+
// Convert a value to a 16-bit unsigned integer. The conversion fails if the
// value cannot be converted to a number or the range violated per WebIDL:
// http://www.w3.org/TR/WebIDL/#es-unsigned-short
- uint16_t toUInt16(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& ok);
- inline uint16_t toUInt16(v8::Handle<v8::Value> value, bool& ok) { return toUInt16(value, NormalConversion, ok); }
-
- // Convert a value to a 16-bit unsigned integer assuming the conversion cannot fail.
- inline uint16_t toUInt16(v8::Handle<v8::Value> value)
+ uint16_t toUInt16(v8::Handle<v8::Value>, IntegerConversionConfiguration, ExceptionState&);
+ inline uint16_t toUInt16(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
{
- bool ok;
- return toUInt16(value, NormalConversion, ok);
+ return toUInt16(value, NormalConversion, exceptionState);
}
+ // Convert a value to a 16-bit unsigned integer assuming the conversion cannot fail.
+ uint16_t toUInt16(v8::Handle<v8::Value>);
+
// Convert a value to a 32-bit signed integer. The conversion fails if the
// value cannot be converted to a number or the range violated per WebIDL:
// http://www.w3.org/TR/WebIDL/#es-long
- int32_t toInt32(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& ok);
- inline int32_t toInt32(v8::Handle<v8::Value> value, bool& ok) { return toInt32(value, NormalConversion, ok); }
-
- // Convert a value to a 32-bit integer assuming the conversion cannot fail.
- inline int32_t toInt32(v8::Handle<v8::Value> value)
+ int32_t toInt32(v8::Handle<v8::Value>, IntegerConversionConfiguration, ExceptionState&);
+ inline int32_t toInt32(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
{
- bool ok;
- return toInt32(value, NormalConversion, ok);
+ return toInt32(value, NormalConversion, exceptionState);
}
+ // Convert a value to a 32-bit integer assuming the conversion cannot fail.
+ int32_t toInt32(v8::Handle<v8::Value>);
+
// Convert a value to a 32-bit unsigned integer. The conversion fails if the
// value cannot be converted to a number or the range violated per WebIDL:
// http://www.w3.org/TR/WebIDL/#es-unsigned-long
- uint32_t toUInt32(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& ok);
- inline uint32_t toUInt32(v8::Handle<v8::Value> value, bool& ok) { return toUInt32(value, NormalConversion, ok); }
-
- // Convert a value to a 32-bit unsigned integer assuming the conversion cannot fail.
- inline uint32_t toUInt32(v8::Handle<v8::Value> value)
+ uint32_t toUInt32(v8::Handle<v8::Value>, IntegerConversionConfiguration, ExceptionState&);
+ inline uint32_t toUInt32(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
{
- bool ok;
- return toUInt32(value, NormalConversion, ok);
+ return toUInt32(value, NormalConversion, exceptionState);
}
+ // Convert a value to a 32-bit unsigned integer assuming the conversion cannot fail.
+ uint32_t toUInt32(v8::Handle<v8::Value>);
+
// Convert a value to a 64-bit signed integer. The conversion fails if the
// value cannot be converted to a number or the range violated per WebIDL:
// http://www.w3.org/TR/WebIDL/#es-long-long
- int64_t toInt64(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& ok);
-
- // Convert a value to a 64-bit integer assuming the conversion cannot fail.
- inline int64_t toInt64(v8::Handle<v8::Value> value)
+ int64_t toInt64(v8::Handle<v8::Value>, IntegerConversionConfiguration, ExceptionState&);
+ inline int64_t toInt64(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
{
- bool ok;
- return toInt64(value, NormalConversion, ok);
+ return toInt64(value, NormalConversion, exceptionState);
}
+ // Convert a value to a 64-bit integer assuming the conversion cannot fail.
+ int64_t toInt64(v8::Handle<v8::Value>);
+
// Convert a value to a 64-bit unsigned integer. The conversion fails if the
// value cannot be converted to a number or the range violated per WebIDL:
// http://www.w3.org/TR/WebIDL/#es-unsigned-long-long
- uint64_t toUInt64(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& ok);
-
- // Convert a value to a 64-bit unsigned integer assuming the conversion cannot fail.
- inline uint64_t toUInt64(v8::Handle<v8::Value> value)
+ uint64_t toUInt64(v8::Handle<v8::Value>, IntegerConversionConfiguration, ExceptionState&);
+ inline uint64_t toUInt64(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
{
- bool ok;
- return toUInt64(value, NormalConversion, ok);
+ return toUInt64(value, NormalConversion, exceptionState);
}
+ // Convert a value to a 64-bit unsigned integer assuming the conversion cannot fail.
+ 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 assuming the conversion cannot fail.
inline float toFloat(v8::Local<v8::Value> value)
{
return static_cast<float>(value->NumberValue());
« no previous file with comments | « Source/bindings/v8/ExceptionState.cpp ('k') | Source/bindings/v8/V8Binding.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698