Commit 60deeff6 authored by iclelland's avatar iclelland Committed by Commit bot

Add IDL parsing of FeaturePolicy extended attribute

This is an interim step to handle FeaturePolicy-enabled features, before the
three conditional feature flags (RuntimeEnabled, OriginTrialEnabled and
FeaturePolicy) are eventually combined into a common 'Feature' attribute.

BUG=638240

Review-Url: https://codereview.chromium.org/2247923004
Cr-Commit-Position: refs/heads/master@{#412524}
parent 4d31d2e1
......@@ -52,6 +52,7 @@ DoNotCheckSecurity=|Setter
DoNotTestNewObject
EnforceRange
Exposed=*
FeaturePolicy=*
FlexibleArrayBufferView
Global=|*
ImplementedAs=*
......
......@@ -403,7 +403,7 @@ def origin_trial_enabled_function_name(definition_or_member):
extended_attributes = definition_or_member.extended_attributes
is_origin_trial_enabled = 'OriginTrialEnabled' in extended_attributes
if (is_origin_trial_enabled and 'RuntimeEnabled' in extended_attributes):
if is_origin_trial_enabled and 'RuntimeEnabled' in extended_attributes:
raise Exception('[OriginTrialEnabled] and [RuntimeEnabled] must '
'not be specified on the same definition: '
'%s.%s' % (definition_or_member.idl_name, definition_or_member.name))
......@@ -412,14 +412,26 @@ def origin_trial_enabled_function_name(definition_or_member):
trial_name = extended_attributes['OriginTrialEnabled']
return 'OriginTrials::%sEnabled' % uncapitalize(trial_name)
is_feature_policy_enabled = 'FeaturePolicy' in extended_attributes
if is_feature_policy_enabled and 'RuntimeEnabled' in extended_attributes:
raise Exception('[FeaturePolicy] and [RuntimeEnabled] must '
'not be specified on the same definition: '
'%s.%s' % (definition_or_member.idl_name, definition_or_member.name))
if is_feature_policy_enabled:
includes.add('bindings/core/v8/ScriptState.h')
includes.add('platform/feature_policy/FeaturePolicy.h')
trial_name = extended_attributes['FeaturePolicy']
return 'FeaturePolicy::%sEnabled' % uncapitalize(trial_name)
return None
def origin_trial_feature_name(definition_or_member):
extended_attributes = definition_or_member.extended_attributes
if 'OriginTrialEnabled' not in extended_attributes:
return None
return extended_attributes['OriginTrialEnabled']
return extended_attributes.get('OriginTrialEnabled') or extended_attributes.get('FeaturePolicy')
def runtime_feature_name(definition_or_member):
......
......@@ -43,13 +43,14 @@ class RuntimeFeatureWriter(in_generator.Writer):
'status': ['stable', 'experimental', 'test'],
}
defaults = {
'origin_trial_feature_name': None,
'condition': None,
'implied_by': [],
'depends_on': [],
'custom': False,
'status': None,
'depends_on': [],
'feature_policy': None,
'implied_by': [],
'origin_trial_feature_name': None,
'settable_from_internals': False,
'status': None,
}
def __init__(self, in_file_path):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment