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

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

Issue 937773002: IDL: Support default values for dictionary members of union types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 d9c57e363498e24ce4a0517a62f78941d9d9c35f..70e599ef997c57c070221fdb26795c9dcac46c96 100644
--- a/Source/bindings/tests/results/core/V8TestDictionary.cpp
+++ b/Source/bindings/tests/results/core/V8TestDictionary.cpp
@@ -206,6 +206,19 @@ void V8TestDictionary::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value
impl.setObjectOrNullMember(objectOrNullMember);
}
+ v8::Local<v8::Value> otherDoubleOrStringMemberValue = v8Object->Get(v8String(isolate, "otherDoubleOrStringMember"));
+ if (block.HasCaught()) {
+ exceptionState.rethrowV8Exception(block.Exception());
+ return;
+ }
+ if (otherDoubleOrStringMemberValue.IsEmpty() || otherDoubleOrStringMemberValue->IsUndefined()) {
+ // Do nothing.
+ } else {
+ DoubleOrString otherDoubleOrStringMember;
+ TONATIVE_VOID_EXCEPTIONSTATE_ARGINTERNAL(V8DoubleOrString::toImpl(isolate, otherDoubleOrStringMemberValue, otherDoubleOrStringMember, exceptionState), exceptionState);
+ impl.setOtherDoubleOrStringMember(otherDoubleOrStringMember);
+ }
+
v8::Local<v8::Value> restrictedDoubleMemberValue = v8Object->Get(v8String(isolate, "restrictedDoubleMember"));
if (block.HasCaught()) {
exceptionState.rethrowV8Exception(block.Exception());
@@ -442,6 +455,8 @@ void toV8TestDictionary(const TestDictionary& impl, v8::Local<v8::Object> dictio
if (impl.hasDoubleOrStringMember()) {
dictionary->Set(v8String(isolate, "doubleOrStringMember"), toV8(impl.doubleOrStringMember(), creationContext, isolate));
+ } else {
+ dictionary->Set(v8String(isolate, "doubleOrStringMember"), toV8(DoubleOrString::fromDouble(3.14), creationContext, isolate));
}
if (impl.hasElementOrNullMember()) {
@@ -478,6 +493,12 @@ void toV8TestDictionary(const TestDictionary& impl, v8::Local<v8::Object> dictio
dictionary->Set(v8String(isolate, "objectOrNullMember"), impl.objectOrNullMember().v8Value());
}
+ if (impl.hasOtherDoubleOrStringMember()) {
+ dictionary->Set(v8String(isolate, "otherDoubleOrStringMember"), toV8(impl.otherDoubleOrStringMember(), creationContext, isolate));
+ } else {
+ dictionary->Set(v8String(isolate, "otherDoubleOrStringMember"), toV8(DoubleOrString::fromString(String("default string value")), creationContext, isolate));
+ }
+
if (impl.hasRestrictedDoubleMember()) {
dictionary->Set(v8String(isolate, "restrictedDoubleMember"), v8::Number::New(isolate, impl.restrictedDoubleMember()));
} else {

Powered by Google App Engine
This is Rietveld 408576698