| Index: third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
|
| diff --git a/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
|
| index a036d5839d10565c153094f907d8123dcc7e408e..b0e138457b2f328acd4606e122418b3ff82be430 100644
|
| --- a/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
|
| +++ b/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
|
| @@ -21,7 +21,7 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
|
| {% endif %}
|
|
|
| {% if not method.is_static %}
|
| - {% if method.returns_promise %}
|
| + {% if method.returns_promise or (interface_name == 'Window' and method.is_cross_origin) %}
|
| // V8DOMConfiguration::DoNotCheckHolder
|
| // Make sure that info.Holder() really points to an instance of the type.
|
| if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) {
|
| @@ -547,8 +547,16 @@ static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop
|
| static int domTemplateKey; // This address is used for a key to look up the dom template.
|
| V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
|
| const DOMWrapperWorld& world = DOMWrapperWorld::world(info.GetIsolate()->GetCurrentContext());
|
| +{% if interface_name == 'Window' %}
|
| + // Note: signature is intentionally omitted when creating origin-safe methods.
|
| + // A remote context's global proxy does not have the standard prototype chain
|
| + // set up, so v8 won't be able to find the receiver type in the prototype
|
| + // chain. Instead, the method implementation must do the check manually.
|
| + v8::Local<v8::Signature> signature;
|
| +{% else %}
|
| v8::Local<v8::FunctionTemplate> interfaceTemplate = data->findInterfaceTemplate(world, &{{v8_class}}::wrapperTypeInfo);
|
| v8::Local<v8::Signature> signature = v8::Signature::New(info.GetIsolate(), interfaceTemplate);
|
| +{% endif %}
|
|
|
| v8::Local<v8::FunctionTemplate> methodTemplate = data->findOrCreateOperationTemplate(world, &domTemplateKey, {{v8_class_or_partial}}::{{method.name}}MethodCallback{{world_suffix}}, v8Undefined(), signature, {{method.length}});
|
| // Return the function by default, unless the user script has overwritten it.
|
|
|