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

Unified Diff: third_party/WebKit/Source/bindings/scripts/v8_utilities.py

Issue 2247923004: Add IDL parsing of FeaturePolicy extended attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Alphabetize defaults list in make_runtime_features.py 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/scripts/v8_utilities.py
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_utilities.py b/third_party/WebKit/Source/bindings/scripts/v8_utilities.py
index 9c82da68f645676faf40bf44f09f110be5531158..5a62450b3c7c53e991194c613104aaa71aad7b35 100644
--- a/third_party/WebKit/Source/bindings/scripts/v8_utilities.py
+++ b/third_party/WebKit/Source/bindings/scripts/v8_utilities.py
@@ -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):

Powered by Google App Engine
This is Rietveld 408576698