| Index: Source/bindings/templates/attributes.cpp
|
| diff --git a/Source/bindings/templates/attributes.cpp b/Source/bindings/templates/attributes.cpp
|
| index d1e9c6af832be89932b24f425dfd86744edd7bcc..e5a17b06a86846b959e08804fdd23574e67d3164 100644
|
| --- a/Source/bindings/templates/attributes.cpp
|
| +++ b/Source/bindings/templates/attributes.cpp
|
| @@ -18,8 +18,16 @@ const v8::PropertyCallbackInfo<v8::Value>& info
|
| {% endif %}
|
| {# holder #}
|
| {% if not attribute.is_static %}
|
| + {% if attribute.is_lenient_this %}
|
| + v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(info.This(), info.GetIsolate());
|
| + if (holder.IsEmpty())
|
| + return; // Return silently because of [LenientThis].
|
| + // Note that it's okay to use |holder|, but |info.Holder()| is still unsafe
|
| + // and must not be used.
|
| + {% else %}
|
| v8::Local<v8::Object> holder = info.Holder();
|
| {% endif %}
|
| + {% endif %}
|
| {# impl #}
|
| {% if attribute.cached_attribute_validation_method %}
|
| v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{attribute.name}}");
|
| @@ -258,8 +266,16 @@ v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info
|
| not attribute.is_replaceable and
|
| not attribute.constructor_type) or
|
| raise_exception %}
|
| + {% if attribute.is_lenient_this %}
|
| + v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(info.This(), info.GetIsolate());
|
| + if (holder.IsEmpty())
|
| + return; // Return silently because of [LenientThis].
|
| + // Note that it's okay to use |holder|, but |info.Holder()| is still unsafe
|
| + // and must not be used.
|
| + {% else %}
|
| v8::Local<v8::Object> holder = info.Holder();
|
| {% endif %}
|
| + {% endif %}
|
| {% if raise_exception %}
|
| ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.name}}", "{{interface_name}}", holder, info.GetIsolate());
|
| {% endif %}
|
| @@ -515,6 +531,8 @@ bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeSetter(LocalFrame*
|
| {% set on_prototype = 'V8DOMConfiguration::OnPrototype'
|
| if interface_name == 'Window' and attribute.idl_type == 'EventHandler'
|
| else 'V8DOMConfiguration::OnInstance' %}
|
| +{% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder'
|
| + if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %}
|
| {% set attribute_configuration_list = [
|
| '"%s"' % attribute.name,
|
| getter_callback,
|
| @@ -526,7 +544,10 @@ bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeSetter(LocalFrame*
|
| property_attribute,
|
| only_exposed_to_private_script,
|
| ] %}
|
| -{% if not attribute.is_expose_js_accessors %}
|
| +{% if attribute.is_expose_js_accessors %}
|
| +{% set attribute_configuration_list = attribute_configuration_list
|
| + + [holder_check] %}
|
| +{% else %}
|
| {% set attribute_configuration_list = attribute_configuration_list
|
| + [on_prototype] %}
|
| {% endif %}
|
|
|