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

Unified Diff: third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl

Issue 2668753006: Special-case LocalDOMWindow for same-origin access in bindings. (Closed)
Patch Set: Rebase and address comments. 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/attributes.cpp.tmpl
diff --git a/third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl
index 5acc271f5b09ce22838c48f5bbefb94d0b58689a..8859c99a18ff1fd75d57130a632231878dab7a15 100644
--- a/third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl
@@ -43,8 +43,15 @@ const v8::FunctionCallbackInfo<v8::Value>& info
{% endif %}
{% if not attribute.is_static %}
+ {% if interface_name == 'Window' and not attribute.has_cross_origin_getter %}
+ // Same-origin attribute getters are never exposed via the cross-origin
+ // interceptors. Since same-origin access requires a LocalDOMWindow, it is
+ // safe to downcast here.
+ LocalDOMWindow* impl = toLocalDOMWindow({{v8_class}}::toImpl(holder));
+ {% else %}
{{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
{% endif %}
+ {% endif %}
{% if attribute.cached_attribute_validation_method %}
// [CachedAttribute]
@@ -282,9 +289,16 @@ v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info
if (!impl)
return;
{% else %}
+ {% if interface_name == 'Window' and not attribute.has_cross_origin_setter %}
+ // Same-origin attribute setters are never exposed via the cross-origin
+ // interceptors. Since same-origin access requires a LocalDOMWindow, it is
+ // safe to downcast here.
+ LocalDOMWindow* impl = toLocalDOMWindow({{v8_class}}::toImpl(holder));
+ {% else %}
{{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
{% endif %}
{% endif %}
+ {% endif %}
{% if attribute.is_check_security_for_receiver and not attribute.is_data_type_property %}
// Perform a security check for the receiver object.

Powered by Google App Engine
This is Rietveld 408576698