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

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

Issue 1057453002: bindings: Throw TypeError when required dictionary member is undefined (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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/V8TestDictionaryDerived.cpp
diff --git a/Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp b/Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp
index 95eee379d586117f4fdb7b2ca033ee9cc9579bab..2a5806113b7829d8ad260387f2a74cfb671d2ee5 100644
--- a/Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp
+++ b/Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp
@@ -55,6 +55,21 @@ void V8TestDictionaryDerivedImplementedAs::toImpl(v8::Isolate* isolate, v8::Loca
impl.setDerivedStringMemberWithDefault(derivedStringMemberWithDefault);
}
+ v8::Local<v8::Value> requiredLongMemberValue = v8Object->Get(v8String(isolate, "requiredLongMember"));
+ if (block.HasCaught()) {
+ exceptionState.rethrowV8Exception(block.Exception());
+ return;
+ }
+ if (requiredLongMemberValue.IsEmpty() || requiredLongMemberValue->IsUndefined()) {
+ exceptionState.throwTypeError("required member requiredLongMember is undefined.");
+ return;
+ } else {
+ int requiredLongMember = toInt32(isolate, requiredLongMemberValue, NormalConversion, exceptionState);
+ if (exceptionState.hadException())
+ return;
+ impl.setRequiredLongMember(requiredLongMember);
+ }
+
}
v8::Local<v8::Value> toV8(const TestDictionaryDerivedImplementedAs& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
@@ -77,6 +92,12 @@ void toV8TestDictionaryDerivedImplementedAs(const TestDictionaryDerivedImplement
dictionary->Set(v8String(isolate, "derivedStringMemberWithDefault"), v8String(isolate, String("default string value")));
}
+ if (impl.hasRequiredLongMember()) {
+ dictionary->Set(v8String(isolate, "requiredLongMember"), v8::Integer::New(isolate, impl.requiredLongMember()));
+ } else {
+ ASSERT_NOT_REACHED();
+ }
+
}
TestDictionaryDerivedImplementedAs NativeValueTraits<TestDictionaryDerivedImplementedAs>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
« no previous file with comments | « Source/bindings/tests/results/core/TestDictionaryDerivedImplementedAs.h ('k') | Source/core/testing/DictionaryTest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698