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

Side by Side Diff: Source/bindings/scripts/v8_attributes.py

Issue 1047993002: bindings: Add validation for enum Sequence or Array (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 uncapitalize, extended_attribute_value_as_list, is_unf orgeable, 43 uncapitalize, extended_attribute_value_as_list, is_unf orgeable,
44 is_legacy_interface_type_checking) 44 is_legacy_interface_type_checking)
45 45
46 46
47 def attribute_context(interface, attribute): 47 def attribute_context(interface, attribute):
48 idl_type = attribute.idl_type 48 idl_type = attribute.idl_type
49 base_idl_type = idl_type.base_type 49 base_idl_type = idl_type.base_type
50 extended_attributes = attribute.extended_attributes 50 extended_attributes = attribute.extended_attributes
51 51
52 idl_type.add_includes_for_type() 52 idl_type.add_includes_for_type()
53 if idl_type.enum_validation_expression: 53 if idl_type.enum_values:
54 includes.add('core/inspector/ConsoleMessage.h') 54 includes.add('core/inspector/ConsoleMessage.h')
55 55
56 # [CheckSecurity] 56 # [CheckSecurity]
57 is_do_not_check_security = 'DoNotCheckSecurity' in extended_attributes 57 is_do_not_check_security = 'DoNotCheckSecurity' in extended_attributes
58 is_check_security_for_frame = ( 58 is_check_security_for_frame = (
59 has_extended_attribute_value(interface, 'CheckSecurity', 'Frame') and 59 has_extended_attribute_value(interface, 'CheckSecurity', 'Frame') and
60 not is_do_not_check_security) 60 not is_do_not_check_security)
61 is_check_security_for_node = ( 61 is_check_security_for_node = (
62 has_extended_attribute_value(attribute, 'CheckSecurity', 'Node')) 62 has_extended_attribute_value(attribute, 'CheckSecurity', 'Node'))
63 is_check_security_for_window = ( 63 is_check_security_for_window = (
(...skipping 30 matching lines...) Expand all
94 'activity_logging_world_check': v8_utilities.activity_logging_world_chec k(attribute), # [ActivityLogging] 94 'activity_logging_world_check': v8_utilities.activity_logging_world_chec k(attribute), # [ActivityLogging]
95 'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), 95 'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True),
96 'cached_attribute_validation_method': extended_attributes.get('CachedAtt ribute'), 96 'cached_attribute_validation_method': extended_attributes.get('CachedAtt ribute'),
97 'conditional_string': v8_utilities.conditional_string(attribute), 97 'conditional_string': v8_utilities.conditional_string(attribute),
98 'constructor_type': idl_type.constructor_type_name 98 'constructor_type': idl_type.constructor_type_name
99 if is_constructor_attribute(attribute) else None, 99 if is_constructor_attribute(attribute) else None,
100 'cpp_name': cpp_name(attribute), 100 'cpp_name': cpp_name(attribute),
101 'cpp_type': idl_type.cpp_type, 101 'cpp_type': idl_type.cpp_type,
102 'cpp_type_initializer': idl_type.cpp_type_initializer, 102 'cpp_type_initializer': idl_type.cpp_type_initializer,
103 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] 103 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs]
104 'enum_validation_expression': idl_type.enum_validation_expression, 104 'enum_values': idl_type.enum_values,
105 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] 105 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed]
106 'has_custom_getter': has_custom_getter(attribute), 106 'has_custom_getter': has_custom_getter(attribute),
107 'has_custom_setter': has_custom_setter(attribute), 107 'has_custom_setter': has_custom_setter(attribute),
108 'has_setter': has_setter(attribute), 108 'has_setter': has_setter(attribute),
109 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType 109 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType
110 'is_call_with_execution_context': has_extended_attribute_value(attribute , 'CallWith', 'ExecutionContext'), 110 'is_call_with_execution_context': has_extended_attribute_value(attribute , 'CallWith', 'ExecutionContext'),
111 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca llWith', 'ScriptState'), 111 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca llWith', 'ScriptState'),
112 'is_check_security_for_frame': is_check_security_for_frame, 112 'is_check_security_for_frame': is_check_security_for_frame,
113 'is_check_security_for_node': is_check_security_for_node, 113 'is_check_security_for_node': is_check_security_for_node,
114 'is_check_security_for_window': is_check_security_for_window, 114 'is_check_security_for_window': is_check_security_for_window,
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 return attribute.idl_type.name.endswith('Constructor') 529 return attribute.idl_type.name.endswith('Constructor')
530 530
531 531
532 def update_constructor_attribute_context(interface, attribute, context): 532 def update_constructor_attribute_context(interface, attribute, context):
533 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] 533 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as']
534 # When the attribute name is the same as the interface name, do not generate 534 # When the attribute name is the same as the interface name, do not generate
535 # callback functions for each attribute and use 535 # callback functions for each attribute and use
536 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate 536 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate
537 # a callback function in order to hard-code the attribute name. 537 # a callback function in order to hard-code the attribute name.
538 context['needs_constructor_setter_callback'] = context['name'] != context['c onstructor_type'] 538 context['needs_constructor_setter_callback'] = context['name'] != context['c onstructor_type']
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698