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

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

Issue 1316833003: bindings: Support (deprecated) Dictionary in IDL dictionary (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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/testing/DictionaryTest.h » ('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 5acc96897e0395d1d42cbb15f89ab72d497a7f0d..c024c0de0fcd01db77e27d632dda42d32c710917 100644
--- a/Source/bindings/tests/results/core/V8TestDictionary.cpp
+++ b/Source/bindings/tests/results/core/V8TestDictionary.cpp
@@ -7,6 +7,7 @@
#include "config.h"
#include "V8TestDictionary.h"
+#include "bindings/core/v8/Dictionary.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ScriptValue.h"
#include "bindings/core/v8/UnionTypesCore.h"
@@ -103,6 +104,26 @@ void V8TestDictionary::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value
}
{
+ v8::Local<v8::Value> dictionaryMemberValue;
+ if (!v8Object->Get(isolate->GetCurrentContext(), v8String(isolate, "dictionaryMember")).ToLocal(&dictionaryMemberValue)) {
+ exceptionState.rethrowV8Exception(block.Exception());
+ return;
+ }
+ if (dictionaryMemberValue.IsEmpty() || dictionaryMemberValue->IsUndefined()) {
+ // Do nothing.
+ } else {
+ Dictionary dictionaryMember = Dictionary(dictionaryMemberValue, isolate, exceptionState);
+ if (exceptionState.hadException())
+ return;
+ if (!dictionaryMember.isObject()) {
+ exceptionState.throwTypeError("member dictionaryMember is not an object.");
+ return;
+ }
+ impl.setDictionaryMember(dictionaryMember);
+ }
+ }
+
+ {
v8::Local<v8::Value> doubleOrNullMemberValue;
if (!v8Object->Get(isolate->GetCurrentContext(), v8String(isolate, "doubleOrNullMember")).ToLocal(&doubleOrNullMemberValue)) {
exceptionState.rethrowV8Exception(block.Exception());
@@ -656,6 +677,12 @@ bool toV8TestDictionary(const TestDictionary& impl, v8::Local<v8::Object> dictio
return false;
}
+ if (impl.hasDictionaryMember()) {
+ ASSERT(impl.dictionaryMember().isObject());
+ if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext(), v8String(isolate, "dictionaryMember"), impl.dictionaryMember().v8Value())))
+ return false;
+ }
+
if (impl.hasDoubleOrNullMember()) {
if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext(), v8String(isolate, "doubleOrNullMember"), v8::Number::New(isolate, impl.doubleOrNullMember()))))
return false;
« no previous file with comments | « Source/bindings/tests/results/core/TestDictionary.h ('k') | Source/core/testing/DictionaryTest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698