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

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: . 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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 postMessageImpl("{{interface_name}}", {{v8_class}}::toImpl(info.Holder()), inf o); 519 postMessageImpl("{{interface_name}}", {{v8_class}}::toImpl(info.Holder()), inf o);
520 {% else %} 520 {% else %}
521 {{cpp_class_or_partial}}V8Internal::{{method.name}}Method{{world_suffix}}(info ); 521 {{cpp_class_or_partial}}V8Internal::{{method.name}}Method{{world_suffix}}(info );
522 {% endif %} 522 {% endif %}
523 } 523 }
524 {% endmacro %} 524 {% endmacro %}
525 525
526 526
527 {##############################################################################} 527 {##############################################################################}
528 {% macro origin_safe_method_getter(method, world_suffix) %} 528 {% macro origin_safe_method_getter(method, world_suffix) %}
529 {# TODO(dcheng): Currently, bindings must create a function object for each
530 realm as a hack to support the incumbent realm. Clean this up when Blink
531 properly supports the incumbent realm. #}
529 static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop ertyCallbackInfo<v8::Value>& info) { 532 static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop ertyCallbackInfo<v8::Value>& info) {
530 static int domTemplateKey; // This address is used for a key to look up the do m template. 533 static int domTemplateKey; // This address is used for a key to look up the do m template.
531 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); 534 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
532 const DOMWrapperWorld& world = DOMWrapperWorld::world(info.GetIsolate()->GetCu rrentContext()); 535 const DOMWrapperWorld& world = DOMWrapperWorld::world(info.GetIsolate()->GetCu rrentContext());
533 v8::Local<v8::FunctionTemplate> interfaceTemplate = data->findInterfaceTemplat e(world, &{{v8_class}}::wrapperTypeInfo); 536 v8::Local<v8::FunctionTemplate> interfaceTemplate = data->findInterfaceTemplat e(world, &{{v8_class}}::wrapperTypeInfo);
534 v8::Local<v8::Signature> signature = v8::Signature::New(info.GetIsolate(), int erfaceTemplate); 537 v8::Local<v8::Signature> signature = v8::Signature::New(info.GetIsolate(), int erfaceTemplate);
535 538
536 v8::Local<v8::FunctionTemplate> methodTemplate = data->findOrCreateOperationTe mplate(world, &domTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCal lback{{world_suffix}}, v8Undefined(), signature, {{method.length}}); 539 v8::Local<v8::FunctionTemplate> methodTemplate = data->findOrCreateOperationTe mplate(world, &domTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCal lback{{world_suffix}}, v8Undefined(), signature, {{method.length}});
537 // Return the function by default, unless the user script has overwritten it. 540 // Return the function by default, unless the user script has overwritten it.
538 v8SetReturnValue(info, methodTemplate->GetFunction(info.GetIsolate()->GetCurre ntContext()).ToLocalChecked()); 541 v8SetReturnValue(info, methodTemplate->GetFunction(info.GetIsolate()->GetCurre ntContext()).ToLocalChecked());
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 if method.overloads else 682 if method.overloads else
680 method.runtime_enabled_function) %} 683 method.runtime_enabled_function) %}
681 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; 684 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
682 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); 685 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration);
683 {% endfilter %}{# runtime_enabled() #} 686 {% endfilter %}{# runtime_enabled() #}
684 {% endfilter %}{# exposed() #} 687 {% endfilter %}{# exposed() #}
685 {% endfilter %}{# secure_context() #} 688 {% endfilter %}{# secure_context() #}
686 {% endfor %} 689 {% endfor %}
687 {% endif %} 690 {% endif %}
688 {%- endmacro %} 691 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698