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

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: Address review comments. Created 3 years, 9 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 {% if named_property_getter and named_property_getter.is_cross_origin %} 269 {% if named_property_getter and named_property_getter.is_cross_origin %}
270 {% if named_property_getter.is_custom %} 270 {% if named_property_getter.is_custom %}
271 {{v8_class}}::namedPropertyGetterCustom(propertyName, info); 271 {{v8_class}}::namedPropertyGetterCustom(propertyName, info);
272 {% else %} 272 {% else %}
273 {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info); 273 {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info);
274 {% endif %} 274 {% endif %}
275 {% else %} 275 {% else %}
276 BindingSecurity::failedAccessCheckFor( 276 BindingSecurity::failedAccessCheckFor(
277 info.GetIsolate(), 277 info.GetIsolate(),
278 {{v8_class}}::toImpl(info.Holder())->frame()); 278 &{{v8_class}}::wrapperTypeInfo,
279 info.Holder());
279 {% endif %} 280 {% endif %}
280 } 281 }
281 {% endif %} 282 {% endif %}
282 283
283 {% if has_cross_origin_named_setter %} 284 {% if has_cross_origin_named_setter %}
284 void {{v8_class_or_partial}}::crossOriginNamedSetter(v8::Local<v8::Name> name, v 8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) { 285 void {{v8_class_or_partial}}::crossOriginNamedSetter(v8::Local<v8::Name> name, v 8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) {
285 if (!name->IsString()) 286 if (!name->IsString())
286 return; 287 return;
287 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>()); 288 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
288 289
289 for (const auto& attribute : {{cpp_class_or_partial}}V8Internal::kCrossOriginA ttributeTable) { 290 for (const auto& attribute : {{cpp_class_or_partial}}V8Internal::kCrossOriginA ttributeTable) {
290 if (propertyName == attribute.name && attribute.setter) { 291 if (propertyName == attribute.name && attribute.setter) {
291 attribute.setter(value, V8CrossOriginSetterInfo(info.GetIsolate(), info.Ho lder())); 292 attribute.setter(value, V8CrossOriginSetterInfo(info.GetIsolate(), info.Ho lder()));
292 return; 293 return;
293 } 294 }
294 } 295 }
295 296
296 {# If there were no matches in the cross-origin attribute table, consider it 297 {# If there were no matches in the cross-origin attribute table, consider it
297 an access check failure: there are no custom named setters that are 298 an access check failure: there are no custom named setters that are
298 accessible from a cross-origin context. #} 299 accessible from a cross-origin context. #}
299 300
300 BindingSecurity::failedAccessCheckFor( 301 BindingSecurity::failedAccessCheckFor(
301 info.GetIsolate(), 302 info.GetIsolate(),
302 {{v8_class}}::toImpl(info.Holder())->frame()); 303 &{{v8_class}}::wrapperTypeInfo,
304 info.Holder());
303 } 305 }
304 {% endif %} 306 {% endif %}
305 307
306 {% if has_cross_origin_named_enumerator %} 308 {% if has_cross_origin_named_enumerator %}
307 void {{v8_class_or_partial}}::crossOriginNamedEnumerator(const v8::PropertyCallb ackInfo<v8::Array>& info) { 309 void {{v8_class_or_partial}}::crossOriginNamedEnumerator(const v8::PropertyCallb ackInfo<v8::Array>& info) {
308 Vector<String> names; 310 Vector<String> names;
309 for (const auto& attribute : {{cpp_class_or_partial}}V8Internal::kCrossOriginA ttributeTable) 311 for (const auto& attribute : {{cpp_class_or_partial}}V8Internal::kCrossOriginA ttributeTable)
310 names.push_back(attribute.name); 312 names.push_back(attribute.name);
311 313
312 // Use the current context as the creation context, as a cross-origin access 314 // Use the current context as the creation context, as a cross-origin access
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 {% endif %} 739 {% endif %}
738 } 740 }
739 {% endif %} 741 {% endif %}
740 742
741 {% endblock %} 743 {% endblock %}
742 {##############################################################################} 744 {##############################################################################}
743 {% block partial_interface %}{% endblock %} 745 {% block partial_interface %}{% endblock %}
744 } // namespace blink 746 } // namespace blink
745 747
746 {% endfilter %}{# format_blink_cpp_source_code #} 748 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698