OLD | NEW |
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 30 matching lines...) Expand all Loading... |
41 import v8_utilities | 41 import v8_utilities |
42 from v8_utilities import (has_extended_attribute_value, is_unforgeable, | 42 from v8_utilities import (has_extended_attribute_value, is_unforgeable, |
43 is_legacy_interface_type_checking) | 43 is_legacy_interface_type_checking) |
44 | 44 |
45 | 45 |
46 # Methods with any of these require custom method registration code in the | 46 # Methods with any of these require custom method registration code in the |
47 # interface's configure*Template() function. | 47 # interface's configure*Template() function. |
48 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES = frozenset([ | 48 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES = frozenset([ |
49 'DoNotCheckSecurity', | 49 'DoNotCheckSecurity', |
50 'DoNotCheckSignature', | 50 'DoNotCheckSignature', |
51 'NotEnumerable', | |
52 'Unforgeable', | |
53 ]) | 51 ]) |
54 | 52 |
55 | 53 |
56 def use_local_result(method): | 54 def use_local_result(method): |
57 extended_attributes = method.extended_attributes | 55 extended_attributes = method.extended_attributes |
58 idl_type = method.idl_type | 56 idl_type = method.idl_type |
59 return (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or | 57 return (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or |
60 'ImplementedInPrivateScript' in extended_attributes or | 58 'ImplementedInPrivateScript' in extended_attributes or |
61 'RaisesException' in extended_attributes or | 59 'RaisesException' in extended_attributes or |
62 idl_type.is_union_type or | 60 idl_type.is_union_type or |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 'cpp_value': this_cpp_value, | 131 'cpp_value': this_cpp_value, |
134 'cpp_type_initializer': idl_type.cpp_type_initializer, | 132 'cpp_type_initializer': idl_type.cpp_type_initializer, |
135 'custom_registration_extended_attributes': | 133 'custom_registration_extended_attributes': |
136 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection( | 134 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection( |
137 extended_attributes.iterkeys()), | 135 extended_attributes.iterkeys()), |
138 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] | 136 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] |
139 'exposed_test': v8_utilities.exposed(method, interface), # [Exposed] | 137 'exposed_test': v8_utilities.exposed(method, interface), # [Exposed] |
140 # TODO(yukishiino): Retire has_custom_registration flag. Should be | 138 # TODO(yukishiino): Retire has_custom_registration flag. Should be |
141 # replaced with V8DOMConfiguration::PropertyLocationConfiguration. | 139 # replaced with V8DOMConfiguration::PropertyLocationConfiguration. |
142 'has_custom_registration': | 140 'has_custom_registration': |
143 is_static or | |
144 is_unforgeable(interface, method) or | |
145 v8_utilities.has_extended_attribute( | 141 v8_utilities.has_extended_attribute( |
146 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES), | 142 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES), |
147 'has_exception_state': | 143 'has_exception_state': |
148 is_raises_exception or | 144 is_raises_exception or |
149 is_check_security_for_frame or | 145 is_check_security_for_frame or |
150 is_check_security_for_window or | 146 is_check_security_for_window or |
151 any(argument for argument in arguments | 147 any(argument for argument in arguments |
152 if (argument.idl_type.name == 'SerializedScriptValue' or | 148 if (argument.idl_type.name == 'SerializedScriptValue' or |
153 argument_conversion_needs_exception_state(method, argument))
), | 149 argument_conversion_needs_exception_state(method, argument))
), |
154 'idl_type': idl_type.base_type, | 150 'idl_type': idl_type.base_type, |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 return method.idl_type and method.idl_type.name == 'Promise' | 462 return method.idl_type and method.idl_type.name == 'Promise' |
467 | 463 |
468 IdlOperation.returns_promise = property(method_returns_promise) | 464 IdlOperation.returns_promise = property(method_returns_promise) |
469 | 465 |
470 | 466 |
471 def argument_conversion_needs_exception_state(method, argument): | 467 def argument_conversion_needs_exception_state(method, argument): |
472 idl_type = argument.idl_type | 468 idl_type = argument.idl_type |
473 return (idl_type.v8_conversion_needs_exception_state or | 469 return (idl_type.v8_conversion_needs_exception_state or |
474 argument.is_variadic or | 470 argument.is_variadic or |
475 (method.returns_promise and idl_type.is_string_type)) | 471 (method.returns_promise and idl_type.is_string_type)) |
OLD | NEW |