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

Unified Diff: Source/bindings/tests/results/V8TestEventConstructor.cpp

Issue 85263002: Improve handling of dictionary conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Have conversion methods take a context argument; elaborate error msgs further. Created 7 years, 1 month 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/V8TestEventConstructor.cpp
diff --git a/Source/bindings/tests/results/V8TestEventConstructor.cpp b/Source/bindings/tests/results/V8TestEventConstructor.cpp
index e7c97a0be477762f39b6330e47a6fc8687d80f68..bd3a86730bfd3b89e8316a41c4d28c9ceec19edd 100644
--- a/Source/bindings/tests/results/V8TestEventConstructor.cpp
+++ b/Source/bindings/tests/results/V8TestEventConstructor.cpp
@@ -111,10 +111,12 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
TestEventConstructorInit eventInit;
if (info.Length() >= 2) {
V8TRYCATCH_VOID(Dictionary, options, Dictionary(info[1], info.GetIsolate()));
- if (!fillTestEventConstructorInit(eventInit, options))
+ ExceptionState exceptionState(info.Holder(), info.GetIsolate());
+ if (!fillTestEventConstructorInit(eventInit, options, exceptionState)) {
+ exceptionState.throwIfNeeded();
return;
+ }
}
-
RefPtr<TestEventConstructor> event = TestEventConstructor::create(type, eventInit);
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestEventConstructor>(event.release(), &V8TestEventConstructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent);
@@ -127,9 +129,11 @@ static const V8DOMConfiguration::AttributeConfiguration V8TestEventConstructorAt
{"attr2", TestEventConstructorV8Internal::attr2AttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
};
-bool fillTestEventConstructorInit(TestEventConstructorInit& eventInit, const Dictionary& options)
+bool fillTestEventConstructorInit(TestEventConstructorInit& eventInit, const Dictionary& options, ExceptionState& exceptionState, const String& forEventName)
{
- options.get("attr2", eventInit.attr2);
+ Dictionary::ConversionContext conversionContext(forEventName.isEmpty() ? String("TestEventConstructor") : forEventName, "", exceptionState);
+ if (!options.convert(conversionContext, "attr2", eventInit.attr2))
+ return false;
return true;
}

Powered by Google App Engine
This is Rietveld 408576698