| Index: third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl
|
| diff --git a/third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl
|
| index 634910bded1901de56b61201e87020d81099dca7..773c3dae2a32a2e6ff080e5169542c033cec86c3 100644
|
| --- a/third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl
|
| +++ b/third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl
|
| @@ -13,32 +13,31 @@
|
| {% block indexed_property_getter %}
|
| {% if indexed_property_getter and not indexed_property_getter.is_custom %}
|
| {% set getter = indexed_property_getter %}
|
| -static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - {% if getter.is_raises_exception %}
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedGetterContext, "{{interface_name}}");
|
| - {% endif %}
|
| -
|
| - {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| -
|
| - // We assume that all the implementations support length() method, although
|
| - // the spec doesn't require that length() must exist. It's okay that
|
| - // the interface does not have length attribute as long as the
|
| - // implementation supports length() member function.
|
| - if (index >= impl->length())
|
| - return; // Returns undefined due to out-of-range.
|
| -
|
| - {% set getter_name = getter.name or 'anonymousIndexedGetter' %}
|
| - {% set getter_arguments = ['index'] %}
|
| - {% if getter.is_call_with_script_state %}
|
| - ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| - {% set getter_arguments = ['scriptState'] + getter_arguments %}
|
| - {% endif %}
|
| - {% if getter.is_raises_exception %}
|
| - {% set getter_arguments = getter_arguments + ['exceptionState'] %}
|
| - {% endif %}
|
| - {{getter.cpp_type}} result = impl->{{getter_name}}({{getter_arguments | join(', ')}});
|
| - {{getter.v8_set_return_value}};
|
| +static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + {% if getter.is_raises_exception %}
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedGetterContext, "{{interface_name}}");
|
| + {% endif %}
|
| +
|
| + {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| +
|
| + // We assume that all the implementations support length() method, although
|
| + // the spec doesn't require that length() must exist. It's okay that
|
| + // the interface does not have length attribute as long as the
|
| + // implementation supports length() member function.
|
| + if (index >= impl->length())
|
| + return; // Returns undefined due to out-of-range.
|
| +
|
| + {% set getter_name = getter.name or 'anonymousIndexedGetter' %}
|
| + {% set getter_arguments = ['index'] %}
|
| + {% if getter.is_call_with_script_state %}
|
| + ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| + {% set getter_arguments = ['scriptState'] + getter_arguments %}
|
| + {% endif %}
|
| + {% if getter.is_raises_exception %}
|
| + {% set getter_arguments = getter_arguments + ['exceptionState'] %}
|
| + {% endif %}
|
| + {{getter.cpp_type}} result = impl->{{getter_name}}({{getter_arguments | join(', ')}});
|
| + {{getter.v8_set_return_value}};
|
| }
|
|
|
| {% endif %}
|
| @@ -49,27 +48,26 @@ static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
|
| {% block indexed_property_getter_callback %}
|
| {% if indexed_property_getter or named_property_getter %}
|
| {% set getter = indexed_property_getter or named_property_getter %}
|
| -void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - {% if indexed_property_getter %}
|
| +void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + {% if indexed_property_getter %}
|
|
|
| - {% if getter.is_custom %}
|
| - {{v8_class}}::indexedPropertyGetterCustom(index, info);
|
| - {% else %}
|
| - {{cpp_class}}V8Internal::indexedPropertyGetter(index, info);
|
| - {% endif %}
|
| + {% if getter.is_custom %}
|
| + {{v8_class}}::indexedPropertyGetterCustom(index, info);
|
| + {% else %}
|
| + {{cpp_class}}V8Internal::indexedPropertyGetter(index, info);
|
| + {% endif %}
|
|
|
| - {% else %}{# otherwise, named property #}
|
| + {% else %}{# otherwise, named property #}
|
|
|
| - const AtomicString& propertyName = AtomicString::number(index);
|
| + const AtomicString& propertyName = AtomicString::number(index);
|
|
|
| - {% if getter.is_custom %}
|
| - {{v8_class}}::namedPropertyGetterCustom(propertyName, info);
|
| - {% else %}
|
| - {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info);
|
| - {% endif %}
|
| + {% if getter.is_custom %}
|
| + {{v8_class}}::namedPropertyGetterCustom(propertyName, info);
|
| + {% else %}
|
| + {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info);
|
| + {% endif %}
|
|
|
| - {% endif %}{# indexed_property_getter #}
|
| + {% endif %}{# indexed_property_getter #}
|
| }
|
|
|
| {% endif %}
|
| @@ -81,40 +79,39 @@ void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInf
|
| {% from 'utilities.cpp.tmpl' import v8_value_to_local_cpp_value %}
|
| {% if indexed_property_setter and not indexed_property_setter.is_custom %}
|
| {% set setter = indexed_property_setter %}
|
| -static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - {% if setter.has_exception_state %}
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedSetterContext, "{{interface_name}}");
|
| - {% endif %}
|
| -
|
| - {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| - {{v8_value_to_local_cpp_value(setter) | indent}}
|
| - {% if setter.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 (!propertyValue{% if setter.is_nullable %} && !isUndefinedOrNull(v8Value){% endif %}) {
|
| - exceptionState.throwTypeError("The provided value is not of type '{{setter.idl_type}}'.");
|
| - return;
|
| - }
|
| - {% endif %}
|
| -
|
| - {% set setter_name = setter.name or 'anonymousIndexedSetter' %}
|
| - {% set setter_arguments = ['index', 'propertyValue'] %}
|
| - {% if setter.is_call_with_script_state %}
|
| - ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| - {% set setter_arguments = ['scriptState'] + setter_arguments %}
|
| - {% endif %}
|
| - {% if setter.is_raises_exception %}
|
| - {% set setter_arguments = setter_arguments + ['exceptionState'] %}
|
| - {% endif %}
|
| - bool result = impl->{{setter_name}}({{setter_arguments | join(', ')}});
|
| - {% if setter.is_raises_exception %}
|
| - if (exceptionState.hadException())
|
| - return;
|
| - {% endif %}
|
| - if (!result)
|
| - return;
|
| - v8SetReturnValue(info, v8Value);
|
| +static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + {% if setter.has_exception_state %}
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedSetterContext, "{{interface_name}}");
|
| + {% endif %}
|
| +
|
| + {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| + {{v8_value_to_local_cpp_value(setter) | indent(2)}}
|
| + {% if setter.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 (!propertyValue{% if setter.is_nullable %} && !isUndefinedOrNull(v8Value){% endif %}) {
|
| + exceptionState.throwTypeError("The provided value is not of type '{{setter.idl_type}}'.");
|
| + return;
|
| + }
|
| + {% endif %}
|
| +
|
| + {% set setter_name = setter.name or 'anonymousIndexedSetter' %}
|
| + {% set setter_arguments = ['index', 'propertyValue'] %}
|
| + {% if setter.is_call_with_script_state %}
|
| + ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| + {% set setter_arguments = ['scriptState'] + setter_arguments %}
|
| + {% endif %}
|
| + {% if setter.is_raises_exception %}
|
| + {% set setter_arguments = setter_arguments + ['exceptionState'] %}
|
| + {% endif %}
|
| + bool result = impl->{{setter_name}}({{setter_arguments | join(', ')}});
|
| + {% if setter.is_raises_exception %}
|
| + if (exceptionState.hadException())
|
| + return;
|
| + {% endif %}
|
| + if (!result)
|
| + return;
|
| + v8SetReturnValue(info, v8Value);
|
| }
|
|
|
| {% endif %}
|
| @@ -125,31 +122,30 @@ static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value,
|
| {% block indexed_property_setter_callback %}
|
| {% if indexed_property_setter or named_property_setter %}
|
| {% set setter = indexed_property_setter or named_property_setter %}
|
| -void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - {% if setter.is_ce_reactions %}
|
| - CEReactionsScope ceReactionsScope;
|
| - {% endif %}
|
| +void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + {% if setter.is_ce_reactions %}
|
| + CEReactionsScope ceReactionsScope;
|
| + {% endif %}
|
|
|
| - {% if indexed_property_setter %}
|
| + {% if indexed_property_setter %}
|
|
|
| - {% if setter.is_custom %}
|
| - {{v8_class}}::indexedPropertySetterCustom(index, v8Value, info);
|
| - {% else %}
|
| - {{cpp_class}}V8Internal::indexedPropertySetter(index, v8Value, info);
|
| - {% endif %}
|
| + {% if setter.is_custom %}
|
| + {{v8_class}}::indexedPropertySetterCustom(index, v8Value, info);
|
| + {% else %}
|
| + {{cpp_class}}V8Internal::indexedPropertySetter(index, v8Value, info);
|
| + {% endif %}
|
|
|
| - {% else %}{# otherwise, named property #}
|
| + {% else %}{# otherwise, named property #}
|
|
|
| - const AtomicString& propertyName = AtomicString::number(index);
|
| + const AtomicString& propertyName = AtomicString::number(index);
|
|
|
| - {% if setter.is_custom %}
|
| - {{v8_class}}::namedPropertySetterCustom(propertyName, v8Value, info);
|
| - {% else %}
|
| - {{cpp_class}}V8Internal::namedPropertySetter(propertyName, v8Value, info);
|
| - {% endif %}
|
| + {% if setter.is_custom %}
|
| + {{v8_class}}::namedPropertySetterCustom(propertyName, v8Value, info);
|
| + {% else %}
|
| + {{cpp_class}}V8Internal::namedPropertySetter(propertyName, v8Value, info);
|
| + {% endif %}
|
|
|
| - {% endif %}{# indexed_property_setter #}
|
| + {% endif %}{# indexed_property_setter #}
|
| }
|
|
|
| {% endif %}
|
| @@ -160,31 +156,30 @@ void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value,
|
| {% block indexed_property_deleter %}
|
| {% if indexed_property_deleter and not indexed_property_deleter.is_custom %}
|
| {% set deleter = indexed_property_deleter %}
|
| -static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
|
| -{
|
| - {% if deleter.is_raises_exception %}
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedDeletionContext, "{{interface_name}}");
|
| - {% endif %}
|
| -
|
| - {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| -
|
| - {% set deleter_name = deleter.name or 'anonymousIndexedDeleter' %}
|
| - {% set deleter_arguments = ['index'] %}
|
| - {% if deleter.is_call_with_script_state %}
|
| - ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| - {% set deleter_arguments = ['scriptState'] + deleter_arguments %}
|
| - {% endif %}
|
| - {% if deleter.is_raises_exception %}
|
| - {% set deleter_arguments = deleter_arguments + ['exceptionState'] %}
|
| - {% endif %}
|
| - DeleteResult result = impl->{{deleter_name}}({{deleter_arguments | join(', ')}});
|
| - {% if deleter.is_raises_exception %}
|
| - if (exceptionState.hadException())
|
| - return;
|
| - {% endif %}
|
| - if (result == DeleteUnknownProperty)
|
| - return;
|
| - v8SetReturnValue(info, result == DeleteSuccess);
|
| +static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
|
| + {% if deleter.is_raises_exception %}
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedDeletionContext, "{{interface_name}}");
|
| + {% endif %}
|
| +
|
| + {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| +
|
| + {% set deleter_name = deleter.name or 'anonymousIndexedDeleter' %}
|
| + {% set deleter_arguments = ['index'] %}
|
| + {% if deleter.is_call_with_script_state %}
|
| + ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| + {% set deleter_arguments = ['scriptState'] + deleter_arguments %}
|
| + {% endif %}
|
| + {% if deleter.is_raises_exception %}
|
| + {% set deleter_arguments = deleter_arguments + ['exceptionState'] %}
|
| + {% endif %}
|
| + DeleteResult result = impl->{{deleter_name}}({{deleter_arguments | join(', ')}});
|
| + {% if deleter.is_raises_exception %}
|
| + if (exceptionState.hadException())
|
| + return;
|
| + {% endif %}
|
| + if (result == DeleteUnknownProperty)
|
| + return;
|
| + v8SetReturnValue(info, result == DeleteSuccess);
|
| }
|
|
|
| {% endif %}
|
| @@ -195,31 +190,30 @@ static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf
|
| {% block indexed_property_deleter_callback %}
|
| {% if indexed_property_deleter or named_property_deleter %}
|
| {% set deleter = indexed_property_deleter or named_property_deleter %}
|
| -void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
|
| -{
|
| - {% if deleter.is_ce_reactions %}
|
| - CEReactionsScope ceReactionsScope;
|
| - {% endif %}
|
| +void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
|
| + {% if deleter.is_ce_reactions %}
|
| + CEReactionsScope ceReactionsScope;
|
| + {% endif %}
|
|
|
| - {% if indexed_property_deleter %}
|
| + {% if indexed_property_deleter %}
|
|
|
| - {% if deleter.is_custom %}
|
| - {{v8_class}}::indexedPropertyDeleterCustom(index, info);
|
| - {% else %}
|
| - {{cpp_class}}V8Internal::indexedPropertyDeleter(index, info);
|
| - {% endif %}
|
| + {% if deleter.is_custom %}
|
| + {{v8_class}}::indexedPropertyDeleterCustom(index, info);
|
| + {% else %}
|
| + {{cpp_class}}V8Internal::indexedPropertyDeleter(index, info);
|
| + {% endif %}
|
|
|
| - {% else %}{# otherwise, named property #}
|
| + {% else %}{# otherwise, named property #}
|
|
|
| - const AtomicString& propertyName = AtomicString::number(index);
|
| + const AtomicString& propertyName = AtomicString::number(index);
|
|
|
| - {% if deleter.is_custom %}
|
| - {{v8_class}}::namedPropertyDeleterCustom(propertyName, info);
|
| - {% else %}
|
| - {{cpp_class}}V8Internal::namedPropertyDeleter(propertyName, info);
|
| - {% endif %}
|
| + {% if deleter.is_custom %}
|
| + {{v8_class}}::namedPropertyDeleterCustom(propertyName, info);
|
| + {% else %}
|
| + {{cpp_class}}V8Internal::namedPropertyDeleter(propertyName, info);
|
| + {% endif %}
|
|
|
| - {% endif %}{# indexed_property_deleter #}
|
| + {% endif %}{# indexed_property_deleter #}
|
| }
|
|
|
| {% endif %}
|
| @@ -230,26 +224,25 @@ void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackIn
|
| {% block named_property_getter %}
|
| {% if named_property_getter and not named_property_getter.is_custom %}
|
| {% set getter = named_property_getter %}
|
| -static void namedPropertyGetter(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - {% if getter.is_raises_exception %}
|
| - const CString& nameInUtf8 = name.utf8();
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext, "{{interface_name}}", nameInUtf8.data());
|
| - {% endif %}
|
| - {% if getter.is_call_with_script_state %}
|
| - ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| - {% endif %}
|
| -
|
| - {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| - {% if getter.use_output_parameter_for_result %}
|
| - {{getter.cpp_type}} result;
|
| - {{getter.cpp_value}};
|
| - {% else %}
|
| - {{getter.cpp_type}} result = {{getter.cpp_value}};
|
| - {% endif %}
|
| - if ({{getter.is_null_expression}})
|
| - return;
|
| - {{getter.v8_set_return_value}};
|
| +static void namedPropertyGetter(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + {% if getter.is_raises_exception %}
|
| + const CString& nameInUtf8 = name.utf8();
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext, "{{interface_name}}", nameInUtf8.data());
|
| + {% endif %}
|
| + {% if getter.is_call_with_script_state %}
|
| + ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| + {% endif %}
|
| +
|
| + {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| + {% if getter.use_output_parameter_for_result %}
|
| + {{getter.cpp_type}} result;
|
| + {{getter.cpp_value}};
|
| + {% else %}
|
| + {{getter.cpp_type}} result = {{getter.cpp_value}};
|
| + {% endif %}
|
| + if ({{getter.is_null_expression}})
|
| + return;
|
| + {{getter.v8_set_return_value}};
|
| }
|
|
|
| {% endif %}
|
| @@ -260,17 +253,16 @@ static void namedPropertyGetter(const AtomicString& name, const v8::PropertyCall
|
| {% block named_property_getter_callback %}
|
| {% if named_property_getter %}
|
| {% set getter = named_property_getter %}
|
| -void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - if (!name->IsString())
|
| - return;
|
| - const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
| +void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + if (!name->IsString())
|
| + return;
|
| + const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
|
|
| - {% if getter.is_custom %}
|
| - {{v8_class}}::namedPropertyGetterCustom(propertyName, info);
|
| - {% else %}
|
| - {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info);
|
| - {% endif %}
|
| + {% if getter.is_custom %}
|
| + {{v8_class}}::namedPropertyGetterCustom(propertyName, info);
|
| + {% else %}
|
| + {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info);
|
| + {% endif %}
|
| }
|
|
|
| {% endif %}
|
| @@ -282,43 +274,42 @@ void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCal
|
| {% from 'utilities.cpp.tmpl' import v8_value_to_local_cpp_value %}
|
| {% if named_property_setter and not named_property_setter.is_custom %}
|
| {% set setter = named_property_setter %}
|
| -static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - {% if setter.has_exception_state %}
|
| - const CString& nameInUtf8 = name.utf8();
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "{{interface_name}}", nameInUtf8.data());
|
| - {% endif %}
|
| - {% if setter.is_call_with_script_state %}
|
| - ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| - {% endif %}
|
| -
|
| - {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| - {{v8_value_to_local_cpp_value(setter) | indent}}
|
| - {% if setter.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 (!propertyValue{% if setter.is_nullable %} && !isUndefinedOrNull(v8Value){% endif %}) {
|
| - exceptionState.throwTypeError("The provided value is not of type '{{setter.idl_type}}'.");
|
| - return;
|
| - }
|
| - {% endif %}
|
| -
|
| - {% set setter_name = setter.name or 'anonymousNamedSetter' %}
|
| - {% set setter_arguments = ['name', 'propertyValue'] %}
|
| - {% if setter.is_call_with_script_state %}
|
| - {% set setter_arguments = ['scriptState'] + setter_arguments %}
|
| - {% endif %}
|
| - {% if setter.is_raises_exception %}
|
| - {% set setter_arguments = setter_arguments + ['exceptionState'] %}
|
| - {% endif %}
|
| - bool result = impl->{{setter_name}}({{setter_arguments | join(', ')}});
|
| - {% if setter.is_raises_exception %}
|
| - if (exceptionState.hadException())
|
| - return;
|
| - {% endif %}
|
| - if (!result)
|
| - return;
|
| - v8SetReturnValue(info, v8Value);
|
| +static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + {% if setter.has_exception_state %}
|
| + const CString& nameInUtf8 = name.utf8();
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "{{interface_name}}", nameInUtf8.data());
|
| + {% endif %}
|
| + {% if setter.is_call_with_script_state %}
|
| + ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| + {% endif %}
|
| +
|
| + {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| + {{v8_value_to_local_cpp_value(setter) | indent(2)}}
|
| + {% if setter.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 (!propertyValue{% if setter.is_nullable %} && !isUndefinedOrNull(v8Value){% endif %}) {
|
| + exceptionState.throwTypeError("The provided value is not of type '{{setter.idl_type}}'.");
|
| + return;
|
| + }
|
| + {% endif %}
|
| +
|
| + {% set setter_name = setter.name or 'anonymousNamedSetter' %}
|
| + {% set setter_arguments = ['name', 'propertyValue'] %}
|
| + {% if setter.is_call_with_script_state %}
|
| + {% set setter_arguments = ['scriptState'] + setter_arguments %}
|
| + {% endif %}
|
| + {% if setter.is_raises_exception %}
|
| + {% set setter_arguments = setter_arguments + ['exceptionState'] %}
|
| + {% endif %}
|
| + bool result = impl->{{setter_name}}({{setter_arguments | join(', ')}});
|
| + {% if setter.is_raises_exception %}
|
| + if (exceptionState.hadException())
|
| + return;
|
| + {% endif %}
|
| + if (!result)
|
| + return;
|
| + v8SetReturnValue(info, v8Value);
|
| }
|
|
|
| {% endif %}
|
| @@ -329,21 +320,20 @@ static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v
|
| {% block named_property_setter_callback %}
|
| {% if named_property_setter %}
|
| {% set setter = named_property_setter %}
|
| -void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - if (!name->IsString())
|
| - return;
|
| - const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
| +void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + if (!name->IsString())
|
| + return;
|
| + const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
|
|
| - {% if setter.is_ce_reactions %}
|
| - CEReactionsScope ceReactionsScope;
|
| - {% endif %}
|
| + {% if setter.is_ce_reactions %}
|
| + CEReactionsScope ceReactionsScope;
|
| + {% endif %}
|
|
|
| - {% if setter.is_custom %}
|
| - {{v8_class}}::namedPropertySetterCustom(propertyName, v8Value, info);
|
| - {% else %}
|
| - {{cpp_class}}V8Internal::namedPropertySetter(propertyName, v8Value, info);
|
| - {% endif %}
|
| + {% if setter.is_custom %}
|
| + {{v8_class}}::namedPropertySetterCustom(propertyName, v8Value, info);
|
| + {% else %}
|
| + {{cpp_class}}V8Internal::namedPropertySetter(propertyName, v8Value, info);
|
| + {% endif %}
|
| }
|
|
|
| {% endif %}
|
| @@ -354,34 +344,33 @@ void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value>
|
| {% block named_property_deleter %}
|
| {% if named_property_deleter and not named_property_deleter.is_custom %}
|
| {% set deleter = named_property_deleter %}
|
| -static void namedPropertyDeleter(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
|
| -{
|
| - {% if deleter.is_raises_exception %}
|
| - const CString& nameInUtf8 = name.utf8();
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::DeletionContext, "{{interface_name}}", nameInUtf8.data());
|
| - {% endif %}
|
| - {% if deleter.is_call_with_script_state %}
|
| - ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| - {% endif %}
|
| -
|
| - {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| -
|
| - {% set deleter_name = deleter.name or 'anonymousNamedDeleter' %}
|
| - {% set deleter_arguments = ['name'] %}
|
| - {% if deleter.is_call_with_script_state %}
|
| - {% set deleter_arguments = ['scriptState'] + deleter_arguments %}
|
| - {% endif %}
|
| - {% if deleter.is_raises_exception %}
|
| - {% set deleter_arguments = deleter_arguments + ['exceptionState'] %}
|
| - {% endif %}
|
| - DeleteResult result = impl->{{deleter_name}}({{deleter_arguments | join(', ')}});
|
| - {% if deleter.is_raises_exception %}
|
| - if (exceptionState.hadException())
|
| - return;
|
| - {% endif %}
|
| - if (result == DeleteUnknownProperty)
|
| - return;
|
| - v8SetReturnValue(info, result == DeleteSuccess);
|
| +static void namedPropertyDeleter(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
|
| + {% if deleter.is_raises_exception %}
|
| + const CString& nameInUtf8 = name.utf8();
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::DeletionContext, "{{interface_name}}", nameInUtf8.data());
|
| + {% endif %}
|
| + {% if deleter.is_call_with_script_state %}
|
| + ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| + {% endif %}
|
| +
|
| + {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| +
|
| + {% set deleter_name = deleter.name or 'anonymousNamedDeleter' %}
|
| + {% set deleter_arguments = ['name'] %}
|
| + {% if deleter.is_call_with_script_state %}
|
| + {% set deleter_arguments = ['scriptState'] + deleter_arguments %}
|
| + {% endif %}
|
| + {% if deleter.is_raises_exception %}
|
| + {% set deleter_arguments = deleter_arguments + ['exceptionState'] %}
|
| + {% endif %}
|
| + DeleteResult result = impl->{{deleter_name}}({{deleter_arguments | join(', ')}});
|
| + {% if deleter.is_raises_exception %}
|
| + if (exceptionState.hadException())
|
| + return;
|
| + {% endif %}
|
| + if (result == DeleteUnknownProperty)
|
| + return;
|
| + v8SetReturnValue(info, result == DeleteSuccess);
|
| }
|
|
|
| {% endif %}
|
| @@ -392,21 +381,20 @@ static void namedPropertyDeleter(const AtomicString& name, const v8::PropertyCal
|
| {% block named_property_deleter_callback %}
|
| {% if named_property_deleter %}
|
| {% set deleter = named_property_deleter %}
|
| -void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
|
| -{
|
| - if (!name->IsString())
|
| - return;
|
| - const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
| +void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
|
| + if (!name->IsString())
|
| + return;
|
| + const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
|
|
| - {% if deleter.is_ce_reactions %}
|
| - CEReactionsScope ceReactionsScope;
|
| - {% endif %}
|
| + {% if deleter.is_ce_reactions %}
|
| + CEReactionsScope ceReactionsScope;
|
| + {% endif %}
|
|
|
| - {% if deleter.is_custom %}
|
| - {{v8_class}}::namedPropertyDeleterCustom(propertyName, info);
|
| - {% else %}
|
| - {{cpp_class}}V8Internal::namedPropertyDeleter(propertyName, info);
|
| - {% endif %}
|
| + {% if deleter.is_custom %}
|
| + {{v8_class}}::namedPropertyDeleterCustom(propertyName, info);
|
| + {% else %}
|
| + {{cpp_class}}V8Internal::namedPropertyDeleter(propertyName, info);
|
| + {% endif %}
|
| }
|
|
|
| {% endif %}
|
| @@ -420,24 +408,23 @@ void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCa
|
| {% set getter = named_property_getter %}
|
| {# If there is an enumerator, there MUST be a query method to properly
|
| communicate property attributes. #}
|
| -static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Integer>& info)
|
| -{
|
| - const CString& nameInUtf8 = name.utf8();
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext, "{{interface_name}}", nameInUtf8.data());
|
| - {% if getter.is_call_with_script_state %}
|
| - ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| - {% endif %}
|
| -
|
| - {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| -
|
| - {% set getter_arguments = ['name', 'exceptionState'] %}
|
| - {% if getter.is_call_with_script_state %}
|
| - {% set getter_arguments = ['scriptState'] + getter_arguments %}
|
| - {% endif %}
|
| - bool result = impl->namedPropertyQuery({{getter_arguments | join(', ')}});
|
| - if (!result)
|
| - return;
|
| - v8SetReturnValueInt(info, v8::None);
|
| +static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Integer>& info) {
|
| + const CString& nameInUtf8 = name.utf8();
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext, "{{interface_name}}", nameInUtf8.data());
|
| + {% if getter.is_call_with_script_state %}
|
| + ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| + {% endif %}
|
| +
|
| + {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| +
|
| + {% set getter_arguments = ['name', 'exceptionState'] %}
|
| + {% if getter.is_call_with_script_state %}
|
| + {% set getter_arguments = ['scriptState'] + getter_arguments %}
|
| + {% endif %}
|
| + bool result = impl->namedPropertyQuery({{getter_arguments | join(', ')}});
|
| + if (!result)
|
| + return;
|
| + v8SetReturnValueInt(info, v8::None);
|
| }
|
|
|
| {% endif %}
|
| @@ -448,17 +435,16 @@ static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallb
|
| {% block named_property_query_callback %}
|
| {% if named_property_getter and named_property_getter.is_enumerable %}
|
| {% set getter = named_property_getter %}
|
| -void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
|
| -{
|
| - if (!name->IsString())
|
| - return;
|
| - const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
| +void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info) {
|
| + if (!name->IsString())
|
| + return;
|
| + const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
|
|
| - {% if getter.is_custom_property_query %}
|
| - {{v8_class}}::namedPropertyQueryCustom(propertyName, info);
|
| - {% else %}
|
| - {{cpp_class}}V8Internal::namedPropertyQuery(propertyName, info);
|
| - {% endif %}
|
| + {% if getter.is_custom_property_query %}
|
| + {{v8_class}}::namedPropertyQueryCustom(propertyName, info);
|
| + {% else %}
|
| + {{cpp_class}}V8Internal::namedPropertyQuery(propertyName, info);
|
| + {% endif %}
|
| }
|
|
|
| {% endif %}
|
| @@ -469,17 +455,16 @@ void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCall
|
| {% block named_property_enumerator %}
|
| {% if named_property_getter and named_property_getter.is_enumerable and
|
| not named_property_getter.is_custom_property_enumerator %}
|
| -static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info)
|
| -{
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::EnumerationContext, "{{interface_name}}");
|
| +static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) {
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::EnumerationContext, "{{interface_name}}");
|
|
|
| - {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| + {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
|
|
| - Vector<String> names;
|
| - impl->namedPropertyEnumerator(names, exceptionState);
|
| - if (exceptionState.hadException())
|
| - return;
|
| - v8SetReturnValue(info, toV8(names, info.Holder(), info.GetIsolate()).As<v8::Array>());
|
| + Vector<String> names;
|
| + impl->namedPropertyEnumerator(names, exceptionState);
|
| + if (exceptionState.hadException())
|
| + return;
|
| + v8SetReturnValue(info, toV8(names, info.Holder(), info.GetIsolate()).As<v8::Array>());
|
| }
|
|
|
| {% endif %}
|
| @@ -490,13 +475,12 @@ static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
|
| {% block named_property_enumerator_callback %}
|
| {% if named_property_getter and named_property_getter.is_enumerable %}
|
| {% set getter = named_property_getter %}
|
| -void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info)
|
| -{
|
| - {% if getter.is_custom_property_enumerator %}
|
| - {{v8_class}}::namedPropertyEnumeratorCustom(info);
|
| - {% else %}
|
| - {{cpp_class}}V8Internal::namedPropertyEnumerator(info);
|
| - {% endif %}
|
| +void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info) {
|
| + {% if getter.is_custom_property_enumerator %}
|
| + {{v8_class}}::namedPropertyEnumeratorCustom(info);
|
| + {% else %}
|
| + {{cpp_class}}V8Internal::namedPropertyEnumerator(info);
|
| + {% endif %}
|
| }
|
|
|
| {% endif %}
|
| @@ -506,27 +490,25 @@ void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>&
|
| {##############################################################################}
|
| {% block origin_safe_method_setter %}
|
| {% if has_origin_safe_method_setter %}
|
| -static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
|
| -{
|
| - if (!name->IsString())
|
| - return;
|
| - v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(info.Holder(), info.GetIsolate());
|
| - if (holder.IsEmpty())
|
| - return;
|
| - {{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
|
| - v8::String::Utf8Value attributeName(name);
|
| - ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate());
|
| - if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), impl, exceptionState)) {
|
| - return;
|
| - }
|
| +static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) {
|
| + if (!name->IsString())
|
| + return;
|
| + v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(info.Holder(), info.GetIsolate());
|
| + if (holder.IsEmpty())
|
| + return;
|
| + {{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
|
| + v8::String::Utf8Value attributeName(name);
|
| + ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate());
|
| + if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), impl, exceptionState)) {
|
| + return;
|
| + }
|
|
|
| - {# The findInstanceInPrototypeChain() call above only returns a non-empty handle if info.Holder() is an Object. #}
|
| - V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), v8::Local<v8::Object>::Cast(info.Holder()), name.As<v8::String>(), v8Value);
|
| + {# The findInstanceInPrototypeChain() call above only returns a non-empty handle if info.Holder() is an Object. #}
|
| + V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), v8::Local<v8::Object>::Cast(info.Holder()), name.As<v8::String>(), v8Value);
|
| }
|
|
|
| -void {{cpp_class}}OriginSafeMethodSetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
|
| -{
|
| - {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, v8Value, info);
|
| +void {{cpp_class}}OriginSafeMethodSetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) {
|
| + {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, v8Value, info);
|
| }
|
|
|
| {% endif %}
|
| @@ -553,21 +535,20 @@ const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde
|
| #endif
|
|
|
| {{generate_constructor(named_constructor)}}
|
| -v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world)
|
| -{
|
| - static int domTemplateKey; // This address is used for a key to look up the dom template.
|
| - V8PerIsolateData* data = V8PerIsolateData::from(isolate);
|
| - v8::Local<v8::FunctionTemplate> result = data->findInterfaceTemplate(world, &domTemplateKey);
|
| - if (!result.IsEmpty())
|
| - return result;
|
| -
|
| - result = v8::FunctionTemplate::New(isolate, {{v8_class}}ConstructorCallback);
|
| - v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate();
|
| - instanceTemplate->SetInternalFieldCount({{v8_class}}::internalFieldCount);
|
| - result->SetClassName(v8AtomicString(isolate, "{{cpp_class}}"));
|
| - result->Inherit({{v8_class}}::domTemplate(isolate, world));
|
| - data->setInterfaceTemplate(world, &domTemplateKey, result);
|
| +v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) {
|
| + static int domTemplateKey; // This address is used for a key to look up the dom template.
|
| + V8PerIsolateData* data = V8PerIsolateData::from(isolate);
|
| + v8::Local<v8::FunctionTemplate> result = data->findInterfaceTemplate(world, &domTemplateKey);
|
| + if (!result.IsEmpty())
|
| return result;
|
| +
|
| + result = v8::FunctionTemplate::New(isolate, {{v8_class}}ConstructorCallback);
|
| + v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate();
|
| + instanceTemplate->SetInternalFieldCount({{v8_class}}::internalFieldCount);
|
| + result->SetClassName(v8AtomicString(isolate, "{{cpp_class}}"));
|
| + result->Inherit({{v8_class}}::domTemplate(isolate, world));
|
| + data->setInterfaceTemplate(world, &domTemplateKey, result);
|
| + return result;
|
| }
|
|
|
| {% endif %}
|
| @@ -576,39 +557,38 @@ v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate
|
| {##############################################################################}
|
| {% block overloaded_constructor %}
|
| {% if constructor_overloads %}
|
| -static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| -{
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ConstructionContext, "{{interface_name}}");
|
| - {# 2. Initialize argcount to be min(maxarg, n). #}
|
| - switch (std::min({{constructor_overloads.maxarg}}, info.Length())) {
|
| +static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ConstructionContext, "{{interface_name}}");
|
| + {# 2. Initialize argcount to be min(maxarg, n). #}
|
| + switch (std::min({{constructor_overloads.maxarg}}, info.Length())) {
|
| {# 3. Remove from S all entries whose type list is not of length argcount. #}
|
| {% for length, tests_constructors in constructor_overloads.length_tests_methods %}
|
| case {{length}}:
|
| - {# Then resolve by testing argument #}
|
| - {% for test, constructor in tests_constructors %}
|
| - {# 10. If i = d, then: #}
|
| - if ({{test}}) {
|
| - {{cpp_class}}V8Internal::constructor{{constructor.overload_index}}(info);
|
| - return;
|
| - }
|
| - {% endfor %}
|
| - break;
|
| + {# Then resolve by testing argument #}
|
| + {% for test, constructor in tests_constructors %}
|
| + {# 10. If i = d, then: #}
|
| + if ({{test}}) {
|
| + {{cpp_class}}V8Internal::constructor{{constructor.overload_index}}(info);
|
| + return;
|
| + }
|
| + {% endfor %}
|
| + break;
|
| {% endfor %}
|
| default:
|
| - {# Invalid arity, throw error #}
|
| - {# Report full list of valid arities if gaps and above minimum #}
|
| - {% if constructor_overloads.valid_arities %}
|
| - if (info.Length() >= {{constructor_overloads.length}}) {
|
| - exceptionState.throwTypeError(ExceptionMessages::invalidArity("{{constructor_overloads.valid_arities}}", info.Length()));
|
| - return;
|
| - }
|
| - {% endif %}
|
| - {# Otherwise just report "not enough arguments" #}
|
| - exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments({{constructor_overloads.length}}, info.Length()));
|
| + {# Invalid arity, throw error #}
|
| + {# Report full list of valid arities if gaps and above minimum #}
|
| + {% if constructor_overloads.valid_arities %}
|
| + if (info.Length() >= {{constructor_overloads.length}}) {
|
| + exceptionState.throwTypeError(ExceptionMessages::invalidArity("{{constructor_overloads.valid_arities}}", info.Length()));
|
| return;
|
| - }
|
| - {# No match, throw error #}
|
| - exceptionState.throwTypeError("No matching constructor signature.");
|
| + }
|
| + {% endif %}
|
| + {# Otherwise just report "not enough arguments" #}
|
| + exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments({{constructor_overloads.length}}, info.Length()));
|
| + return;
|
| + }
|
| + {# No match, throw error #}
|
| + exceptionState.throwTypeError("No matching constructor signature.");
|
| }
|
|
|
| {% endif %}
|
| @@ -618,28 +598,27 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {##############################################################################}
|
| {% block visit_dom_wrapper %}
|
| {% if has_visit_dom_wrapper %}
|
| -void {{v8_class}}::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* scriptWrappable, const v8::Persistent<v8::Object>& wrapper)
|
| -{
|
| - {% if has_visit_dom_wrapper_custom %}
|
| - {{v8_class}}::visitDOMWrapperCustom(isolate, scriptWrappable, wrapper);
|
| - {% endif %}
|
| - {% if set_wrapper_reference_to or set_wrapper_reference_from %}
|
| - {{cpp_class}}* impl = scriptWrappable->toImpl<{{cpp_class}}>();
|
| - {% endif %}
|
| - {% if set_wrapper_reference_to %}
|
| - {{set_wrapper_reference_to.cpp_type}} {{set_wrapper_reference_to.name}} = impl->{{set_wrapper_reference_to.name}}();
|
| - if ({{set_wrapper_reference_to.name}}) {
|
| - DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, {{set_wrapper_reference_to.name}}, isolate);
|
| - }
|
| - {% endif %}
|
| - {% if set_wrapper_reference_from %}
|
| - // The {{set_wrapper_reference_from}}() method may return a reference or a pointer.
|
| - if (Node* owner = WTF::getPtr(impl->{{set_wrapper_reference_from}}())) {
|
| - Node* root = V8GCController::opaqueRootForGC(isolate, owner);
|
| - isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(root)), wrapper);
|
| - return;
|
| - }
|
| - {% endif %}
|
| +void {{v8_class}}::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* scriptWrappable, const v8::Persistent<v8::Object>& wrapper) {
|
| + {% if has_visit_dom_wrapper_custom %}
|
| + {{v8_class}}::visitDOMWrapperCustom(isolate, scriptWrappable, wrapper);
|
| + {% endif %}
|
| + {% if set_wrapper_reference_to or set_wrapper_reference_from %}
|
| + {{cpp_class}}* impl = scriptWrappable->toImpl<{{cpp_class}}>();
|
| + {% endif %}
|
| + {% if set_wrapper_reference_to %}
|
| + {{set_wrapper_reference_to.cpp_type}} {{set_wrapper_reference_to.name}} = impl->{{set_wrapper_reference_to.name}}();
|
| + if ({{set_wrapper_reference_to.name}}) {
|
| + DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, {{set_wrapper_reference_to.name}}, isolate);
|
| + }
|
| + {% endif %}
|
| + {% if set_wrapper_reference_from %}
|
| + // The {{set_wrapper_reference_from}}() method may return a reference or a pointer.
|
| + if (Node* owner = WTF::getPtr(impl->{{set_wrapper_reference_from}}())) {
|
| + Node* root = V8GCController::opaqueRootForGC(isolate, owner);
|
| + isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(root)), wrapper);
|
| + return;
|
| + }
|
| + {% endif %}
|
| }
|
|
|
| {% endif %}
|
| @@ -649,28 +628,27 @@ void {{v8_class}}::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* script
|
| {##############################################################################}
|
| {% block constructor_callback %}
|
| {% if constructors or has_custom_constructor or has_event_constructor or has_html_constructor %}
|
| -void {{v8_class}}::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| -{
|
| - {% if measure_as %}
|
| - UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionContext(info.GetIsolate()), UseCounter::{{measure_as('Constructor')}});
|
| - {% endif %}
|
| - if (!info.IsConstructCall()) {
|
| - V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::constructorNotCallableAsFunction("{{interface_name}}"));
|
| - return;
|
| - }
|
| -
|
| - if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) {
|
| - v8SetReturnValue(info, info.Holder());
|
| - return;
|
| - }
|
| -
|
| - {% if has_custom_constructor %}
|
| - {{v8_class}}::constructorCustom(info);
|
| - {% elif has_html_constructor %}
|
| - {{v8_class}}::HTMLConstructor(info);
|
| - {% else %}
|
| - {{cpp_class}}V8Internal::constructor(info);
|
| - {% endif %}
|
| +void {{v8_class}}::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
| + {% if measure_as %}
|
| + UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionContext(info.GetIsolate()), UseCounter::{{measure_as('Constructor')}});
|
| + {% endif %}
|
| + if (!info.IsConstructCall()) {
|
| + V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::constructorNotCallableAsFunction("{{interface_name}}"));
|
| + return;
|
| + }
|
| +
|
| + if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) {
|
| + v8SetReturnValue(info, info.Holder());
|
| + return;
|
| + }
|
| +
|
| + {% if has_custom_constructor %}
|
| + {{v8_class}}::constructorCustom(info);
|
| + {% elif has_html_constructor %}
|
| + {{v8_class}}::HTMLConstructor(info);
|
| + {% else %}
|
| + {{cpp_class}}V8Internal::constructor(info);
|
| + {% endif %}
|
| }
|
|
|
| {% endif %}
|
| @@ -770,10 +748,9 @@ v8::NamedPropertyHandlerConfiguration namedPropertyHandlerConfig({{named_propert
|
| {##############################################################################}
|
| {% block get_dom_template %}
|
| {% if not is_array_buffer_or_view %}
|
| -v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world)
|
| -{
|
| - {% set installTemplateFunction = '%s::install%sTemplateFunction' % (v8_class, v8_class) if has_partial_interface else 'install%sTemplate' % v8_class %}
|
| - return V8DOMConfiguration::domClassTemplate(isolate, world, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), {{installTemplateFunction}});
|
| +v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) {
|
| + {% set installTemplateFunction = '%s::install%sTemplateFunction' % (v8_class, v8_class) if has_partial_interface else 'install%sTemplate' % v8_class %}
|
| + return V8DOMConfiguration::domClassTemplate(isolate, world, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), {{installTemplateFunction}});
|
| }
|
|
|
| {% endif %}
|
| @@ -783,20 +760,19 @@ v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate,
|
| {##############################################################################}
|
| {% block get_dom_template_for_named_properties_object %}
|
| {% if has_named_properties_object %}
|
| -v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplateForNamedPropertiesObject(v8::Isolate* isolate, const DOMWrapperWorld& world)
|
| -{
|
| - v8::Local<v8::FunctionTemplate> parentTemplate = V8{{parent_interface}}::domTemplate(isolate, world);
|
| +v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplateForNamedPropertiesObject(v8::Isolate* isolate, const DOMWrapperWorld& world) {
|
| + v8::Local<v8::FunctionTemplate> parentTemplate = V8{{parent_interface}}::domTemplate(isolate, world);
|
|
|
| - v8::Local<v8::FunctionTemplate> namedPropertiesObjectFunctionTemplate = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidConstructorMode);
|
| - namedPropertiesObjectFunctionTemplate->SetClassName(v8AtomicString(isolate, "{{interface_name}}Properties"));
|
| - namedPropertiesObjectFunctionTemplate->Inherit(parentTemplate);
|
| + v8::Local<v8::FunctionTemplate> namedPropertiesObjectFunctionTemplate = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidConstructorMode);
|
| + namedPropertiesObjectFunctionTemplate->SetClassName(v8AtomicString(isolate, "{{interface_name}}Properties"));
|
| + namedPropertiesObjectFunctionTemplate->Inherit(parentTemplate);
|
|
|
| - v8::Local<v8::ObjectTemplate> namedPropertiesObjectTemplate = namedPropertiesObjectFunctionTemplate->PrototypeTemplate();
|
| - namedPropertiesObjectTemplate->SetInternalFieldCount({{v8_class}}::internalFieldCount);
|
| - V8DOMConfiguration::setClassString(isolate, namedPropertiesObjectTemplate, "{{interface_name}}Properties");
|
| - {{install_named_property_handler('namedPropertiesObjectTemplate') | indent}}
|
| + v8::Local<v8::ObjectTemplate> namedPropertiesObjectTemplate = namedPropertiesObjectFunctionTemplate->PrototypeTemplate();
|
| + namedPropertiesObjectTemplate->SetInternalFieldCount({{v8_class}}::internalFieldCount);
|
| + V8DOMConfiguration::setClassString(isolate, namedPropertiesObjectTemplate, "{{interface_name}}Properties");
|
| + {{install_named_property_handler('namedPropertiesObjectTemplate') | indent(2)}}
|
|
|
| - return namedPropertiesObjectFunctionTemplate;
|
| + return namedPropertiesObjectFunctionTemplate;
|
| }
|
|
|
| {% endif %}
|
| @@ -807,14 +783,12 @@ v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplateForNamedPropertiesObjec
|
| {% block has_instance %}
|
| {% if not is_array_buffer_or_view %}
|
|
|
| -bool {{v8_class}}::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
|
| -{
|
| - return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
|
| +bool {{v8_class}}::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) {
|
| + return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
|
| }
|
|
|
| -v8::Local<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
|
| -{
|
| - return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
|
| +v8::Local<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) {
|
| + return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
|
| }
|
|
|
| {% endif %}
|
| @@ -824,83 +798,80 @@ v8::Local<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Local<v8::V
|
| {##############################################################################}
|
| {% block to_impl %}
|
| {% if interface_name == 'ArrayBuffer' or interface_name == 'SharedArrayBuffer' %}
|
| -{{cpp_class}}* V8{{interface_name}}::toImpl(v8::Local<v8::Object> object)
|
| -{
|
| - ASSERT(object->Is{{interface_name}}());
|
| - v8::Local<v8::{{interface_name}}> v8buffer = object.As<v8::{{interface_name}}>();
|
| - if (v8buffer->IsExternal()) {
|
| - const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object);
|
| - RELEASE_ASSERT(wrapperTypeInfo);
|
| - RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink);
|
| - return toScriptWrappable(object)->toImpl<{{cpp_class}}>();
|
| - }
|
| -
|
| - // Transfer the ownership of the allocated memory to an {{interface_name}} without
|
| - // copying.
|
| - v8::{{interface_name}}::Contents v8Contents = v8buffer->Externalize();
|
| - WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength(), WTF::ArrayBufferContents::{% if interface_name == 'ArrayBuffer' %}Not{% endif %}Shared);
|
| - {{cpp_class}}* buffer = {{cpp_class}}::create(contents);
|
| - v8::Local<v8::Object> associatedWrapper = buffer->associateWithWrapper(v8::Isolate::GetCurrent(), buffer->wrapperTypeInfo(), object);
|
| - DCHECK(associatedWrapper == object);
|
| -
|
| - return buffer;
|
| +{{cpp_class}}* V8{{interface_name}}::toImpl(v8::Local<v8::Object> object) {
|
| + DCHECK(object->Is{{interface_name}}());
|
| + v8::Local<v8::{{interface_name}}> v8buffer = object.As<v8::{{interface_name}}>();
|
| + if (v8buffer->IsExternal()) {
|
| + const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object);
|
| + CHECK(wrapperTypeInfo);
|
| + CHECK_EQ(wrapperTypeInfo->ginEmbedder, gin::kEmbedderBlink);
|
| + return toScriptWrappable(object)->toImpl<{{cpp_class}}>();
|
| + }
|
| +
|
| + // Transfer the ownership of the allocated memory to an {{interface_name}} without
|
| + // copying.
|
| + v8::{{interface_name}}::Contents v8Contents = v8buffer->Externalize();
|
| + WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength(), WTF::ArrayBufferContents::{% if interface_name == 'ArrayBuffer' %}Not{% endif %}Shared);
|
| + {{cpp_class}}* buffer = {{cpp_class}}::create(contents);
|
| + v8::Local<v8::Object> associatedWrapper = buffer->associateWithWrapper(v8::Isolate::GetCurrent(), buffer->wrapperTypeInfo(), object);
|
| + DCHECK(associatedWrapper == object);
|
| +
|
| + return buffer;
|
| }
|
|
|
| {% elif interface_name == 'ArrayBufferView' %}
|
| -{{cpp_class}}* V8ArrayBufferView::toImpl(v8::Local<v8::Object> object)
|
| -{
|
| - ASSERT(object->IsArrayBufferView());
|
| - ScriptWrappable* scriptWrappable = toScriptWrappable(object);
|
| - if (scriptWrappable)
|
| - return scriptWrappable->toImpl<{{cpp_class}}>();
|
| -
|
| - if (object->IsInt8Array())
|
| - return V8Int8Array::toImpl(object);
|
| - if (object->IsInt16Array())
|
| - return V8Int16Array::toImpl(object);
|
| - if (object->IsInt32Array())
|
| - return V8Int32Array::toImpl(object);
|
| - if (object->IsUint8Array())
|
| - return V8Uint8Array::toImpl(object);
|
| - if (object->IsUint8ClampedArray())
|
| - return V8Uint8ClampedArray::toImpl(object);
|
| - if (object->IsUint16Array())
|
| - return V8Uint16Array::toImpl(object);
|
| - if (object->IsUint32Array())
|
| - return V8Uint32Array::toImpl(object);
|
| - if (object->IsFloat32Array())
|
| - return V8Float32Array::toImpl(object);
|
| - if (object->IsFloat64Array())
|
| - return V8Float64Array::toImpl(object);
|
| - if (object->IsDataView())
|
| - return V8DataView::toImpl(object);
|
| -
|
| - ASSERT_NOT_REACHED();
|
| - return 0;
|
| +{{cpp_class}}* V8ArrayBufferView::toImpl(v8::Local<v8::Object> object) {
|
| + DCHECK(object->IsArrayBufferView());
|
| + ScriptWrappable* scriptWrappable = toScriptWrappable(object);
|
| + if (scriptWrappable)
|
| + return scriptWrappable->toImpl<{{cpp_class}}>();
|
| +
|
| + if (object->IsInt8Array())
|
| + return V8Int8Array::toImpl(object);
|
| + if (object->IsInt16Array())
|
| + return V8Int16Array::toImpl(object);
|
| + if (object->IsInt32Array())
|
| + return V8Int32Array::toImpl(object);
|
| + if (object->IsUint8Array())
|
| + return V8Uint8Array::toImpl(object);
|
| + if (object->IsUint8ClampedArray())
|
| + return V8Uint8ClampedArray::toImpl(object);
|
| + if (object->IsUint16Array())
|
| + return V8Uint16Array::toImpl(object);
|
| + if (object->IsUint32Array())
|
| + return V8Uint32Array::toImpl(object);
|
| + if (object->IsFloat32Array())
|
| + return V8Float32Array::toImpl(object);
|
| + if (object->IsFloat64Array())
|
| + return V8Float64Array::toImpl(object);
|
| + if (object->IsDataView())
|
| + return V8DataView::toImpl(object);
|
| +
|
| + NOTREACHED();
|
| + return 0;
|
| }
|
|
|
| {% elif is_array_buffer_or_view %}
|
| -{{cpp_class}}* {{v8_class}}::toImpl(v8::Local<v8::Object> object)
|
| -{
|
| - ASSERT(object->Is{{interface_name}}());
|
| - ScriptWrappable* scriptWrappable = toScriptWrappable(object);
|
| - if (scriptWrappable)
|
| - return scriptWrappable->toImpl<{{cpp_class}}>();
|
| -
|
| - v8::Local<v8::{{interface_name}}> v8View = object.As<v8::{{interface_name}}>();
|
| - v8::Local<v8::Object> arrayBuffer = v8View->Buffer();
|
| - {{cpp_class}}* typedArray = nullptr;
|
| - if (arrayBuffer->IsArrayBuffer()) {
|
| - typedArray = {{cpp_class}}::create(V8ArrayBuffer::toImpl(arrayBuffer), v8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif %}Length());
|
| - } else if (arrayBuffer->IsSharedArrayBuffer()) {
|
| - typedArray = {{cpp_class}}::create(V8SharedArrayBuffer::toImpl(arrayBuffer), v8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif %}Length());
|
| - } else {
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - v8::Local<v8::Object> associatedWrapper = typedArray->associateWithWrapper(v8::Isolate::GetCurrent(), typedArray->wrapperTypeInfo(), object);
|
| - DCHECK(associatedWrapper == object);
|
| -
|
| - return typedArray->toImpl<{{cpp_class}}>();
|
| +{{cpp_class}}* {{v8_class}}::toImpl(v8::Local<v8::Object> object) {
|
| + DCHECK(object->Is{{interface_name}}());
|
| + ScriptWrappable* scriptWrappable = toScriptWrappable(object);
|
| + if (scriptWrappable)
|
| + return scriptWrappable->toImpl<{{cpp_class}}>();
|
| +
|
| + v8::Local<v8::{{interface_name}}> v8View = object.As<v8::{{interface_name}}>();
|
| + v8::Local<v8::Object> arrayBuffer = v8View->Buffer();
|
| + {{cpp_class}}* typedArray = nullptr;
|
| + if (arrayBuffer->IsArrayBuffer()) {
|
| + typedArray = {{cpp_class}}::create(V8ArrayBuffer::toImpl(arrayBuffer), v8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif %}Length());
|
| + } else if (arrayBuffer->IsSharedArrayBuffer()) {
|
| + typedArray = {{cpp_class}}::create(V8SharedArrayBuffer::toImpl(arrayBuffer), v8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif %}Length());
|
| + } else {
|
| + NOTREACHED();
|
| + }
|
| + v8::Local<v8::Object> associatedWrapper = typedArray->associateWithWrapper(v8::Isolate::GetCurrent(), typedArray->wrapperTypeInfo(), object);
|
| + DCHECK(associatedWrapper == object);
|
| +
|
| + return typedArray->toImpl<{{cpp_class}}>();
|
| }
|
|
|
| {% endif %}
|
| @@ -909,12 +880,11 @@ v8::Local<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Local<v8::V
|
|
|
| {##############################################################################}
|
| {% block to_impl_with_type_check %}
|
| -{{cpp_class}}* {{v8_class}}::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value)
|
| -{
|
| +{{cpp_class}}* {{v8_class}}::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value) {
|
| {% if is_array_buffer_or_view %}
|
| - return value->Is{{interface_name}}() ? toImpl(v8::Local<v8::Object>::Cast(value)) : nullptr;
|
| + return value->Is{{interface_name}}() ? toImpl(v8::Local<v8::Object>::Cast(value)) : nullptr;
|
| {% else %}
|
| - return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : nullptr;
|
| + return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : nullptr;
|
| {% endif %}
|
| }
|
|
|
| @@ -925,17 +895,16 @@ v8::Local<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Local<v8::V
|
| {% block prepare_prototype_and_interface_object %}
|
| {% from 'methods.cpp.tmpl' import install_conditionally_enabled_methods with context %}
|
| {% if has_prepare_prototype_and_interface_object %}
|
| -void {{v8_class}}::preparePrototypeAndInterfaceObject(v8::Local<v8::Context> context, const DOMWrapperWorld& world, v8::Local<v8::Object> prototypeObject, v8::Local<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> interfaceTemplate)
|
| -{
|
| - v8::Isolate* isolate = context->GetIsolate();
|
| +void {{v8_class}}::preparePrototypeAndInterfaceObject(v8::Local<v8::Context> context, const DOMWrapperWorld& world, v8::Local<v8::Object> prototypeObject, v8::Local<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> interfaceTemplate) {
|
| + v8::Isolate* isolate = context->GetIsolate();
|
| {% if unscopables %}
|
| - {{install_unscopables() | indent}}
|
| + {{install_unscopables() | indent(2)}}
|
| {% endif %}
|
| {% if has_conditional_attributes_on_prototype %}
|
| - {{install_conditionally_enabled_attributes_on_prototype() | indent}}
|
| + {{install_conditionally_enabled_attributes_on_prototype() | indent(2)}}
|
| {% endif %}
|
| {% if methods | conditionally_exposed(is_partial) %}
|
| - {{install_conditionally_enabled_methods() | indent}}
|
| + {{install_conditionally_enabled_methods() | indent(2)}}
|
| {% endif %}
|
| }
|
|
|
| @@ -948,9 +917,9 @@ void {{v8_class}}::preparePrototypeAndInterfaceObject(v8::Local<v8::Context> con
|
| v8::Local<v8::Name> unscopablesSymbol(v8::Symbol::GetUnscopables(isolate));
|
| v8::Local<v8::Object> unscopables;
|
| if (v8CallBoolean(prototypeObject->HasOwnProperty(context, unscopablesSymbol)))
|
| - unscopables = prototypeObject->Get(context, unscopablesSymbol).ToLocalChecked().As<v8::Object>();
|
| + unscopables = prototypeObject->Get(context, unscopablesSymbol).ToLocalChecked().As<v8::Object>();
|
| else
|
| - unscopables = v8::Object::New(isolate);
|
| + unscopables = v8::Object::New(isolate);
|
| {% for name, runtime_enabled_function in unscopables %}
|
| {% filter runtime_enabled(runtime_enabled_function) %}
|
| unscopables->CreateDataProperty(context, v8AtomicString(isolate, "{{name}}"), v8::True(isolate)).FromJust();
|
| @@ -983,17 +952,15 @@ V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(), pro
|
| {% if has_partial_interface %}
|
| InstallTemplateFunction {{v8_class}}::install{{v8_class}}TemplateFunction = (InstallTemplateFunction)&{{v8_class}}::install{{v8_class}}Template;
|
|
|
| -void {{v8_class}}::updateWrapperTypeInfo(InstallTemplateFunction installTemplateFunction, PreparePrototypeAndInterfaceObjectFunction preparePrototypeAndInterfaceObjectFunction)
|
| -{
|
| - {{v8_class}}::install{{v8_class}}TemplateFunction = installTemplateFunction;
|
| - if (preparePrototypeAndInterfaceObjectFunction)
|
| - {{v8_class}}::wrapperTypeInfo.preparePrototypeAndInterfaceObjectFunction = preparePrototypeAndInterfaceObjectFunction;
|
| +void {{v8_class}}::updateWrapperTypeInfo(InstallTemplateFunction installTemplateFunction, PreparePrototypeAndInterfaceObjectFunction preparePrototypeAndInterfaceObjectFunction) {
|
| + {{v8_class}}::install{{v8_class}}TemplateFunction = installTemplateFunction;
|
| + if (preparePrototypeAndInterfaceObjectFunction)
|
| + {{v8_class}}::wrapperTypeInfo.preparePrototypeAndInterfaceObjectFunction = preparePrototypeAndInterfaceObjectFunction;
|
| }
|
|
|
| {% for method in methods if method.overloads and method.overloads.has_partial_overloads %}
|
| -void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInterface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&))
|
| -{
|
| - {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
|
| +void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInterface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) {
|
| + {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
|
| }
|
|
|
| {% endfor %}
|
|
|