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

Unified Diff: Source/bindings/tests/results/V8TestExtendedEvent.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/V8TestExtendedEvent.cpp
diff --git a/Source/bindings/tests/results/V8TestExtendedEvent.cpp b/Source/bindings/tests/results/V8TestExtendedEvent.cpp
index 1f757e4396b575f56fc23a3e41bc15933680b154..2e6ec397fc4ffddd7970148b853ddec087e2d84d 100644
--- a/Source/bindings/tests/results/V8TestExtendedEvent.cpp
+++ b/Source/bindings/tests/results/V8TestExtendedEvent.cpp
@@ -115,10 +115,12 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
EventInit eventInit;
if (info.Length() >= 2) {
V8TRYCATCH_VOID(Dictionary, options, Dictionary(info[1], info.GetIsolate()));
- if (!fillEventInit(eventInit, options))
+ ExceptionState exceptionState(info.Holder(), info.GetIsolate());
+ if (!fillEventInit(eventInit, options, exceptionState)) {
+ exceptionState.throwIfNeeded();
return;
+ }
}
-
RefPtr<Event> event = Event::create(type, eventInit);
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestExtendedEvent>(event.release(), &V8TestExtendedEvent::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent);
@@ -131,14 +133,20 @@ static const V8DOMConfiguration::AttributeConfiguration V8TestExtendedEventAttri
{"keyLocation", EventV8Internal::keyLocationAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
};
-bool fillEventInit(EventInit& eventInit, const Dictionary& options)
+bool fillEventInit(EventInit& eventInit, const Dictionary& options, ExceptionState& exceptionState, const String& forEventName)
{
- if (!fillTestEventInit(eventInit, options))
+ Dictionary::ConversionContext conversionContext(forEventName.isEmpty() ? String("TestExtendedEvent") : forEventName, "", exceptionState);
+ if (!fillTestEventInit(eventInit, options, exceptionState, forEventName.isEmpty() ? String("TestExtendedEvent") : forEventName))
return false;
- options.get("location", eventInit.location);
- if (options.get("keyLocation", eventInit.location))
- UseCounter::countDeprecation(activeExecutionContext(), UseCounter::KeyboardEventKeyLocation);
+ if (!options.convert(conversionContext.withAttributes(false, NormalConversion), "location", eventInit.location))
+ return false;
+ if (options.convert(conversionContext.withAttributes(false, NormalConversion), "keyLocation", eventInit.location)) {
+ if (options.hasProperty("keyLocation"))
+ UseCounter::countDeprecation(activeExecutionContext(), UseCounter::KeyboardEventKeyLocation);
+ } else {
+ return false;
+ }
return true;
}

Powered by Google App Engine
This is Rietveld 408576698