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

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
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..bf2bf3ed0dc32375af38e0d21d1f2f182625da5d 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,11 @@ bool toV8TestDictionary(const TestDictionary& impl, v8::Local<v8::Object> dictio
return false;
}
+ if (impl.hasDictionaryMember()) {
+ 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;

Powered by Google App Engine
This is Rietveld 408576698