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

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

Issue 226073003: Fix StrictTypeChecking on interface type attributes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Mark HTMLMediaElement.error nullable. Created 6 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
« no previous file with comments | « Source/bindings/scripts/v8_attributes.py ('k') | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/attributes.cpp
diff --git a/Source/bindings/templates/attributes.cpp b/Source/bindings/templates/attributes.cpp
index b47181e896bb20341187b90671c92898fbdaaadb..27762a7bb12508131c8f0e4481fe415ae456b893 100644
--- a/Source/bindings/templates/attributes.cpp
+++ b/Source/bindings/templates/attributes.cpp
@@ -51,7 +51,7 @@ const v8::PropertyCallbackInfo<v8::Value>& info
attribute.is_getter_raises_exception %}
ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.name}}", "{{interface_name}}", holder, info.GetIsolate());
{% endif %}
- {% if attribute.is_nullable %}
+ {% if attribute.is_nullable and not attribute.has_strict_type_checking %}
bool isNull = false;
{% endif %}
{# FIXME: consider always using a local variable for value #}
@@ -81,7 +81,11 @@ const v8::PropertyCallbackInfo<v8::Value>& info
| indent}}
{% endif %}
{% if attribute.is_nullable %}
+ {% if attribute.has_strict_type_checking %}
+ if (!{{attribute.cpp_value}}) {
+ {% else %}
if (isNull) {
+ {% endif %}
v8SetReturnValueNull(info);
return;
}
@@ -220,7 +224,7 @@ v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info
{% if attribute.has_strict_type_checking %}
{# Type checking for interface types (if interface not implemented, throw
TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
- if (!isUndefinedOrNull(v8Value) && !V8{{attribute.idl_type}}::hasInstance(v8Value, info.GetIsolate())) {
+ if ({% if attribute.is_nullable %}!isUndefinedOrNull(v8Value) && {% endif %}!V8{{attribute.idl_type}}::hasInstance(v8Value, info.GetIsolate())) {
exceptionState.throwTypeError("The provided value is not of type '{{attribute.idl_type}}'.");
exceptionState.throwIfNeeded();
return;
« no previous file with comments | « Source/bindings/scripts/v8_attributes.py ('k') | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698