Chromium Code Reviews| 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 %} |