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

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

Issue 1417023006: bindings: Refactors BindingSecurity::shouldAllowAccessToXXX. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the assertion condition. Created 5 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 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% block indexed_property_getter %} 5 {% block indexed_property_getter %}
6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} 6 {% if indexed_property_getter and not indexed_property_getter.is_custom %}
7 {% set getter = indexed_property_getter %} 7 {% set getter = indexed_property_getter %}
8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) 8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info)
9 { 9 {
10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 {% block origin_safe_method_setter %} 443 {% block origin_safe_method_setter %}
444 {% if has_origin_safe_method_setter %} 444 {% if has_origin_safe_method_setter %}
445 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::Name> name, v8::Lo cal<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 445 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::Name> name, v8::Lo cal<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
446 { 446 {
447 v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(in fo.This(), info.GetIsolate()); 447 v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(in fo.This(), info.GetIsolate());
448 if (holder.IsEmpty()) 448 if (holder.IsEmpty())
449 return; 449 return;
450 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); 450 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
451 v8::String::Utf8Value attributeName(name); 451 v8::String::Utf8Value attributeName(name);
452 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate()); 452 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate());
453 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), callingDOM Window(info.GetIsolate()), impl->frame(), exceptionState)) { 453 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo w(info.GetIsolate()), impl, exceptionState)) {
454 exceptionState.throwIfNeeded(); 454 exceptionState.throwIfNeeded();
455 return; 455 return;
456 } 456 }
457 457
458 {# The findInstanceInPrototypeChain() call above only returns a non-empty ha ndle if info.This() is an Object. #} 458 {# The findInstanceInPrototypeChain() call above only returns a non-empty ha ndle if info.This() is an Object. #}
459 V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), v8::L ocal<v8::Object>::Cast(info.This()), name.As<v8::String>(), v8Value); 459 V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), v8::L ocal<v8::Object>::Cast(info.This()), name.As<v8::String>(), v8Value);
460 } 460 }
461 461
462 static void {{cpp_class}}OriginSafeMethodSetterCallback(v8::Local<v8::Name> name , v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 462 static void {{cpp_class}}OriginSafeMethodSetterCallback(v8::Local<v8::Name> name , v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
463 { 463 {
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 978
979 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 979 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
980 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) 980 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&))
981 { 981 {
982 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; 982 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
983 } 983 }
984 984
985 {% endfor %} 985 {% endfor %}
986 {% endif %} 986 {% endif %}
987 {% endblock %} 987 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698