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

Unified Diff: Source/bindings/tests/results/core/V8TestDictionary.cpp

Issue 860353002: IDL: Add toRestricted{Float,Double}() helpers to V8Binding.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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/tests/results/core/V8TestDictionary.cpp
diff --git a/Source/bindings/tests/results/core/V8TestDictionary.cpp b/Source/bindings/tests/results/core/V8TestDictionary.cpp
index ecd5f24b9697fdc37aec2c673a0562a69d6062b0..30d7e02a768499ffa21887dc4fc771123c7af54b 100644
--- a/Source/bindings/tests/results/core/V8TestDictionary.cpp
+++ b/Source/bindings/tests/results/core/V8TestDictionary.cpp
@@ -80,7 +80,7 @@ void V8TestDictionary::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value
} else if (doubleOrNullMemberValue->IsNull()) {
impl.setDoubleOrNullMemberToNull();
} else {
- TONATIVE_VOID_EXCEPTIONSTATE(double, doubleOrNullMember, toDouble(doubleOrNullMemberValue, exceptionState), exceptionState);
+ TONATIVE_VOID_EXCEPTIONSTATE(double, doubleOrNullMember, toRestrictedDouble(doubleOrNullMemberValue, exceptionState), exceptionState);
impl.setDoubleOrNullMember(doubleOrNullMember);
}
@@ -387,6 +387,18 @@ void V8TestDictionary::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value
impl.setUint8ArrayMember(uint8ArrayMember);
}
+ v8::Local<v8::Value> unrestrictedDoubleMemberValue = v8Object->Get(v8String(isolate, "unrestrictedDoubleMember"));
+ if (block.HasCaught()) {
+ exceptionState.rethrowV8Exception(block.Exception());
+ return;
+ }
+ if (unrestrictedDoubleMemberValue.IsEmpty() || unrestrictedDoubleMemberValue->IsUndefined()) {
+ // Do nothing.
+ } else {
+ TONATIVE_VOID_EXCEPTIONSTATE(double, unrestrictedDoubleMember, toDouble(unrestrictedDoubleMemberValue, exceptionState), exceptionState);
+ impl.setUnrestrictedDoubleMember(unrestrictedDoubleMember);
+ }
+
}
v8::Local<v8::Value> toV8(const TestDictionary& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
@@ -504,6 +516,12 @@ void toV8TestDictionary(const TestDictionary& impl, v8::Local<v8::Object> dictio
dictionary->Set(v8String(isolate, "uint8ArrayMember"), toV8(impl.uint8ArrayMember(), creationContext, isolate));
}
+ if (impl.hasUnrestrictedDoubleMember()) {
+ dictionary->Set(v8String(isolate, "unrestrictedDoubleMember"), v8::Number::New(isolate, impl.unrestrictedDoubleMember()));
+ } else {
+ dictionary->Set(v8String(isolate, "unrestrictedDoubleMember"), v8::Number::New(isolate, 3.14));
+ }
+
}
TestDictionary NativeValueTraits<TestDictionary>::nativeValue(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)

Powered by Google App Engine
This is Rietveld 408576698