| Index: Source/WebCore/bindings/dart/DartUtilities.cpp
|
| diff --git a/Source/WebCore/bindings/dart/DartUtilities.cpp b/Source/WebCore/bindings/dart/DartUtilities.cpp
|
| index f8f13329a9d6cc074554210895a07fcf7e33d5eb..c961b2e7f67f852a49778f4ec1c8e79c5ff20250 100644
|
| --- a/Source/WebCore/bindings/dart/DartUtilities.cpp
|
| +++ b/Source/WebCore/bindings/dart/DartUtilities.cpp
|
| @@ -125,6 +125,60 @@ struct IntegerTrait {
|
| }
|
| };
|
|
|
| +template <>
|
| +double DartUtilities::toNative<double>(Dart_Handle object)
|
| +{
|
| + return DartUtilities::toDouble(object);
|
| +}
|
| +
|
| +template <>
|
| +float DartUtilities::toNative<float>(Dart_Handle object)
|
| +{
|
| + return DartUtilities::toDouble(object);
|
| +}
|
| +
|
| +template <>
|
| +int8_t DartUtilities::toNative<int8_t>(Dart_Handle object)
|
| +{
|
| + return DartUtilities::toInteger(object);
|
| +}
|
| +
|
| +template <>
|
| +int16_t DartUtilities::toNative<int16_t>(Dart_Handle object)
|
| +{
|
| + return DartUtilities::toInteger(object);
|
| +}
|
| +
|
| +template <>
|
| +int32_t DartUtilities::toNative<int32_t>(Dart_Handle object)
|
| +{
|
| + return DartUtilities::toInteger(object);
|
| +}
|
| +
|
| +template <>
|
| +int64_t DartUtilities::toNative<int64_t>(Dart_Handle object)
|
| +{
|
| + return DartUtilities::toInteger(object);
|
| +}
|
| +
|
| +template <>
|
| +uint8_t DartUtilities::toNative<uint8_t>(Dart_Handle object)
|
| +{
|
| + return DartUtilities::toInteger(object);
|
| +}
|
| +
|
| +template <>
|
| +uint16_t DartUtilities::toNative<uint16_t>(Dart_Handle object)
|
| +{
|
| + return DartUtilities::toInteger(object);
|
| +}
|
| +
|
| +template <>
|
| +uint32_t DartUtilities::toNative<uint32_t>(Dart_Handle object)
|
| +{
|
| + return DartUtilities::toInteger(object);
|
| +}
|
| +
|
| int64_t DartUtilities::toInteger(Dart_Handle object, Dart_Handle& exception)
|
| {
|
| return convert<IntegerTrait>(object, exception);
|
| @@ -145,9 +199,11 @@ struct DoubleTrait {
|
| if (!Dart_IsNumber(object))
|
| return Dart_Error("the object !is Number");
|
|
|
| - object = Dart_InvokeDynamic(object, Dart_NewString("toDouble"), 0, 0);
|
| - if (Dart_IsError(object))
|
| - return object;
|
| + if (!Dart_IsDouble(object)) {
|
| + object = Dart_InvokeDynamic(object, Dart_NewString("toDouble"), 0, 0);
|
| + if (Dart_IsError(object))
|
| + return object;
|
| + }
|
|
|
| return Dart_DoubleValue(object, value);
|
| }
|
| @@ -245,11 +301,8 @@ void DartUtilities::toMessagePortArray(Dart_Handle value, MessagePortArray& port
|
| ASSERT(!Dart_IsError(dom));
|
|
|
| Dart_Handle asList = Dart_InvokeStatic(dom, Dart_NewString("Utils"), Dart_NewString("convertToList"), 1, &value);
|
| - if (Dart_IsError(asList)) {
|
| - DartUtilities::reportProblem(DartUtilities::scriptExecutionContext(), asList);
|
| - exception = DartDOMWrapper::exceptionCodeToDartException(INVALID_STATE_ERR);
|
| + if (!checkResult(asList, exception))
|
| return;
|
| - }
|
| ASSERT(Dart_IsList(asList));
|
|
|
| intptr_t length = 0;
|
| @@ -257,16 +310,12 @@ void DartUtilities::toMessagePortArray(Dart_Handle value, MessagePortArray& port
|
| portArray.resize(length);
|
| for (int i = 0; i < length; i++) {
|
| Dart_Handle element = Dart_ListGetAt(asList, i);
|
| - if (Dart_IsError(element)) {
|
| - exception = DartDOMWrapper::exceptionCodeToDartException(INVALID_STATE_ERR);
|
| + if (!checkResult(element, exception))
|
| return;
|
| - }
|
|
|
| MessagePort* messagePort = DartMessagePort::toNative(element, exception).get();
|
| - if (exception) {
|
| - exception = DartDOMWrapper::exceptionCodeToDartException(INVALID_STATE_ERR);
|
| + if (exception)
|
| return;
|
| - }
|
|
|
| ASSERT(messagePort);
|
| portArray[i] = messagePort;
|
|
|