OLD | NEW |
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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 if interface is not None: | 379 if interface is not None: |
380 measure_as_name = '%s_%s' % (capitalize(interface.name), measure_as_
name) | 380 measure_as_name = '%s_%s' % (capitalize(interface.name), measure_as_
name) |
381 return lambda suffix: 'V8%s_%s' % (measure_as_name, suffix) | 381 return lambda suffix: 'V8%s_%s' % (measure_as_name, suffix) |
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 both the OriginTrialEnabled and RuntimeEnabled | 389 An exception is raised if OriginTrialEnabled is used in conjunction with any |
390 extended attributes are applied to the same IDL member. Only one of the | 390 of the following (which must be mutually exclusive with origin trials): |
391 two attributes can be applied to any member - they are mutually exclusive. | 391 - RuntimeEnabled |
| 392 - SecureContext |
392 | 393 |
393 The returned function checks if the IDL member should be enabled. | 394 The returned function checks if the IDL member should be enabled. |
394 Given extended attribute OriginTrialEnabled=FeatureName, return: | 395 Given extended attribute OriginTrialEnabled=FeatureName, return: |
395 OriginTrials::{featureName}Enabled | 396 OriginTrials::{featureName}Enabled |
396 | 397 |
397 If the OriginTrialEnabled extended attribute is found, the includes are | 398 If the OriginTrialEnabled extended attribute is found, the includes are |
398 also updated as a side-effect. | 399 also updated as a side-effect. |
399 """ | 400 """ |
400 extended_attributes = definition_or_member.extended_attributes | 401 extended_attributes = definition_or_member.extended_attributes |
401 is_origin_trial_enabled = 'OriginTrialEnabled' in extended_attributes | 402 is_origin_trial_enabled = 'OriginTrialEnabled' in extended_attributes |
402 | 403 |
403 if is_origin_trial_enabled and 'RuntimeEnabled' in extended_attributes: | 404 if is_origin_trial_enabled and 'RuntimeEnabled' in extended_attributes: |
404 raise Exception('[OriginTrialEnabled] and [RuntimeEnabled] must ' | 405 raise Exception('[OriginTrialEnabled] and [RuntimeEnabled] must ' |
405 'not be specified on the same definition: ' | 406 'not be specified on the same definition: %s' |
406 '%s.%s' % (definition_or_member.idl_name, definition_or_
member.name)) | 407 % definition_or_member.name) |
| 408 |
| 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) |
407 | 414 |
408 if is_origin_trial_enabled: | 415 if is_origin_trial_enabled: |
409 trial_name = extended_attributes['OriginTrialEnabled'] | 416 trial_name = extended_attributes['OriginTrialEnabled'] |
410 return 'OriginTrials::%sEnabled' % uncapitalize(trial_name) | 417 return 'OriginTrials::%sEnabled' % uncapitalize(trial_name) |
411 | 418 |
412 is_feature_policy_enabled = 'FeaturePolicy' in extended_attributes | 419 is_feature_policy_enabled = 'FeaturePolicy' in extended_attributes |
413 | 420 |
414 if is_feature_policy_enabled and 'RuntimeEnabled' in extended_attributes: | 421 if is_feature_policy_enabled and 'RuntimeEnabled' in extended_attributes: |
415 raise Exception('[FeaturePolicy] and [RuntimeEnabled] must ' | 422 raise Exception('[FeaturePolicy] and [RuntimeEnabled] must ' |
416 'not be specified on the same definition: ' | 423 'not be specified on the same definition: %s' |
417 '%s.%s' % (definition_or_member.idl_name, definition_or_
member.name)) | 424 % definition_or_member.name) |
418 | 425 |
419 if is_feature_policy_enabled: | 426 if is_feature_policy_enabled: |
420 includes.add('bindings/core/v8/ScriptState.h') | 427 includes.add('bindings/core/v8/ScriptState.h') |
421 includes.add('platform/feature_policy/FeaturePolicy.h') | 428 includes.add('platform/feature_policy/FeaturePolicy.h') |
422 | 429 |
423 trial_name = extended_attributes['FeaturePolicy'] | 430 trial_name = extended_attributes['FeaturePolicy'] |
424 return 'FeaturePolicy::%sEnabled' % uncapitalize(trial_name) | 431 return 'FeaturePolicy::%sEnabled' % uncapitalize(trial_name) |
425 | 432 |
426 return None | 433 return None |
427 | 434 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 return None | 652 return None |
646 | 653 |
647 | 654 |
648 IdlInterface.legacy_caller = property(legacy_caller) | 655 IdlInterface.legacy_caller = property(legacy_caller) |
649 IdlInterface.indexed_property_getter = property(indexed_property_getter) | 656 IdlInterface.indexed_property_getter = property(indexed_property_getter) |
650 IdlInterface.indexed_property_setter = property(indexed_property_setter) | 657 IdlInterface.indexed_property_setter = property(indexed_property_setter) |
651 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) | 658 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) |
652 IdlInterface.named_property_getter = property(named_property_getter) | 659 IdlInterface.named_property_getter = property(named_property_getter) |
653 IdlInterface.named_property_setter = property(named_property_setter) | 660 IdlInterface.named_property_setter = property(named_property_setter) |
654 IdlInterface.named_property_deleter = property(named_property_deleter) | 661 IdlInterface.named_property_deleter = property(named_property_deleter) |
OLD | NEW |