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

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

Issue 2439013002: Implement cross-origin attributes using access check interceptors. (Closed)
Patch Set: Clean up named enumerator interceptor. Created 4 years 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 generate_method(method, world_suffix) %} 4 {% macro generate_method(method, world_suffix) %}
5 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) { 5 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) {
6 {% filter format_remove_duplicates([ 6 {% filter format_remove_duplicates([
7 'ExceptionState exceptionState', 7 'ExceptionState exceptionState',
8 'ScriptState* scriptState = ']) %} 8 'ScriptState* scriptState = ']) %}
9 {% set define_exception_state -%} 9 {% set define_exception_state -%}
10 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCont ext, "{{interface_name}}", "{{method.name}}"); 10 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCont ext, "{{interface_name}}", "{{method.name}}");
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 postMessageImpl("{{interface_name}}", {{v8_class}}::toImpl(info.Holder()), inf o); 513 postMessageImpl("{{interface_name}}", {{v8_class}}::toImpl(info.Holder()), inf o);
514 {% else %} 514 {% else %}
515 {{cpp_class_or_partial}}V8Internal::{{method.name}}Method{{world_suffix}}(info ); 515 {{cpp_class_or_partial}}V8Internal::{{method.name}}Method{{world_suffix}}(info );
516 {% endif %} 516 {% endif %}
517 } 517 }
518 {% endmacro %} 518 {% endmacro %}
519 519
520 520
521 {##############################################################################} 521 {##############################################################################}
522 {% macro origin_safe_method_getter(method, world_suffix) %} 522 {% macro origin_safe_method_getter(method, world_suffix) %}
523 {# TODO(dcheng): This shouldn't be necessary with cross-origin interceptors, but
524 v8 doesn't support querying the incumbent context. For now, always
Yuki 2016/12/07 12:03:41 ditto
525 incorrectly create per-realm representations. #}
523 static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop ertyCallbackInfo<v8::Value>& info) { 526 static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop ertyCallbackInfo<v8::Value>& info) {
524 static int domTemplateKey; // This address is used for a key to look up the do m template. 527 static int domTemplateKey; // This address is used for a key to look up the do m template.
525 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); 528 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
526 const DOMWrapperWorld& world = DOMWrapperWorld::world(info.GetIsolate()->GetCu rrentContext()); 529 const DOMWrapperWorld& world = DOMWrapperWorld::world(info.GetIsolate()->GetCu rrentContext());
527 v8::Local<v8::FunctionTemplate> interfaceTemplate = data->findInterfaceTemplat e(world, &{{v8_class}}::wrapperTypeInfo); 530 v8::Local<v8::FunctionTemplate> interfaceTemplate = data->findInterfaceTemplat e(world, &{{v8_class}}::wrapperTypeInfo);
528 v8::Local<v8::Signature> signature = v8::Signature::New(info.GetIsolate(), int erfaceTemplate); 531 v8::Local<v8::Signature> signature = v8::Signature::New(info.GetIsolate(), int erfaceTemplate);
529 532
530 v8::Local<v8::FunctionTemplate> methodTemplate = data->findOrCreateOperationTe mplate(world, &domTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCal lback{{world_suffix}}, v8Undefined(), signature, {{method.length}}); 533 v8::Local<v8::FunctionTemplate> methodTemplate = data->findOrCreateOperationTe mplate(world, &domTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCal lback{{world_suffix}}, v8Undefined(), signature, {{method.length}});
531 // Return the function by default, unless the user script has overwritten it. 534 // Return the function by default, unless the user script has overwritten it.
532 v8SetReturnValue(info, methodTemplate->GetFunction(info.GetIsolate()->GetCurre ntContext()).ToLocalChecked()); 535 v8SetReturnValue(info, methodTemplate->GetFunction(info.GetIsolate()->GetCurre ntContext()).ToLocalChecked());
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 if method.overloads else 676 if method.overloads else
674 method.runtime_enabled_function) %} 677 method.runtime_enabled_function) %}
675 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; 678 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
676 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); 679 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration);
677 {% endfilter %}{# runtime_enabled() #} 680 {% endfilter %}{# runtime_enabled() #}
678 {% endfilter %}{# exposed() #} 681 {% endfilter %}{# exposed() #}
679 {% endfilter %}{# secure_context() #} 682 {% endfilter %}{# secure_context() #}
680 {% endfor %} 683 {% endfor %}
681 {% endif %} 684 {% endif %}
682 {%- endmacro %} 685 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698