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

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

Issue 1130763006: IDL: Add any support to IDL dictionary and use it in CustomEventInit (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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/tests/results/core/TestDictionary.h ('k') | Source/core/core.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4200626e6d9a673f0b7bdff5965e982c8782e56a..c740cc47bd13de0c334af33ef557d389ba5b494a 100644
--- a/Source/bindings/tests/results/core/V8TestDictionary.cpp
+++ b/Source/bindings/tests/results/core/V8TestDictionary.cpp
@@ -38,6 +38,20 @@ void V8TestDictionary::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value
return;
}
{
+ v8::Local<v8::Value> anyMemberValue;
+ if (!v8Object->Get(isolate->GetCurrentContext(), v8String(isolate, "anyMember")).ToLocal(&anyMemberValue)) {
+ exceptionState.rethrowV8Exception(block.Exception());
+ return;
+ }
+ if (anyMemberValue.IsEmpty() || anyMemberValue->IsUndefined()) {
+ // Do nothing.
+ } else {
+ ScriptValue anyMember = ScriptValue(ScriptState::current(isolate), anyMemberValue);
+ impl.setAnyMember(anyMember);
+ }
+ }
+
+ {
v8::Local<v8::Value> booleanMemberValue;
if (!v8Object->Get(isolate->GetCurrentContext(), v8String(isolate, "booleanMember")).ToLocal(&booleanMemberValue)) {
exceptionState.rethrowV8Exception(block.Exception());
@@ -554,6 +568,14 @@ v8::Local<v8::Value> toV8(const TestDictionary& impl, v8::Local<v8::Object> crea
bool toV8TestDictionary(const TestDictionary& impl, v8::Local<v8::Object> dictionary, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
{
// TODO(bashi): Use ForceSet() instead of Set(). http://crbug.com/476720
+ if (impl.hasAnyMember()) {
+ if (!v8CallBoolean(dictionary->Set(isolate->GetCurrentContext(), v8String(isolate, "anyMember"), impl.anyMember().v8Value())))
+ return false;
+ } else {
+ if (!v8CallBoolean(dictionary->Set(isolate->GetCurrentContext(), v8String(isolate, "anyMember"), v8::Null(isolate))))
+ return false;
+ }
+
if (impl.hasBooleanMember()) {
if (!v8CallBoolean(dictionary->Set(isolate->GetCurrentContext(), v8String(isolate, "booleanMember"), v8Boolean(impl.booleanMember(), isolate))))
return false;
« no previous file with comments | « Source/bindings/tests/results/core/TestDictionary.h ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698