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

Unified Diff: Source/bindings/scripts/v8_attributes.py

Issue 1226203012: Revert of bindings: Makes almost all attributes accessor-type properties. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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: Source/bindings/scripts/v8_attributes.py
diff --git a/Source/bindings/scripts/v8_attributes.py b/Source/bindings/scripts/v8_attributes.py
index 6a96a75e31cb48ddbcf86843ec79dabfb867636e..b1f72a0a9abc82ea9cd6e55ebaeed43c84fafa39 100644
--- a/Source/bindings/scripts/v8_attributes.py
+++ b/Source/bindings/scripts/v8_attributes.py
@@ -65,11 +65,6 @@
not is_do_not_check_security)
if is_check_security_for_frame or is_check_security_for_node or is_check_security_for_window:
includes.add('bindings/core/v8/BindingSecurity.h')
- # [Constructor]
- # TODO(yukishiino): Constructors are much like methods although constructors
- # are not methods. Constructors must be data-type properties, and we can
- # support them as a kind of methods.
- constructor_type = idl_type.constructor_type_name if is_constructor_attribute(attribute) else None
# [CustomElementCallbacks], [Reflect]
is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes
is_reflect = 'Reflect' in extended_attributes
@@ -105,7 +100,8 @@
'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True),
'cached_attribute_validation_method': cached_attribute_validation_method,
'conditional_string': v8_utilities.conditional_string(attribute),
- 'constructor_type': constructor_type,
+ 'constructor_type': idl_type.constructor_type_name
+ if is_constructor_attribute(attribute) else None,
'cpp_name': cpp_name(attribute),
'cpp_type': idl_type.cpp_type,
'cpp_type_initializer': idl_type.cpp_type_initializer,
@@ -123,8 +119,7 @@
'is_check_security_for_node': is_check_security_for_node,
'is_check_security_for_window': is_check_security_for_window,
'is_custom_element_callbacks': is_custom_element_callbacks,
- # TODO(yukishiino): Make all DOM attributes accessor-type properties.
- 'is_data_type_property': constructor_type or interface.name == 'Window',
+ 'is_expose_js_accessors': is_expose_js_accessors(interface, attribute),
'is_getter_raises_exception': # [RaisesException]
'RaisesException' in extended_attributes and
extended_attributes['RaisesException'] in (None, 'Getter'),
@@ -494,6 +489,43 @@
extended_attributes['Custom'] in [None, 'Setter'])
+# [ExposeJSAccessors]
+def is_expose_js_accessors(interface, attribute):
+ # Default behavior
+ is_accessor = True
+
+ if ('ExposeJSAccessors' in interface.extended_attributes and
+ 'DoNotExposeJSAccessors' in interface.extended_attributes):
+ raise Exception('Both of ExposeJSAccessors and DoNotExposeJSAccessors are specified at a time in an interface: ' + interface.name)
+ if 'ExposeJSAccessors' in interface.extended_attributes:
+ is_accessor = True
+ if 'DoNotExposeJSAccessors' in interface.extended_attributes:
+ is_accessor = False
+
+ # Note that ExposeJSAccessors and DoNotExposeJSAccessors are more powerful
+ # than 'static', [Unforgeable] and [OverrideBuiltins].
+ if ('ExposeJSAccessors' in attribute.extended_attributes and
+ 'DoNotExposeJSAccessors' in attribute.extended_attributes):
+ raise Exception('Both of ExposeJSAccessors and DoNotExposeJSAccessors are specified at a time on an attribute: ' + attribute.name + ' in an interface: ' + interface.name)
+ if 'ExposeJSAccessors' in attribute.extended_attributes:
+ return True
+ if 'DoNotExposeJSAccessors' in attribute.extended_attributes:
+ return False
+
+ # These attributes must not be accessors on prototype chains.
+ if (is_constructor_attribute(attribute) or
+ attribute.is_static or
+ is_unforgeable(interface, attribute) or
+ 'OverrideBuiltins' in interface.extended_attributes):
+ return False
+
+ # The members of Window interface must be placed on the instance object.
+ if interface.name == 'Window':
+ return False
+
+ return is_accessor
+
+
################################################################################
# Constructors
################################################################################

Powered by Google App Engine
This is Rietveld 408576698