Index: Source/bindings/templates/interface.cpp |
diff --git a/Source/bindings/templates/interface.cpp b/Source/bindings/templates/interface.cpp |
index 21272949c6b7b700e50c5964237c411e64ed70f4..902b522f2de7b586264b6551534d4ca54b46d518 100644 |
--- a/Source/bindings/templates/interface.cpp |
+++ b/Source/bindings/templates/interface.cpp |
@@ -582,18 +582,19 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
v8::Local<v8::Value> {{attribute.name}}; |
{% endfor %} |
{{cpp_class}}Init eventInit; |
- if (info.Length() >= 2) { |
- TONATIVE_VOID(Dictionary, options, Dictionary(info[1], info.GetIsolate())); |
- if (!initialize{{cpp_class}}(eventInit, options, exceptionState, info)) { |
+ if (info.Length() >= 2 && !info[1].IsEmpty() && info[1]->IsObject()) { |
+ PropertyBag bag(info.GetIsolate(), info[1]->ToObject(), exceptionState); |
+ if (!initialize{{cpp_class}}(eventInit, bag, exceptionState, info)) { |
exceptionState.throwIfNeeded(); |
return; |
} |
{# Store attributes of type |any| on the wrapper to avoid leaking them |
between isolated worlds. #} |
{% for attribute in any_type_attributes %} |
- options.get("{{attribute.name}}", {{attribute.name}}); |
- if (!{{attribute.name}}.IsEmpty()) |
+ if (bag.hasProperty("{{attribute.name}}")) { |
+ bag.convert("{{attribute.name}}", {{attribute.name}}); |
V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder(), v8AtomicString(info.GetIsolate(), "{{attribute.name}}"), {{attribute.name}}); |
+ } |
{% endfor %} |
} |
{% if is_constructor_raises_exception %} |
@@ -731,27 +732,27 @@ static const V8DOMConfiguration::MethodConfiguration {{v8_class}}Methods[] = { |
{##############################################################################} |
{% block initialize_event %} |
{% if has_event_constructor %} |
-bool initialize{{cpp_class}}({{cpp_class}}Init& eventInit, const Dictionary& options, ExceptionState& exceptionState, const v8::FunctionCallbackInfo<v8::Value>& info, const String& forEventName) |
+bool initialize{{cpp_class}}({{cpp_class}}Init& eventInit, const PropertyBag& bag, ExceptionState& exceptionState, const v8::FunctionCallbackInfo<v8::Value>& info, const String& forEventName) |
{ |
- Dictionary::ConversionContext conversionContext(forEventName.isEmpty() ? String("{{interface_name}}") : forEventName, "", exceptionState); |
+ EventInitInitializer initializer(forEventName.isEmpty() ? String("{{interface_name}}") : forEventName, bag, exceptionState); |
{% if parent_interface %}{# any Event interface except Event itself #} |
- if (!initialize{{parent_interface}}(eventInit, options, exceptionState, info, forEventName.isEmpty() ? String("{{interface_name}}") : forEventName)) |
+ if (!initialize{{parent_interface}}(eventInit, bag, exceptionState, info, forEventName.isEmpty() ? String("{{interface_name}}") : forEventName)) |
return false; |
{% endif %} |
{% for attribute in attributes |
if (attribute.is_initialized_by_event_constructor and |
not attribute.idl_type == 'any')%} |
- {% set is_nullable = 'true' if attribute.is_nullable else 'false' %} |
+ {% set is_nullable = 'PropertyBag::IsNullable' if attribute.is_nullable else 'PropertyBag::IsNotNullable' %} |
{% if attribute.deprecate_as %} |
- if (DictionaryHelper::convert(options, conversionContext.setConversionType("{{attribute.idl_type}}", {{is_nullable}}), "{{attribute.name}}", eventInit.{{attribute.cpp_name}})) { |
- if (options.hasProperty("{{attribute.name}}")) |
+ if (initializer.initializeProperty("{{attribute.name}}", eventInit.{{attribute.cpp_name}}, "{{attribute.idl_type}}", {{is_nullable}})) { |
+ if (bag.hasProperty("{{attribute.name}}")) |
UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}}); |
} else { |
return false; |
} |
{% else %} |
- if (!DictionaryHelper::convert(options, conversionContext.setConversionType("{{attribute.idl_type}}", {{is_nullable}}), "{{attribute.name}}", eventInit.{{attribute.cpp_name}})) |
+ if (!initializer.initializeProperty("{{attribute.name}}", eventInit.{{attribute.cpp_name}}, "{{attribute.idl_type}}", {{is_nullable}})) |
return false; |
{% endif %} |
{% endfor %} |