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

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

Issue 984523003: bindings: Moves most of DOM attributes to prototype chains. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated test results. Created 5 years, 9 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 617bc3dfe7ee5627e600208fc0e4b34cf9c0045f..6d2f82bd4905c2b0120a46d6cd7b8d0204a8e92f 100644
--- a/Source/bindings/scripts/v8_attributes.py
+++ b/Source/bindings/scripts/v8_attributes.py
@@ -101,7 +101,7 @@ def attribute_context(interface, attribute):
'is_call_with_script_state': v8_utilities.has_extended_attribute_value(attribute, 'CallWith', 'ScriptState'),
'is_check_security_for_node': is_check_security_for_node,
'is_custom_element_callbacks': is_custom_element_callbacks,
- 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes,
+ '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'),
@@ -475,6 +475,34 @@ def has_custom_setter(attribute):
extended_attributes['Custom'] in [None, 'Setter'])
+# [ExposeJSAccessors]
+def is_expose_js_accessors(interface, attribute):
+ extended_attributes = attribute.extended_attributes
+
+ # These attributes must not be accessors on prototype chains.
+ if (attribute.is_static or
+ 'Unforgeable' in extended_attributes or
+ 'OverrideBuiltins' in interface.extended_attributes):
+ return False
+
+ # FIXME: We should move all of the following DOM attributes to prototype
+ # chains.
+ if (is_constructor_attribute(attribute) or
+ has_custom_getter(attribute) or
+ has_custom_setter(attribute) or
+ interface.name == 'Window' or
+ interface.name == 'WorkerGlobalScope' or
+ v8_utilities.indexed_property_getter(interface) or
+ v8_utilities.indexed_property_setter(interface) or
+ v8_utilities.indexed_property_deleter(interface) or
+ v8_utilities.named_property_getter(interface) or
+ v8_utilities.named_property_setter(interface) or
+ v8_utilities.named_property_deleter(interface)):
+ return False
+
+ return True
+
+
################################################################################
# Constructors
################################################################################

Powered by Google App Engine
This is Rietveld 408576698