{% elif not attribute.is_static %}
{{cpp_class}}* impl = {{v8_class}}::toNative(holder);
{% endif %}
- {% if attribute.is_implemented_by and not attribute.is_static %}
+ {% if attribute.is_partial_interface_member and not attribute.is_static %}
+ {# instance members (non-static members) in partial interface take |impl| #}
ASSERT(impl);
{% endif %}
{% if interface_name == 'Window' and attribute.idl_type == 'EventHandler' %}
{% if attribute.is_call_with_execution_context %}
ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate());
{% endif %}
+ {% if attribute.is_call_with_script_state %}
+ ScriptState* state = ScriptState::current(info.GetIsolate());
+ {% endif %}
{% if attribute.is_check_security_for_node or
attribute.is_getter_raises_exception %}
ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.name}}", "{{interface_name}}", holder, info.GetIsolate());
{% endif %}
- {% if attribute.is_nullable %}
+ {% if attribute.is_nullable and not attribute.has_type_checking_nullable %}
bool isNull = false;
{% endif %}
{# FIXME: consider always using a local variable for value #}
| indent}}
{% endif %}
{% if attribute.is_nullable %}
+ {% if attribute.has_type_checking_nullable %}
+ if (!{{attribute.cpp_value}}) {
+ {% else %}
if (isNull) {
+ {% endif %}
v8SetReturnValueNull(info);
return;
}
UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::{{attribute.measure_as}});
{% endif %}
{% if world_suffix in attribute.activity_logging_world_list_for_getter %}
- V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext());
- if (contextData && contextData->activityLogger())
- contextData->activityLogger()->log("{{interface_name}}.{{attribute.name}}", 0, 0, "Getter");
+ DOMWrapperWorld& world = DOMWrapperWorld::current(info.GetIsolate());
+ if (world.activityLogger())
+ world.activityLogger()->logGetter("{{interface_name}}.{{attribute.name}}");
{% endif %}
{% if attribute.has_custom_getter %}
{{v8_class}}::{{attribute.name}}AttributeGetterCustom(info);
ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.name}}", "{{interface_name}}", holder, info.GetIsolate());
{% endif %}
{# Type checking #}
- {% if attribute.has_strict_type_checking %}
+ {% if attribute.has_type_checking_interface %}
{# Type checking for interface types (if interface not implemented, throw
TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
- if (!isUndefinedOrNull(v8Value) && !V8{{attribute.idl_type}}::hasInstance(v8Value, info.GetIsolate())) {
+ if ({% if attribute.is_nullable %}!isUndefinedOrNull(v8Value) && {% endif %}!V8{{attribute.idl_type}}::hasInstance(v8Value, info.GetIsolate())) {
exceptionState.throwTypeError("The provided value is not of type '{{attribute.idl_type}}'.");
exceptionState.throwIfNeeded();
return;
{# impl #}
{% if attribute.put_forwards %}
{{cpp_class}}* proxyImpl = {{v8_class}}::toNative(holder);
- {{attribute.ref_ptr}}<{{attribute.idl_type}}> impl = WTF::getPtr(proxyImpl->{{attribute.name}}());
+ {{attribute.cpp_type}} impl = WTF::getPtr(proxyImpl->{{attribute.name}}());
if (!impl)
return;
{% elif not attribute.is_static %}
{{cpp_class}}* impl = {{v8_class}}::toNative(holder);
{% endif %}
- {% if attribute.is_implemented_by and not attribute.is_static %}
+ {% if attribute.is_partial_interface_member and not attribute.is_static %}
+ {# instance members (non-static members) in partial interface take |impl| #}
ASSERT(impl);
{% endif %}
{% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %}
{% elif not is_node %}{# EventHandler hack #}
moveEventListenerToNewWrapper(holder, {{attribute.event_handler_getter_expression}}, v8Value, {{v8_class}}::eventListenerCacheIndex, info.GetIsolate());
{% endif %}
- {% if attribute.enum_validation_expression %}
- {# Setter ignores invalid enum values: http://www.w3.org/TR/WebIDL/#idl-enums #}
+ {# Type checking, possibly throw a TypeError, per:
+ http://www.w3.org/TR/WebIDL/#es-type-mapping #}
+ {% if attribute.has_type_checking_unrestricted %}
+ {# Non-finite floating point values (NaN, +Infinity or −Infinity), per:
+ http://heycam.github.io/webidl/#es-float
+ http://heycam.github.io/webidl/#es-double #}
+ if (!std::isfinite(cppValue)) {
+ exceptionState.throwTypeError("The provided {{attribute.idl_type}} value is non-finite.");
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ {% elif attribute.enum_validation_expression %}
+ {# Setter ignores invalid enum values:
+ http://www.w3.org/TR/WebIDL/#idl-enums #}
String string = cppValue;
if (!({{attribute.enum_validation_expression}}))
return;
UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::{{attribute.measure_as}});
{% endif %}
{% if world_suffix in attribute.activity_logging_world_list_for_setter %}
- V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext());
- if (contextData && contextData->activityLogger()) {
- v8::Handle<v8::Value> loggerArg[] = { v8Value };
- contextData->activityLogger()->log("{{interface_name}}.{{attribute.name}}", 1, &loggerArg[0], "Setter");
+ DOMWrapperWorld& world = DOMWrapperWorld::current(info.GetIsolate());
+ if (world.activityLogger()) {
+ {% if attribute.activity_logging_include_old_value_for_setter %}
+ {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
+ {% if attribute.cpp_value_original %}
+ {{attribute.cpp_type}} original = {{attribute.cpp_value_original}};
+ {% else %}
+ {{attribute.cpp_type}} original = {{attribute.cpp_value}};
+ {% endif %}
+ v8::Handle<v8::Value> originalValue = {{attribute.cpp_value_to_v8_value}};
+ world.activityLogger()->logSetter("{{interface_name}}.{{attribute.name}}", v8Value, originalValue);
+ {% else %}
+ world.activityLogger()->logSetter("{{interface_name}}.{{attribute.name}}", v8Value);
+ {% endif %}
}
{% endif %}
{% if attribute.is_custom_element_callbacks or attribute.is_reflect %}