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

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/v8_interface.py

Issue 2668753006: Special-case LocalDOMWindow for same-origin access in bindings. (Closed)
Patch Set: . Created 3 years, 10 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
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # coding=utf-8 2 # coding=utf-8
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 # [Custom=VisitDOMWrapper] 238 # [Custom=VisitDOMWrapper]
239 has_visit_dom_wrapper_custom = ( 239 has_visit_dom_wrapper_custom = (
240 has_extended_attribute_value(interface, 'Custom', 'VisitDOMWrapper')) 240 has_extended_attribute_value(interface, 'Custom', 'VisitDOMWrapper'))
241 241
242 has_visit_dom_wrapper = (has_visit_dom_wrapper_custom or 242 has_visit_dom_wrapper = (has_visit_dom_wrapper_custom or
243 set_wrapper_reference_from or set_wrapper_reference_to) 243 set_wrapper_reference_from or set_wrapper_reference_to)
244 244
245 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod e') else 'ObjectClassId') 245 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod e') else 'ObjectClassId')
246 246
247 # [SameOriginImplementedAs]
248 cpp_class_name_same_origin = None
249 if 'SameOriginImplementedAs' in interface.extended_attributes:
250 cpp_class_name_same_origin = interface.extended_attributes['SameOriginIm plementedAs']
251
247 # [ActiveScriptWrappable] must be accompanied with [DependentLifetime]. 252 # [ActiveScriptWrappable] must be accompanied with [DependentLifetime].
248 if active_scriptwrappable and not is_dependent_lifetime: 253 if active_scriptwrappable and not is_dependent_lifetime:
249 raise Exception('[ActiveScriptWrappable] interface must also specify ' 254 raise Exception('[ActiveScriptWrappable] interface must also specify '
250 '[DependentLifetime]: %s' % interface.name) 255 '[DependentLifetime]: %s' % interface.name)
251 256
252 v8_class_name = v8_utilities.v8_class_name(interface) 257 v8_class_name = v8_utilities.v8_class_name(interface)
253 cpp_class_name = cpp_name(interface) 258 cpp_class_name = cpp_name(interface)
254 cpp_class_name_or_partial = cpp_name_or_partial(interface) 259 cpp_class_name_or_partial = cpp_name_or_partial(interface)
255 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface) 260 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface)
256 261
257 # TODO(peria): Generate the target list from 'Window' and 'HTMLDocument'. 262 # TODO(peria): Generate the target list from 'Window' and 'HTMLDocument'.
258 needs_runtime_enabled_installer = v8_class_name in [ 263 needs_runtime_enabled_installer = v8_class_name in [
259 'V8Window', 'V8HTMLDocument', 'V8Document', 'V8Node', 'V8EventTarget'] 264 'V8Window', 'V8HTMLDocument', 'V8Document', 'V8Node', 'V8EventTarget']
260 265
261 context = { 266 context = {
262 'cpp_class': cpp_class_name, 267 'cpp_class': cpp_class_name,
263 'cpp_class_or_partial': cpp_class_name_or_partial, 268 'cpp_class_or_partial': cpp_class_name_or_partial,
269 'cpp_class_same_origin': cpp_class_name_same_origin,
264 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target else 'NotInheritFromEventTarget', 270 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target else 'NotInheritFromEventTarget',
265 'is_gc_type': True, 271 'is_gc_type': True,
266 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699 272 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699
267 'has_access_check_callbacks': (is_check_security and 273 'has_access_check_callbacks': (is_check_security and
268 interface.name != 'EventTarget'), 274 interface.name != 'EventTarget'),
269 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] 275 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction]
270 'has_partial_interface': len(interface.partial_interfaces) > 0, 276 'has_partial_interface': len(interface.partial_interfaces) > 0,
271 'has_visit_dom_wrapper': has_visit_dom_wrapper, 277 'has_visit_dom_wrapper': has_visit_dom_wrapper,
272 'has_visit_dom_wrapper_custom': has_visit_dom_wrapper_custom, 278 'has_visit_dom_wrapper_custom': has_visit_dom_wrapper_custom,
273 'header_includes': header_includes, 279 'header_includes': header_includes,
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 extended_attributes = deleter.extended_attributes 1507 extended_attributes = deleter.extended_attributes
1502 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState') 1508 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState')
1503 is_ce_reactions = 'CEReactions' in extended_attributes 1509 is_ce_reactions = 'CEReactions' in extended_attributes
1504 return { 1510 return {
1505 'is_call_with_script_state': is_call_with_script_state, 1511 'is_call_with_script_state': is_call_with_script_state,
1506 'is_ce_reactions': is_ce_reactions, 1512 'is_ce_reactions': is_ce_reactions,
1507 'is_custom': 'Custom' in extended_attributes, 1513 'is_custom': 'Custom' in extended_attributes,
1508 'is_raises_exception': 'RaisesException' in extended_attributes, 1514 'is_raises_exception': 'RaisesException' in extended_attributes,
1509 'name': cpp_name(deleter), 1515 'name': cpp_name(deleter),
1510 } 1516 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698