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

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

Issue 1380503002: binding: Makes Window/Location's attributes accessor-type properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated a test result. Created 4 years, 8 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
diff --git a/third_party/WebKit/Source/bindings/templates/attributes.cpp b/third_party/WebKit/Source/bindings/templates/attributes.cpp
index c5214d31fcee500ff52c725f4458158e5b256f5f..a1729f51f727456c0e2b1d8291db0942488998d4 100644
--- a/third_party/WebKit/Source/bindings/templates/attributes.cpp
+++ b/third_party/WebKit/Source/bindings/templates/attributes.cpp
@@ -21,11 +21,13 @@ const v8::FunctionCallbackInfo<v8::Value>& info
{% if not attribute.is_static %}
{% if attribute.is_lenient_this %}
{# Make sure that info.Holder() really points to an instance if [LenientThis]. #}
- if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate()))
+ v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(info.This(), info.GetIsolate());
+ if (holder.IsEmpty())
return; // Return silently because of [LenientThis].
- {% endif %}
+ {% else %}
v8::Local<v8::Object> holder = info.Holder();
{% endif %}
+ {% endif %}
{# impl #}
{% if attribute.cached_attribute_validation_method %}
v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{attribute.name}}");
@@ -76,7 +78,7 @@ const v8::FunctionCallbackInfo<v8::Value>& info
{% if not attribute.is_data_type_property %}
{% if attribute.is_check_security_for_receiver %}
if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), impl, exceptionState)) {
- v8SetReturnValueNull(info);
+ {{attribute.v8_set_return_value_for_security_failure}};
exceptionState.throwIfNeeded();
return;
}
@@ -84,7 +86,7 @@ const v8::FunctionCallbackInfo<v8::Value>& info
{% endif %}
{% if attribute.is_check_security_for_return_value %}
if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), {{attribute.cpp_value}}, exceptionState)) {
- v8SetReturnValueNull(info);
+ {{attribute.v8_set_return_value_for_security_failure}};
exceptionState.throwIfNeeded();
return;
}
@@ -246,11 +248,13 @@ v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info
raise_exception %}
{% if attribute.is_lenient_this %}
{# Make sure that info.Holder() really points to an instance if [LenientThis]. #}
- if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate()))
+ v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(info.This(), info.GetIsolate());
+ if (holder.IsEmpty())
return; // Return silently because of [LenientThis].
- {% endif %}
+ {% else %}
v8::Local<v8::Object> holder = info.Holder();
{% endif %}
+ {% endif %}
{% if raise_exception %}
ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.name}}", "{{interface_name}}", holder, info.GetIsolate());
{% endif %}

Powered by Google App Engine
This is Rietveld 408576698