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

Unified 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: Tweak 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
diff --git a/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
index 16bb616edd9650a10e3230642c7b258e75331c56..24b0f71591cb85e5f2c8e972d141744584102df2 100644
--- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
@@ -218,7 +218,15 @@ static const struct {
{% for attribute in attributes if attribute.has_cross_origin_getter or attribute.has_cross_origin_setter %}
{
"{{attribute.name}}",
- {%+ if attribute.has_cross_origin_getter %}&{{cpp_class}}V8Internal::{{attribute.name}}AttributeGetter{% else %}nullptr{% endif %},
+ {% if attribute.has_cross_origin_getter %}
+ {% if attribute.has_custom_getter %}
+ {{v8_class}}::{{attribute.name}}AttributeGetterCustom,
+ {% else %}
+ &{{cpp_class}}V8Internal::{{attribute.name}}AttributeGetter,
+ {% endif %}
+ {% else %}
+ nullptr,
+ {% endif %}
{%+ if attribute.has_cross_origin_setter %}&{{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{% else %}nullptr{% endif %},
},
{% endfor %}
@@ -285,9 +293,11 @@ static const struct {
for (const auto& attribute : kCrossOriginAttributeTable)
names.push_back(attribute.name);
- v8SetReturnValue(
- info,
- ToV8(names, info.Holder(), info.GetIsolate()).As<v8::Array>());
+ // Use the current context as the creation context, as a cross-origin access
+ // may involve an object that does not have a creation context.
+ v8SetReturnValue(info,
+ ToV8(names, info.GetIsolate()->GetCurrentContext()->Global(),
+ info.GetIsolate()).As<v8::Array>());
Yuki 2017/01/24 10:31:04 Why do we need .As<v8::Array>()? I think we don't
}
{% endif %}

Powered by Google App Engine
This is Rietveld 408576698