Chromium Code Reviews| Index: Source/bindings/scripts/v8_utilities.py |
| diff --git a/Source/bindings/scripts/v8_utilities.py b/Source/bindings/scripts/v8_utilities.py |
| index 9a9d6cdfb648936184a498df772537a967898fd2..1816207c2ec037163982efc49f1f188e8f000ab4 100644 |
| --- a/Source/bindings/scripts/v8_utilities.py |
| +++ b/Source/bindings/scripts/v8_utilities.py |
| @@ -225,6 +225,12 @@ def conditional_string(definition_or_member): |
| return 'ENABLE(%s)' % extended_attributes['Conditional'] |
| +# [Constructor], [NamedConstructor] |
| +def is_constructor_attribute(member): |
| + # TODO: replace this with [Constructor] and [NamedConstructor] extended attribute |
|
haraken
2015/06/17 16:31:21
TODO(yukishiino)
Yuki
2015/06/18 07:44:41
Done.
|
| + return member.idl_type.name.endswith('Constructor') |
| + |
| + |
| # [DeprecateAs] |
| def deprecate_as(member): |
| extended_attributes = member.extended_attributes |
| @@ -404,6 +410,58 @@ def is_legacy_interface_type_checking(interface, member): |
| return True |
| return False |
| + |
| +# [Unforgeable], [OverrideBuiltins], [Global], [PrimaryGlobal] and [ExposeJSAccessors] / [DoNotExposeJSAccessors] |
|
haraken
2015/06/17 16:31:21
This comment is a bit confusing.
- You have the s
bashi
2015/06/18 02:16:27
I'd recommend to have docstring to describe how th
Yuki
2015/06/18 07:44:40
Done.
Yuki
2015/06/18 07:44:40
Done.
|
| +def on_instance(interface, member): |
| + return not on_prototype(interface, member) |
| + |
| + |
| +# [Unforgeable], [OverrideBuiltins], [Global], [PrimaryGlobal] and [ExposeJSAccessors] / [DoNotExposeJSAccessors] |
| +def on_prototype(interface, member): |
| + 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 member.extended_attributes and |
| + 'DoNotExposeJSAccessors' in member.extended_attributes): |
| + raise Exception('Both of ExposeJSAccessors and DoNotExposeJSAccessors are specified at a time on a member: ' + member.name + ' in an interface: ' + interface.name) |
| + |
| + # Note that ExposeJSAccessors and DoNotExposeJSAccessors are more powerful |
| + # than 'static', [Unforgeable] and [OverrideBuiltins]. |
| + if 'ExposeJSAccessors' in member.extended_attributes: |
| + return True |
| + if 'DoNotExposeJSAccessors' in member.extended_attributes: |
| + return False |
| + |
| + # These members must not be placed on prototype chains. |
| + if (is_constructor_attribute(member) or |
| + member.is_static or |
| + is_unforgeable(interface, member) or |
| + 'OverrideBuiltins' in interface.extended_attributes): |
| + return False |
| + |
| + # TODO(yukishiino): We should handle [Global] and [PrimaryGlobal] instead of |
| + # Window. |
| + if (interface.name == 'Window'): |
| + return member.idl_type.name == 'EventHandler' |
| + |
| + # TODO(yukishiino): We should move all of the following members to prototype |
| + # chains. |
| + if ('Custom' in member.extended_attributes): |
|
bashi
2015/06/18 02:16:27
nit: drop parenthesis.
Yuki
2015/06/18 07:44:40
Done.
|
| + return False |
| + |
| + if 'ExposeJSAccessors' in interface.extended_attributes: |
| + return True |
| + if 'DoNotExposeJSAccessors' in interface.extended_attributes: |
| + return False |
|
haraken
2015/06/17 16:31:21
It's a bit confusing that the priority of [ExposeJ
Yuki
2015/06/18 07:44:41
Well, however, we should not place static members
|
| + |
| + return True |
| + |
| + |
| +# [Unforgeable], [OverrideBuiltins], [Global], [PrimaryGlobal] and [ExposeJSAccessors] / [DoNotExposeJSAccessors] |
| +def on_interface(interface, member): |
| + return False |
|
haraken
2015/06/17 16:31:21
Just help me understand: When should on_interface
Yuki
2015/06/18 07:44:41
constants and static members must be defined on th
|
| + |
| + |
| ################################################################################ |
| # Indexed properties |
| # http://heycam.github.io/webidl/#idl-indexed-properties |