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

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

Issue 2880713002: Support combination of [OriginTrialEnabled] and [SecureContext] (Closed)
Patch Set: Rebase Created 3 years, 7 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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 return None 382 return None
383 383
384 384
385 # [OriginTrialEnabled] 385 # [OriginTrialEnabled]
386 def origin_trial_enabled_function_name(definition_or_member): 386 def origin_trial_enabled_function_name(definition_or_member):
387 """Returns the name of the OriginTrials enabled function. 387 """Returns the name of the OriginTrials enabled function.
388 388
389 An exception is raised if OriginTrialEnabled is used in conjunction with any 389 An exception is raised if OriginTrialEnabled is used in conjunction with any
390 of the following (which must be mutually exclusive with origin trials): 390 of the following (which must be mutually exclusive with origin trials):
391 - RuntimeEnabled 391 - RuntimeEnabled
392 - SecureContext
393 392
394 The returned function checks if the IDL member should be enabled. 393 The returned function checks if the IDL member should be enabled.
395 Given extended attribute OriginTrialEnabled=FeatureName, return: 394 Given extended attribute OriginTrialEnabled=FeatureName, return:
396 OriginTrials::{featureName}Enabled 395 OriginTrials::{featureName}Enabled
397 396
398 If the OriginTrialEnabled extended attribute is found, the includes are 397 If the OriginTrialEnabled extended attribute is found, the includes are
399 also updated as a side-effect. 398 also updated as a side-effect.
400 """ 399 """
401 extended_attributes = definition_or_member.extended_attributes 400 extended_attributes = definition_or_member.extended_attributes
402 is_origin_trial_enabled = 'OriginTrialEnabled' in extended_attributes 401 is_origin_trial_enabled = 'OriginTrialEnabled' in extended_attributes
403 402
404 if is_origin_trial_enabled and 'RuntimeEnabled' in extended_attributes: 403 if is_origin_trial_enabled and 'RuntimeEnabled' in extended_attributes:
405 raise Exception('[OriginTrialEnabled] and [RuntimeEnabled] must ' 404 raise Exception('[OriginTrialEnabled] and [RuntimeEnabled] must '
406 'not be specified on the same definition: %s' 405 'not be specified on the same definition: %s'
407 % definition_or_member.name) 406 % definition_or_member.name)
408 407
409 if is_origin_trial_enabled and 'SecureContext' in extended_attributes:
410 raise Exception('[OriginTrialEnabled] and [SecureContext] must '
411 'not be specified on the same definition '
412 '(see https://crbug.com/695123 for workaround): %s'
413 % definition_or_member.name)
414
415 if is_origin_trial_enabled: 408 if is_origin_trial_enabled:
416 trial_name = extended_attributes['OriginTrialEnabled'] 409 trial_name = extended_attributes['OriginTrialEnabled']
417 return 'OriginTrials::%sEnabled' % uncapitalize(trial_name) 410 return 'OriginTrials::%sEnabled' % uncapitalize(trial_name)
418 411
419 is_feature_policy_enabled = 'FeaturePolicy' in extended_attributes 412 is_feature_policy_enabled = 'FeaturePolicy' in extended_attributes
420 413
421 if is_feature_policy_enabled and 'RuntimeEnabled' in extended_attributes: 414 if is_feature_policy_enabled and 'RuntimeEnabled' in extended_attributes:
422 raise Exception('[FeaturePolicy] and [RuntimeEnabled] must ' 415 raise Exception('[FeaturePolicy] and [RuntimeEnabled] must '
423 'not be specified on the same definition: %s' 416 'not be specified on the same definition: %s'
424 % definition_or_member.name) 417 % definition_or_member.name)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 def is_legacy_interface_type_checking(interface, member): 457 def is_legacy_interface_type_checking(interface, member):
465 return ('LegacyInterfaceTypeChecking' in interface.extended_attributes or 458 return ('LegacyInterfaceTypeChecking' in interface.extended_attributes or
466 'LegacyInterfaceTypeChecking' in member.extended_attributes) 459 'LegacyInterfaceTypeChecking' in member.extended_attributes)
467 460
468 461
469 # [Unforgeable], [Global], [PrimaryGlobal] 462 # [Unforgeable], [Global], [PrimaryGlobal]
470 def on_instance(interface, member): 463 def on_instance(interface, member):
471 """Returns True if the interface's member needs to be defined on every 464 """Returns True if the interface's member needs to be defined on every
472 instance object. 465 instance object.
473 466
474 The following members must be defiend on an instance object. 467 The following members must be defined on an instance object.
475 - [Unforgeable] members 468 - [Unforgeable] members
476 - regular members of [Global] or [PrimaryGlobal] interfaces 469 - regular members of [Global] or [PrimaryGlobal] interfaces
477 """ 470 """
478 if member.is_static: 471 if member.is_static:
479 return False 472 return False
480 473
481 # TODO(yukishiino): Remove a hack for ToString once we support 474 # TODO(yukishiino): Remove a hack for ToString once we support
482 # Symbol.ToStringTag. 475 # Symbol.ToStringTag.
483 if interface.name == 'Window' and member.name == 'ToString': 476 if interface.name == 'Window' and member.name == 'ToString':
484 return False 477 return False
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 return None 651 return None
659 652
660 653
661 IdlInterface.legacy_caller = property(legacy_caller) 654 IdlInterface.legacy_caller = property(legacy_caller)
662 IdlInterface.indexed_property_getter = property(indexed_property_getter) 655 IdlInterface.indexed_property_getter = property(indexed_property_getter)
663 IdlInterface.indexed_property_setter = property(indexed_property_setter) 656 IdlInterface.indexed_property_setter = property(indexed_property_setter)
664 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) 657 IdlInterface.indexed_property_deleter = property(indexed_property_deleter)
665 IdlInterface.named_property_getter = property(named_property_getter) 658 IdlInterface.named_property_getter = property(named_property_getter)
666 IdlInterface.named_property_setter = property(named_property_setter) 659 IdlInterface.named_property_setter = property(named_property_setter)
667 IdlInterface.named_property_deleter = property(named_property_deleter) 660 IdlInterface.named_property_deleter = property(named_property_deleter)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698