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

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

Issue 2706923002: Rework security checks to be based on Window rather than Frame. (Closed)
Patch Set: Do not hardcode V8Window::wrapperTypeInfo Created 3 years, 7 months 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 {% filter format_blink_cpp_source_code %} 1 {% filter format_blink_cpp_source_code %}
2 2
3 {% include 'copyright_block.txt' %} 3 {% include 'copyright_block.txt' %}
4 #include "{{v8_class_or_partial}}.h" 4 #include "{{v8_class_or_partial}}.h"
5 5
6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} 6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %}
7 #include "{{filename}}" 7 #include "{{filename}}"
8 {% endfor %} 8 {% endfor %}
9 9
10 namespace blink { 10 namespace blink {
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 266
267 {% if named_property_getter and named_property_getter.is_cross_origin %} 267 {% if named_property_getter and named_property_getter.is_cross_origin %}
268 {% if named_property_getter.is_custom %} 268 {% if named_property_getter.is_custom %}
269 {{v8_class}}::namedPropertyGetterCustom(propertyName, info); 269 {{v8_class}}::namedPropertyGetterCustom(propertyName, info);
270 {% else %} 270 {% else %}
271 {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info); 271 {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info);
272 {% endif %} 272 {% endif %}
273 {% else %} 273 {% else %}
274 BindingSecurity::FailedAccessCheckFor( 274 BindingSecurity::FailedAccessCheckFor(
275 info.GetIsolate(), 275 info.GetIsolate(),
276 {{v8_class}}::toImpl(info.Holder())->GetFrame()); 276 &{{v8_class}}::wrapperTypeInfo,
277 info.Holder());
277 {% endif %} 278 {% endif %}
278 } 279 }
279 {% endif %} 280 {% endif %}
280 281
281 {% if has_cross_origin_named_setter %} 282 {% if has_cross_origin_named_setter %}
282 void {{v8_class_or_partial}}::crossOriginNamedSetter(v8::Local<v8::Name> name, v 8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) { 283 void {{v8_class_or_partial}}::crossOriginNamedSetter(v8::Local<v8::Name> name, v 8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) {
283 if (!name->IsString()) 284 if (!name->IsString())
284 return; 285 return;
285 const AtomicString& propertyName = ToCoreAtomicString(name.As<v8::String>()); 286 const AtomicString& propertyName = ToCoreAtomicString(name.As<v8::String>());
286 287
287 for (const auto& attribute : {{cpp_class_or_partial}}V8Internal::kCrossOriginA ttributeTable) { 288 for (const auto& attribute : {{cpp_class_or_partial}}V8Internal::kCrossOriginA ttributeTable) {
288 if (propertyName == attribute.name && attribute.setter) { 289 if (propertyName == attribute.name && attribute.setter) {
289 attribute.setter(value, V8CrossOriginSetterInfo(info.GetIsolate(), info.Ho lder())); 290 attribute.setter(value, V8CrossOriginSetterInfo(info.GetIsolate(), info.Ho lder()));
290 return; 291 return;
291 } 292 }
292 } 293 }
293 294
294 {# If there were no matches in the cross-origin attribute table, consider it 295 {# If there were no matches in the cross-origin attribute table, consider it
295 an access check failure: there are no custom named setters that are 296 an access check failure: there are no custom named setters that are
296 accessible from a cross-origin context. #} 297 accessible from a cross-origin context. #}
297 298
298 BindingSecurity::FailedAccessCheckFor( 299 BindingSecurity::FailedAccessCheckFor(
299 info.GetIsolate(), 300 info.GetIsolate(),
300 {{v8_class}}::toImpl(info.Holder())->GetFrame()); 301 &{{v8_class}}::wrapperTypeInfo,
302 info.Holder());
301 } 303 }
302 {% endif %} 304 {% endif %}
303 305
304 {% if has_cross_origin_named_enumerator %} 306 {% if has_cross_origin_named_enumerator %}
305 void {{v8_class_or_partial}}::crossOriginNamedEnumerator(const v8::PropertyCallb ackInfo<v8::Array>& info) { 307 void {{v8_class_or_partial}}::crossOriginNamedEnumerator(const v8::PropertyCallb ackInfo<v8::Array>& info) {
306 Vector<String> names; 308 Vector<String> names;
307 for (const auto& attribute : {{cpp_class_or_partial}}V8Internal::kCrossOriginA ttributeTable) 309 for (const auto& attribute : {{cpp_class_or_partial}}V8Internal::kCrossOriginA ttributeTable)
308 names.push_back(attribute.name); 310 names.push_back(attribute.name);
309 311
310 // Use the current context as the creation context, as a cross-origin access 312 // Use the current context as the creation context, as a cross-origin access
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 {% endif %} 809 {% endif %}
808 } 810 }
809 {% endif %} 811 {% endif %}
810 812
811 {% endblock %} 813 {% endblock %}
812 {##############################################################################} 814 {##############################################################################}
813 {% block partial_interface %}{% endblock %} 815 {% block partial_interface %}{% endblock %}
814 } // namespace blink 816 } // namespace blink
815 817
816 {% endfilter %}{# format_blink_cpp_source_code #} 818 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698