Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl

Issue 2439013002: Implement cross-origin attributes using access check interceptors. (Closed)
Patch Set: Address feedback and fix cross-origin location set Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t o_local_cpp_value %} 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t o_local_cpp_value %}
2 2
3 {##############################################################################} 3 {##############################################################################}
4 {% macro attribute_getter(attribute, world_suffix) %} 4 {% macro attribute_getter(attribute, world_suffix) %}
5 static void {{attribute.name}}AttributeGetter{{world_suffix}}( 5 static void {{attribute.name}}AttributeGetter{{world_suffix}}(
6 {%- if attribute.is_data_type_property %} 6 {%- if attribute.is_data_type_property %}
7 const v8::PropertyCallbackInfo<v8::Value>& info 7 const v8::PropertyCallbackInfo<v8::Value>& info
8 {%- else %} 8 {%- else %}
9 const v8::FunctionCallbackInfo<v8::Value>& info 9 const v8::FunctionCallbackInfo<v8::Value>& info
10 {%- endif %}) { 10 {%- endif %}) {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 {% endif %} 243 {% endif %}
244 244
245 v8ConstructorAttributeGetter(property, info); 245 v8ConstructorAttributeGetter(property, info);
246 } 246 }
247 {% endmacro %} 247 {% endmacro %}
248 248
249 249
250 {##############################################################################} 250 {##############################################################################}
251 {% macro attribute_setter(attribute, world_suffix) %} 251 {% macro attribute_setter(attribute, world_suffix) %}
252 static void {{attribute.name}}AttributeSetter{{world_suffix}}( 252 static void {{attribute.name}}AttributeSetter{{world_suffix}}(
253 {%- if attribute.is_data_type_property %} 253 {%- if attribute.has_cross_origin_setter %}
254 v8::Local<v8::Value> v8Value, const V8CrossOriginSetterInfo& info
255 {%- elif attribute.is_data_type_property %}
254 v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info 256 v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info
255 {%- else %} 257 {%- else %}
256 v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info 258 v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info
257 {%- endif %}) { 259 {%- endif %}) {
258 {% filter format_remove_duplicates(['ExceptionState exceptionState']) %} 260 {% filter format_remove_duplicates(['ExceptionState exceptionState']) %}
259 {% set define_exception_state -%} 261 {% set define_exception_state -%}
260 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext , "{{interface_name}}", "{{attribute.name}}"); 262 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext , "{{interface_name}}", "{{attribute.name}}");
261 {%- endset %} 263 {%- endset %}
262 264
263 {% if attribute.is_lenient_this %} 265 {% if attribute.is_lenient_this %}
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 {% if attribute.is_ce_reactions %} 398 {% if attribute.is_ce_reactions %}
397 CEReactionsScope ceReactionsScope; 399 CEReactionsScope ceReactionsScope;
398 {% endif %} 400 {% endif %}
399 401
400 {% if attribute.is_custom_element_callbacks or attribute.is_reflect %} 402 {% if attribute.is_custom_element_callbacks or attribute.is_reflect %}
401 V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; 403 V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
402 {% endif %} 404 {% endif %}
403 405
404 {% if attribute.has_custom_setter %} 406 {% if attribute.has_custom_setter %}
405 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info); 407 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info);
408 {% elif attribute.has_cross_origin_setter %}
409 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeSetter{{world_s uffix}}(v8Value, V8CrossOriginSetterInfo(info.GetIsolate(), info.Holder()));
406 {% else %} 410 {% else %}
407 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeSetter{{world_s uffix}}(v8Value, info); 411 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeSetter{{world_s uffix}}(v8Value, info);
408 {% endif %} 412 {% endif %}
409 } 413 }
410 {% endmacro %} 414 {% endmacro %}
411 415
412 416
413 {##############################################################################} 417 {##############################################################################}
414 {% macro attribute_getter_implemented_in_private_script(attribute) %} 418 {% macro attribute_getter_implemented_in_private_script(attribute) %}
415 bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeGetter(LocalFrame* frame, {{cpp_class}}* holderImpl, {{attribute.cpp_type}}* result) { 419 bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeGetter(LocalFrame* frame, {{cpp_class}}* holderImpl, {{attribute.cpp_type}}* result) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 setter_callback_for_main_world, 511 setter_callback_for_main_world,
508 wrapper_type_info, 512 wrapper_type_info,
509 access_control, 513 access_control,
510 property_attribute, 514 property_attribute,
511 only_exposed_to_private_script, 515 only_exposed_to_private_script,
512 property_location(attribute), 516 property_location(attribute),
513 holder_check, 517 holder_check,
514 ] %} 518 ] %}
515 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} 519 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}}
516 {%- endmacro %} 520 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698