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

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

Issue 2640123006: Use the current context as the creation context for cross-origin objects. (Closed)
Patch Set: Per-world NewRemoteInstance Created 3 years, 11 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 using SetterCallback = void(*)(v8::Local<v8::Value>, const V8CrossOriginSetter Info&); 211 using SetterCallback = void(*)(v8::Local<v8::Value>, const V8CrossOriginSetter Info&);
212 212
213 const char* const name; 213 const char* const name;
214 const GetterCallback getter; 214 const GetterCallback getter;
215 const SetterCallback setter; 215 const SetterCallback setter;
216 } kCrossOriginAttributeTable[] = { 216 } kCrossOriginAttributeTable[] = {
217 {##### Cross-origin attributes #####} 217 {##### Cross-origin attributes #####}
218 {% for attribute in attributes if attribute.has_cross_origin_getter or attribu te.has_cross_origin_setter %} 218 {% for attribute in attributes if attribute.has_cross_origin_getter or attribu te.has_cross_origin_setter %}
219 { 219 {
220 "{{attribute.name}}", 220 "{{attribute.name}}",
221 {%+ if attribute.has_cross_origin_getter %}&{{cpp_class}}V8Internal::{{attri bute.name}}AttributeGetter{% else %}nullptr{% endif %}, 221 {% if attribute.has_cross_origin_getter %}
222 {% if attribute.has_custom_getter %}
223 {{v8_class}}::{{attribute.name}}AttributeGetterCustom,
224 {% else %}
225 &{{cpp_class}}V8Internal::{{attribute.name}}AttributeGetter,
226 {% endif %}
227 {% else %}
228 nullptr,
229 {% endif %}
222 {%+ if attribute.has_cross_origin_setter %}&{{cpp_class}}V8Internal::{{attri bute.name}}AttributeSetter{% else %}nullptr{% endif %}, 230 {%+ if attribute.has_cross_origin_setter %}&{{cpp_class}}V8Internal::{{attri bute.name}}AttributeSetter{% else %}nullptr{% endif %},
223 }, 231 },
224 {% endfor %} 232 {% endfor %}
225 {##### Cross-origin methods #####} 233 {##### Cross-origin methods #####}
226 {% for method in methods if method.is_cross_origin %} 234 {% for method in methods if method.is_cross_origin %}
227 {"{{method.name}}", &{{cpp_class}}V8Internal::{{method.name}}OriginSafeMethodG etter, nullptr}, 235 {"{{method.name}}", &{{cpp_class}}V8Internal::{{method.name}}OriginSafeMethodG etter, nullptr},
228 {% endfor %} 236 {% endfor %}
229 }; 237 };
230 {% endif %} 238 {% endif %}
231 239
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 {{v8_class}}::toImpl(info.Holder())->frame()); 286 {{v8_class}}::toImpl(info.Holder())->frame());
279 } 287 }
280 {% endif %} 288 {% endif %}
281 289
282 {% if has_cross_origin_named_enumerator %} 290 {% if has_cross_origin_named_enumerator %}
283 {{exported}}void crossOriginNamedEnumerator(const v8::PropertyCallbackInfo<v8::A rray>& info) { 291 {{exported}}void crossOriginNamedEnumerator(const v8::PropertyCallbackInfo<v8::A rray>& info) {
284 Vector<String> names; 292 Vector<String> names;
285 for (const auto& attribute : kCrossOriginAttributeTable) 293 for (const auto& attribute : kCrossOriginAttributeTable)
286 names.push_back(attribute.name); 294 names.push_back(attribute.name);
287 295
288 v8SetReturnValue( 296 // Use the current context as the creation context, as a cross-origin access
289 info, 297 // may involve an object that does not have a creation context.
haraken 2017/01/25 03:24:12 Can we add a dcheck to assert that this happens on
dcheng 2017/01/26 02:12:03 This is also used for Window though. Rather than a
290 ToV8(names, info.Holder(), info.GetIsolate()).As<v8::Array>()); 298 v8SetReturnValue(info,
299 ToV8(names, info.GetIsolate()->GetCurrentContext()->Global(),
300 info.GetIsolate()).As<v8::Array>());
291 } 301 }
292 {% endif %} 302 {% endif %}
293 303
294 {% if has_cross_origin_indexed_getter %} 304 {% if has_cross_origin_indexed_getter %}
295 {{exported}}void crossOriginIndexedGetter(uint32_t index, const v8::PropertyCall backInfo<v8::Value>& info) { 305 {{exported}}void crossOriginIndexedGetter(uint32_t index, const v8::PropertyCall backInfo<v8::Value>& info) {
296 {% if indexed_property_getter.is_custom %} 306 {% if indexed_property_getter.is_custom %}
297 {{v8_class}}::indexedPropertyGetterCustom(index, info); 307 {{v8_class}}::indexedPropertyGetterCustom(index, info);
298 {% else %} 308 {% else %}
299 {{cpp_class}}V8Internal::indexedPropertyGetter(index, info); 309 {{cpp_class}}V8Internal::indexedPropertyGetter(index, info);
300 {% endif %} 310 {% endif %}
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 {% block has_instance %}{% endblock %} 664 {% block has_instance %}{% endblock %}
655 {% block to_impl %}{% endblock %} 665 {% block to_impl %}{% endblock %}
656 {% block to_impl_with_type_check %}{% endblock %} 666 {% block to_impl_with_type_check %}{% endblock %}
657 {##############################################################################} 667 {##############################################################################}
658 {% block prepare_prototype_and_interface_object %}{% endblock %} 668 {% block prepare_prototype_and_interface_object %}{% endblock %}
659 {##############################################################################} 669 {##############################################################################}
660 {% block partial_interface %}{% endblock %} 670 {% block partial_interface %}{% endblock %}
661 } // namespace blink 671 } // namespace blink
662 672
663 {% endfilter %}{# format_blink_cpp_source_code #} 673 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698