Index: third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl |
diff --git a/third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl |
index a1be921da37bd29b7b66ee99cf8cd345b8798c89..cddda356ad6650cc3590e1dfb2fd9e9884b39a41 100644 |
--- a/third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl |
+++ b/third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl |
@@ -293,14 +293,11 @@ v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info |
return; // Return silently because of [LenientThis]. |
{% endif %} |
- {% if not attribute.is_static and not attribute.is_replaceable %} |
+ {% set check_security_for_receiver = attribute.is_check_security_for_receiver and not attribute.is_data_type_property %} |
Jens Widell
2017/03/06 14:05:28
The reason I changed things a bit around the secur
haraken
2017/03/06 18:57:28
Just to confirm: This CL is not changing the condi
|
+ |
+ {% if not attribute.is_static and not attribute.is_replaceable and |
+ (not attribute.is_put_forwards or check_security_for_receiver) %} |
v8::Local<v8::Object> holder = info.Holder(); |
- {% if attribute.is_put_forwards %} |
- {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder); |
- {{attribute.cpp_type}} impl = WTF::getPtr(proxyImpl->{{attribute.name}}()); |
- if (!impl) |
- return; |
- {% else %} |
{% set local_dom_window_only = interface_name == 'Window' and not attribute.has_cross_origin_setter %} |
{% if local_dom_window_only %} |
{% if attribute.is_check_security_for_receiver %} |
@@ -315,9 +312,8 @@ v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info |
{{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
{% endif %}{# local_dom_window_only #} |
{% endif %} |
- {% endif %} |
- {% if attribute.is_check_security_for_receiver and not attribute.is_data_type_property %} |
+ {% if check_security_for_receiver %} |
// Perform a security check for the receiver object. |
{{define_exception_state}} |
{% if local_dom_window_only %} |
@@ -337,6 +333,17 @@ v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info |
#error Attribute setter with the security check for the return value is not supported. Since the return value is the given value to be set, it\'s meaningless to perform the security check for the return value. |
{% endif %} |
+ {% if attribute.is_put_forwards %} |
+ {{define_exception_state}} |
+ v8::Local<v8::Value> target; |
+ if (!info.Holder()->Get(info.GetIsolate()->GetEnteredContext(), v8String(info.GetIsolate(), "{{attribute.name}}")).ToLocal(&target)) |
+ return; |
+ if (!target->IsObject()) { |
+ exceptionState.throwTypeError("The attribute value is not an object"); |
+ return; |
+ } |
+ target.As<v8::Object>()->Set(info.GetIsolate()->GetEnteredContext(), v8String(info.GetIsolate(), "{{attribute.target_attribute_name}}"), v8Value).IsNothing(); |
Jens Widell
2017/03/06 14:05:28
Note on use of `GetEnteredContext()` here: using `
haraken
2017/03/06 18:57:28
Yeah, I think this is because Chromium has not yet
jochen (gone - plz use gerrit)
2017/03/07 11:45:06
GetEnteredContext is also wrong during microtask e
haraken
2017/03/07 12:15:22
Jens: I'm confused. The context parameter in Get()
|
+ {% else %} |
{% if attribute.is_custom_element_callbacks or |
(attribute.is_reflect and not (attribute.idl_type == 'DOMString' and is_node)) %} |
// Skip on compact node DOMString getters. |
@@ -397,6 +404,7 @@ v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info |
// Invalidate the cached value. |
V8HiddenValue::deleteHiddenValue(ScriptState::forFunctionObject(info), holder, v8AtomicString(info.GetIsolate(), "{{attribute.name}}")); |
{% endif %} |
+ {% endif %}{# is_put_forwards #} |
} |
{% endfilter %}{# format_remove_duplicates #} |
{% endmacro %} |