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

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

Issue 413393003: Blink-in-JS: Implement internal APIs exposed only to private scripts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/core/v8/V8DOMConfiguration.cpp ('k') | Source/bindings/scripts/v8_interface.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or 71 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or
72 has_extended_attribute_value(attribute, 'TypeChecking', 'Unrestricted') ) and 72 has_extended_attribute_value(attribute, 'TypeChecking', 'Unrestricted') ) and
73 idl_type.name in ('Float', 'Double')) 73 idl_type.name in ('Float', 'Double'))
74 # [ImplementedInPrivateScript] 74 # [ImplementedInPrivateScript]
75 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_ attributes 75 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_ attributes
76 if is_implemented_in_private_script: 76 if is_implemented_in_private_script:
77 includes.add('bindings/core/v8/PrivateScriptRunner.h') 77 includes.add('bindings/core/v8/PrivateScriptRunner.h')
78 includes.add('core/frame/LocalFrame.h') 78 includes.add('core/frame/LocalFrame.h')
79 includes.add('platform/ScriptForbiddenScope.h') 79 includes.add('platform/ScriptForbiddenScope.h')
80 80
81 # [OnlyExposedToPrivateScript]
82 is_only_exposed_to_private_script = 'OnlyExposedToPrivateScript' in extended _attributes
83
81 if (base_idl_type == 'EventHandler' and 84 if (base_idl_type == 'EventHandler' and
82 interface.name in ['Window', 'WorkerGlobalScope'] and 85 interface.name in ['Window', 'WorkerGlobalScope'] and
83 attribute.name == 'onerror'): 86 attribute.name == 'onerror'):
84 includes.add('bindings/core/v8/V8ErrorHandler.h') 87 includes.add('bindings/core/v8/V8ErrorHandler.h')
85 88
86 context = { 89 context = {
87 'access_control_list': access_control_list(attribute), 90 'access_control_list': access_control_list(attribute),
88 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_ world_list(attribute, 'Getter'), # [ActivityLogging] 91 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_ world_list(attribute, 'Getter'), # [ActivityLogging]
89 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_ world_list(attribute, 'Setter'), # [ActivityLogging] 92 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_ world_list(attribute, 'Setter'), # [ActivityLogging]
90 'activity_logging_include_old_value_for_setter': 'LogPreviousValue' in e xtended_attributes, # [ActivityLogging] 93 'activity_logging_include_old_value_for_setter': 'LogPreviousValue' in e xtended_attributes, # [ActivityLogging]
(...skipping 30 matching lines...) Expand all
121 'PartialInterfaceImplementedAs' in extended_attributes, 124 'PartialInterfaceImplementedAs' in extended_attributes,
122 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, 125 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes,
123 'is_read_only': attribute.is_read_only, 126 'is_read_only': attribute.is_read_only,
124 'is_reflect': is_reflect, 127 'is_reflect': is_reflect,
125 'is_replaceable': 'Replaceable' in attribute.extended_attributes, 128 'is_replaceable': 'Replaceable' in attribute.extended_attributes,
126 'is_static': attribute.is_static, 129 'is_static': attribute.is_static,
127 'is_url': 'URL' in extended_attributes, 130 'is_url': 'URL' in extended_attributes,
128 'is_unforgeable': 'Unforgeable' in extended_attributes, 131 'is_unforgeable': 'Unforgeable' in extended_attributes,
129 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs] 132 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs]
130 'name': attribute.name, 133 'name': attribute.name,
131 'only_exposed_to_private_script': 'OnlyExposedToPrivateScript' in extend ed_attributes, 134 'only_exposed_to_private_script': is_only_exposed_to_private_script,
132 'per_context_enabled_function': v8_utilities.per_context_enabled_functio n_name(attribute), # [PerContextEnabled] 135 'per_context_enabled_function': v8_utilities.per_context_enabled_functio n_name(attribute), # [PerContextEnabled]
133 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local _cpp_value( 136 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local _cpp_value(
134 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is olate()', used_in_private_script=True), 137 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is olate()', used_in_private_script=True),
135 'property_attributes': property_attributes(attribute), 138 'property_attributes': property_attributes(attribute),
136 'put_forwards': 'PutForwards' in extended_attributes, 139 'put_forwards': 'PutForwards' in extended_attributes,
137 'reflect_empty': extended_attributes.get('ReflectEmpty'), 140 'reflect_empty': extended_attributes.get('ReflectEmpty'),
138 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), 141 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''),
139 'reflect_missing': extended_attributes.get('ReflectMissing'), 142 'reflect_missing': extended_attributes.get('ReflectMissing'),
140 'reflect_only': extended_attributes['ReflectOnly'].split('|') 143 'reflect_only': extended_attributes['ReflectOnly'].split('|')
141 if 'ReflectOnly' in extended_attributes else None, 144 if 'ReflectOnly' in extended_attributes else None,
142 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a ttribute), # [RuntimeEnabled] 145 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a ttribute), # [RuntimeEnabled]
143 'setter_callback': setter_callback_name(interface, attribute), 146 'setter_callback': setter_callback_name(interface, attribute),
147 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script),
144 'v8_type': v8_types.v8_type(base_idl_type), 148 'v8_type': v8_types.v8_type(base_idl_type),
145 'world_suffixes': ['', 'ForMainWorld'] 149 'world_suffixes': ['', 'ForMainWorld']
146 if 'PerWorldBindings' in extended_attributes 150 if 'PerWorldBindings' in extended_attributes
147 else [''], # [PerWorldBindings] 151 else [''], # [PerWorldBindings]
148 } 152 }
149 153
150 if is_constructor_attribute(attribute): 154 if is_constructor_attribute(attribute):
151 constructor_getter_context(interface, attribute, context) 155 constructor_getter_context(interface, attribute, context)
152 return context 156 return context
153 if not has_custom_getter: 157 if not has_custom_getter:
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 lambda self: strip_suffix(self.base_type, 'Constructor')) 482 lambda self: strip_suffix(self.base_type, 'Constructor'))
479 483
480 484
481 def is_constructor_attribute(attribute): 485 def is_constructor_attribute(attribute):
482 # FIXME: replace this with [ConstructorAttribute] extended attribute 486 # FIXME: replace this with [ConstructorAttribute] extended attribute
483 return attribute.idl_type.base_type.endswith('Constructor') 487 return attribute.idl_type.base_type.endswith('Constructor')
484 488
485 489
486 def constructor_getter_context(interface, attribute, context): 490 def constructor_getter_context(interface, attribute, context):
487 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] 491 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as']
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8DOMConfiguration.cpp ('k') | Source/bindings/scripts/v8_interface.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698