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

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

Issue 2207423002: Implement '[SecureContext]' IDL attribute for interfaces, methods and attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 # 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 if e.exposed not in EXPOSED_EXECUTION_CONTEXT_METHOD: 335 if e.exposed not in EXPOSED_EXECUTION_CONTEXT_METHOD:
336 raise ValueError('Invalid execution context: %s' % e.exposed) 336 raise ValueError('Invalid execution context: %s' % e.exposed)
337 337
338 # Methods must not be exposed to a broader scope than their interface. 338 # Methods must not be exposed to a broader scope than their interface.
339 if not exposure_set.issubset(interface_exposure_set): 339 if not exposure_set.issubset(interface_exposure_set):
340 raise ValueError('Interface members\' exposure sets must be a subset of the interface\'s.') 340 raise ValueError('Interface members\' exposure sets must be a subset of the interface\'s.')
341 341
342 return exposure_set.code() 342 return exposure_set.code()
343 343
344 344
345 # [SecureContext]
346 def secure_context(member, interface):
347 """Returns C++ code that checks whether an interface/method/attribute/etc. i s exposed
348 to the current context."""
349 if 'SecureContext' in member.extended_attributes or 'SecureContext' in inter face.extended_attributes:
350 return "executionContext->isSecureContext()"
351 return None
352
353
345 # [ImplementedAs] 354 # [ImplementedAs]
346 def cpp_name(definition_or_member): 355 def cpp_name(definition_or_member):
347 extended_attributes = definition_or_member.extended_attributes 356 extended_attributes = definition_or_member.extended_attributes
348 if 'ImplementedAs' not in extended_attributes: 357 if 'ImplementedAs' not in extended_attributes:
349 return definition_or_member.name 358 return definition_or_member.name
350 return extended_attributes['ImplementedAs'] 359 return extended_attributes['ImplementedAs']
351 360
352 361
353 def cpp_name_from_interfaces_info(name, interfaces_info): 362 def cpp_name_from_interfaces_info(name, interfaces_info):
354 return interfaces_info.get(name, {}).get('implemented_as') or name 363 return interfaces_info.get(name, {}).get('implemented_as') or name
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 except StopIteration: 632 except StopIteration:
624 return None 633 return None
625 634
626 635
627 IdlInterface.indexed_property_getter = property(indexed_property_getter) 636 IdlInterface.indexed_property_getter = property(indexed_property_getter)
628 IdlInterface.indexed_property_setter = property(indexed_property_setter) 637 IdlInterface.indexed_property_setter = property(indexed_property_setter)
629 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) 638 IdlInterface.indexed_property_deleter = property(indexed_property_deleter)
630 IdlInterface.named_property_getter = property(named_property_getter) 639 IdlInterface.named_property_getter = property(named_property_getter)
631 IdlInterface.named_property_setter = property(named_property_setter) 640 IdlInterface.named_property_setter = property(named_property_setter)
632 IdlInterface.named_property_deleter = property(named_property_deleter) 641 IdlInterface.named_property_deleter = property(named_property_deleter)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698